Skip to content

Commit

Permalink
Updated readme and added contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
ha-enthus1ast committed Dec 10, 2023
1 parent c65fef2 commit 5f15acd
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 77 deletions.
93 changes: 93 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Contributing to Plejd MQTT Home Assistant](#contributing-to-plejd-mqtt-home-assistant)
- [Getting Started](#getting-started)
- [Setting up the environment](#setting-up-the-environment)
- [Coding Standards](#coding-standards)
- [Pull Requests](#pull-requests)
- [Code linting](#code-linting)
- [Pre-commit Hooks](#pre-commit-hooks)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Contributing to Plejd MQTT Home Assistant

Thanks for consifering contributing tto the project!

## Getting Started

Before you start contributing, please review these guidelines:
<!-- TODO: Add links to issue tracker and pull requests -->
1. Check out the project's issue tracker and pull requests to see if someone else has already reported and/or fixed the issue you're facing.

2. If not, open a new issue. Please provide as much information as possible to help the maintainers understand and solve the problem.

3. If you think you can fix or implement it yourself, fork the project and submit a pull request. Please make sure to follow the coding standards and test your changes.

### Setting up the environment

This project uses [Poetry](https://python-poetry.org/) for dependency management. If you don't have Poetry installed, you can install it with:

```bash
curl -sSL https://install.python-poetry.org | python -
```

Once Poetry is installed, you can set up your environment with:

```bash
poetry install
```
This will create a virtual environment and install all the necessary dependencies so you can start contributing to the project.
To spawn a shell within the environment:

```bash
poetry shell
```

## Coding Standards

Please ensure your code adheres to the following standards:

- Follow the style used in the existing codebase.
- Include comments in your code where necessary.
- Write tests for your changes.

## Pull Requests

When submitting a pull request:

- Include a description of what your change intends to do.
- Be sure to link to the issue that your change is related to, if applicable.
- Make sure your pull request includes tests.

### Code linting
This project uses [Mega-Linter](https://nvuillam.github.io/mega-linter/), an open-source linter that analyzes consistency and quality of your code.

Before submitting a pull request, please ensure your changes do not introduce any new linting errors. You can run Mega-Linter locally to check your code before committing:

```bash
npx mega-linter-runner --flavor python
```
This command will run Mega-Linter against your local codebase and report any issues it finds.

## Pre-commit Hooks

This project uses [pre-commit](https://pre-commit.com/) to ensure that code committed to the repository meets certain standards and passes linting tests. Before you can commit changes to the repository, your changes will be automatically checked by pre-commit hooks.

To install the pre-commit hooks, you need to have pre-commit installed on your local machine. You can install it using pip:

```bash
pip install pre-commit
```

Once pre-commit is installed, you can install the pre-commit hooks with:

```bash
pre-commit install
```

Now, the hooks will automatically run every time you commit changes to the repository. If the hooks find issues, your commit will be blocked until you fix the issues.

We look forward to your contributions. Thank you!
110 changes: 34 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@ A simple mqtt gateway to connect your plejd devices to an MQTT broker and Home A

- [Description](#description)
- [Getting started](#getting-started)
- [Dependencies](#dependencies)
- [Running it locally](#running-it-locally)
- [Running it locally](#running-it-locally)
- [Running it as a container](#running-it-as-a-container)
- [Installing](#installing)
- [Local install](#local-install)
- [Docker install](#docker-install)
- [Features](#features)
- [Setup](#setup)
- [Usage](#usage)
- [Configuration](#configuration)
- [General](#general)
- [API](#api)
- [MQTT](#mqtt)
- [BLE](#ble)
- [Example](#example)
- [Project Status](#project-status)
- [Room for Improvement](#room-for-improvement)
- [Acknowledgements](#acknowledgements)
- [Contact](#contact)
- [License](#license)
- [Contributing](#contributing)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand All @@ -41,67 +33,44 @@ Not supported currently:
* Plejd Sensor
* Plejd scenes

The project is intended to run as a docker container, but can also be run locally.

## Getting started
### Dependencies

#### Running it locally
*python 3.x
*poetry
*bluetoothd
*bluez

This project uses poetry. Use:

`poetry install`
`poetry shell`

to create a new virtual environment to run the project in.

#### Running it as a container
*docker
*docker-compose

The project is intended to run as a docker container, but can also be run locally.

### Installing
#### Local install
Make sure python is installed
### Running it locally

pip install .
Install the following dependencies:

or
- python
- poetry
- bluetooth
- bluez

python setup.py install
See Dockerfile for specific versions

#### Docker install
Make sure docker is installed (tested on Docker version 20.10.24, running on aarch64 ubuntu)
Install python dependencies using:

To build docker container:
sudo docker build . -t plejd
`poetry install`

Spawn a new virtual shell using:

## Features
List the ready features here:
- Awesome feature 1
- Awesome feature 2
- Awesome feature 3
`poetry shell`

Start the program using:

## Setup
What are the project requirements/dependencies? Where are they listed? A requirements.txt or a Pipfile.lock file perhaps? Where is it located?
`python -m plejd_mqtt_ha`

Proceed to describe how to install / setup one's local environment / get started with the project.
#### Running it as a container

Docker is required on the host PC in order to run the program as a container.

## Usage
Running it locally
Build a local container using:

`write-your-code-here`
`docker build . -t plejd`

Running it via docker
Running the container:

Docker compose
`docker run plejd`

## Configuration

Expand Down Expand Up @@ -175,33 +144,22 @@ ble:
scan_time: 20.0
```
## Project Status
This project was made as a hobby project and is not frequently updated
## Room for Improvement
Include areas you believe need improvement / could be improved. Also add TODOs for future development.
Room for improvement:
- Improvement to be done 1
- Improvement to be done 2
## Acknowledgements
To do:
- Feature to be added 1
- Feature to be added 2
This project is inspired by the following repositories:
- [ha-plejd](https://github.com/klali/ha-plejd)
- [hassio-plejd](https://github.com/icanos/hassio-plejd)
## Acknowledgements
Give credit here.
- This project was inspired by...
- Many thanks to...
It also utilizes the [ha-mqtt-discoverable](https://github.com/unixorn/ha-mqtt-discoverable) library
for creating MQTT devices automatically discovered by Home Assistant.
A special thanks to the authors and contributors of these projects for their work and inspiration.
## Contact
Created by
## License
This project is open source and available under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
<!-- Optional -->
<!-- ## License -->
<!-- This project is open source and available under the [... License](). -->
## Contributing
<!-- You don't have to include all sections - just the one's relevant to your project -->
I welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to this project.
1 change: 0 additions & 1 deletion healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import time

import yaml

from plejd_mqtt_ha.mdl.settings import PlejdSettings
from pydantic import ValidationError

Expand Down

0 comments on commit 5f15acd

Please sign in to comment.