From 5da7174763c63da0d6cc4ebab921920b303cb896 Mon Sep 17 00:00:00 2001 From: DanielV Date: Wed, 26 Feb 2025 09:00:44 +0000 Subject: [PATCH 1/4] Add HACS-files --- .github/FUNDING.yml | 4 ++++ .github/workflows/hacs.yaml | 15 ++++++++++++++ .github/workflows/hassfest.yaml | 14 +++++++++++++ .github/workflows/release.yaml | 35 +++++++++++++++++++++++++++++++++ hacs.json | 6 ++++++ 5 files changed, 74 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/hacs.yaml create mode 100644 .github/workflows/hassfest.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 hacs.json 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/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 From b8678f7a8203f020b87f34d678b08d04a66b91bf Mon Sep 17 00:00:00 2001 From: DanielV Date: Wed, 26 Feb 2025 09:02:24 +0000 Subject: [PATCH 2/4] Move into custom_components folder --- __init__.py => custom_components/ph803w/__init__.py | 0 binary_sensor.py => custom_components/ph803w/binary_sensor.py | 0 const.py => custom_components/ph803w/const.py | 0 {lib => custom_components/ph803w/lib}/__init__.py | 0 {lib => custom_components/ph803w/lib}/device.py | 0 {lib => custom_components/ph803w/lib}/discovery.py | 0 {lib => custom_components/ph803w/lib}/main.py | 0 manifest.json => custom_components/ph803w/manifest.json | 0 sensor.py => custom_components/ph803w/sensor.py | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename __init__.py => custom_components/ph803w/__init__.py (100%) rename binary_sensor.py => custom_components/ph803w/binary_sensor.py (100%) rename const.py => custom_components/ph803w/const.py (100%) rename {lib => custom_components/ph803w/lib}/__init__.py (100%) rename {lib => custom_components/ph803w/lib}/device.py (100%) rename {lib => custom_components/ph803w/lib}/discovery.py (100%) rename {lib => custom_components/ph803w/lib}/main.py (100%) rename manifest.json => custom_components/ph803w/manifest.json (100%) rename sensor.py => custom_components/ph803w/sensor.py (100%) 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 100% rename from manifest.json rename to custom_components/ph803w/manifest.json 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 From 186c812ac6c0d6cf8c0d3789307c78917fef9691 Mon Sep 17 00:00:00 2001 From: DanielV Date: Wed, 26 Feb 2025 09:07:33 +0000 Subject: [PATCH 3/4] Try fixing hassfest errors --- custom_components/ph803w/manifest.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/ph803w/manifest.json b/custom_components/ph803w/manifest.json index 848427f..7060680 100644 --- a/custom_components/ph803w/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 From 5255a5932e7f61a235c076ad011bcc2a92c048a2 Mon Sep 17 00:00:00 2001 From: DanielV Date: Wed, 26 Feb 2025 09:40:54 +0000 Subject: [PATCH 4/4] Fix README-md --- README.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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