diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..825ad40 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ + +# These are supported funding model platforms + +patreon: Dala318 diff --git a/.github/workflows/hacs.yaml b/.github/workflows/hacs.yaml new file mode 100644 index 0000000..2f8ba2f --- /dev/null +++ b/.github/workflows/hacs.yaml @@ -0,0 +1,15 @@ +name: HACS Action + +on: + push: + pull_request: + +jobs: + hacs: + name: HACS Action + runs-on: "ubuntu-latest" + steps: + - name: HACS Action + uses: "hacs/action@main" + with: + category: "integration" \ No newline at end of file diff --git a/.github/workflows/hassfest.yaml b/.github/workflows/hassfest.yaml new file mode 100644 index 0000000..e5d9c70 --- /dev/null +++ b/.github/workflows/hassfest.yaml @@ -0,0 +1,14 @@ +name: Validate with hassfest + +on: + push: + pull_request: + # schedule: + # - cron: "0 0 * * *" + +jobs: + validate: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - uses: home-assistant/actions/hassfest@master \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c9ce531 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: "Release" + +on: + release: + types: + - "published" + +permissions: {} + +jobs: + release: + name: "Release" + runs-on: "ubuntu-latest" + permissions: + contents: write + steps: + - name: "Checkout the repository" + uses: "actions/checkout@v4" + + - name: "Adjust version number" + shell: "bash" + run: | + yq -i -o json '.version="${{ github.event.release.tag_name }}"' \ + "${{ github.workspace }}/custom_components/ph803w/manifest.json" + + - name: "ZIP the integration directory" + shell: "bash" + run: | + cd "${{ github.workspace }}/custom_components/ph803w" + zip ph803w.zip -r ./ + + - name: "Upload the ZIP file to the release" + uses: softprops/action-gh-release@v2.0.8 + with: + files: ${{ github.workspace }}/custom_components/ph803w/ph803w.zip \ No newline at end of file diff --git a/README.md b/README.md index 6f11300..cb9663f 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,25 @@ With a lot of inspiration and help from https://github.com/Apollon77/node-ph803w Still a lot left to do but at least it can poll the device and show values in Home Assistant. In desktop mode (running cyclic with lib/main.py) it performs a bit better. -## Installation of HA component +# Installation -1. Clone this repo as `ph803w` dir into `$HA_CONFIG_DIR/custom_components/` - ``` - $ cd custom_components - $ git clone git@github.com:dala318/ph803w.git ./ph803w - ``` -2. Setup `$HA_CONFIG_DIR/configuration.yaml` +## Option 1: HACS +1. Go to HACS -> Integrations +2. Click the three dots on the top right and select `Custom Repositories` +3. Enter `https://github.com/dala318/python_ph803w` as repository, select the category `Integration` and click Add +4. A new custom integration shows up for installation (PH-803W) - install it +5. Restart Home Assistant + +## Option 2: Manual + +1. Copy the `ph803w` folder to HA `/custom_components/ph803w/` +2. Restart Home Assistant + +# Configuration + +Setup `$HA_CONFIG_DIR/configuration.yaml` ```yaml ph803w: host: 192.168.1.2 # IP of your device ``` -## Changelog diff --git a/__init__.py b/custom_components/ph803w/__init__.py similarity index 100% rename from __init__.py rename to custom_components/ph803w/__init__.py diff --git a/binary_sensor.py b/custom_components/ph803w/binary_sensor.py similarity index 100% rename from binary_sensor.py rename to custom_components/ph803w/binary_sensor.py diff --git a/const.py b/custom_components/ph803w/const.py similarity index 100% rename from const.py rename to custom_components/ph803w/const.py diff --git a/lib/__init__.py b/custom_components/ph803w/lib/__init__.py similarity index 100% rename from lib/__init__.py rename to custom_components/ph803w/lib/__init__.py diff --git a/lib/device.py b/custom_components/ph803w/lib/device.py similarity index 100% rename from lib/device.py rename to custom_components/ph803w/lib/device.py diff --git a/lib/discovery.py b/custom_components/ph803w/lib/discovery.py similarity index 100% rename from lib/discovery.py rename to custom_components/ph803w/lib/discovery.py diff --git a/lib/main.py b/custom_components/ph803w/lib/main.py similarity index 100% rename from lib/main.py rename to custom_components/ph803w/lib/main.py diff --git a/manifest.json b/custom_components/ph803w/manifest.json similarity index 69% rename from manifest.json rename to custom_components/ph803w/manifest.json index 848427f..7060680 100644 --- a/manifest.json +++ b/custom_components/ph803w/manifest.json @@ -1,11 +1,12 @@ { "domain": "ph803w", "name": "API polling for PH-803W pH and ORP sensor", - "documentation": "https://github.com/dala318/python_ph803w", - "version": "0.0.1", - "dependencies": [], "after_dependencies": [], - "iot_class": "local_polling", "codeowners": ["@dala318"], - "requirements": [] + "dependencies": [], + "documentation": "https://github.com/dala318/python_ph803w", + "iot_class": "local_polling", + "issue_tracker": "https://github.com/dala318/python_ph803w/issues", + "requirements": [], + "version": "0.0.3" } \ No newline at end of file diff --git a/sensor.py b/custom_components/ph803w/sensor.py similarity index 100% rename from sensor.py rename to custom_components/ph803w/sensor.py diff --git a/hacs.json b/hacs.json new file mode 100644 index 0000000..8491300 --- /dev/null +++ b/hacs.json @@ -0,0 +1,6 @@ +{ + "name": "PH-803W", + "render_readme": true, + "zip_release": true, + "filename": "ph803w.zip" + } \ No newline at end of file