From 466926c10faf13c9123752a4ad01a1269b92934c Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Tue, 9 Apr 2024 13:24:50 +0100 Subject: [PATCH] Add github actions --- .github/dependabot.yml | 15 ++++++ .github/workflows/lint.yml | 32 ++++++++++++ .github/workflows/release.yml | 35 +++++++++++++ .github/workflows/validate.yml | 35 +++++++++++++ README.md | 90 ++-------------------------------- 5 files changed, 121 insertions(+), 86 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/validate.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..04f2d40 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + ignore: + # Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json + - dependency-name: "homeassistant" \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..cf9c9c4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: "Lint" + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + build: + runs-on: "ubuntu-latest" + strategy: + matrix: + python-version: ["3.12"] + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies from requirements.txt + run: | + if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi + + - name: Analyse the code with ruff + run: | + python3 -m ruff check . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c009cec --- /dev/null +++ b/.github/workflows/release.yml @@ -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.1.1" + + - name: "Adjust version number" + shell: "bash" + run: | + yq -i -o json '.version="${{ github.event.release.tag_name }}"' \ + "${{ github.workspace }}/custom_components/hive_mqtt_orchestrator/manifest.json" + + - name: "ZIP the integration directory" + shell: "bash" + run: | + cd "${{ github.workspace }}/custom_components/hive_mqtt_orchestrator" + zip hive_mqtt_orchestrator.zip -r ./ + + - name: "Upload the ZIP file to the release" + uses: softprops/action-gh-release@v0.1.15 + with: + files: ${{ github.workspace }}/custom_components/hive_mqtt_orchestrator/hive_mqtt_orchestrator.zip diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..19aa6f2 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,35 @@ +name: "Validate" + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest + name: "Hassfest Validation" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout the repository" + uses: "actions/checkout@v4.1.1" + + - name: "Run hassfest validation" + uses: "home-assistant/actions/hassfest@master" + + hacs: # https://github.com/hacs/action + name: "HACS Validation" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout the repository" + uses: "actions/checkout@v4.1.1" + + - name: "Run HACS validation" + uses: "hacs/action@main" + with: + category: "integration" diff --git a/README.md b/README.md index e2cd510..5355b3a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # HA-Hive-MQTT-Orchestrator Local Hive Thermostat MQTT integration Home Assistant -Early dev, nothing to see yet +## Early beta -To use this integration your Hive thermostat receiver must be added to [Zigbee2MQTT](https://www.zigbee2mqtt.io/supported-devices/#v=Hive). +To use this integration your Hive thermostat receiver must be added to [Zigbee2MQTT](https://www.zigbee2mqtt.io/supported-devices/#v=Hive) and a MQTT broker and the MQTT integration within Home Assistant must be correctly configured. -Zigbee2MQTT will expose the native sensors but Hive requires specific message structures to be sent for setting modes and a combination of sensor values to determine the modes, this integration creates controls and sensors that correctly interface with the native hive values/methods. +Zigbee2MQTT will expose the native sensors but Hive requires specific message structures to be sent for setting modes and a combination of sensor values to determine the modes, this integration creates controls and sensors that correctly interface with the native Hive values/methods. SLR1x and SLR2x thermostats are supported, though this has only been tested with an SLR2c. @@ -15,89 +15,7 @@ The new device created will have new sensors/controls available that will accura You can optionally hide/disable the native Hive device created by Zigbee2MQTT within HomeAssistant. -The integration supports native boost and native schedules. With schedules you can switch on/off schedule mode but you cannot modify the schedule details via the integration. You can of course ignore the schedule mode and setup automations within Home Assistant to control when heating/water is on or off and what temperature for heating. +The integration supports native boost and native schedules. With schedules you can switch on/off schedule mode but you cannot modify the schedule details via the integration. You can of course ignore the schedule mode and setup automations within Home Assistant to control when heating/water is on or off and set a temperature for heating. The numeric entities allow you to set defaults for boost times, temperatures and also frost protection. Frost protection should be set to match what you have set on the Hive thermostat for an accurate display. - -Example received json from zigbee2mqtt/Z2mHiveReceiver -``` -{ - "last_seen": "2024-04-04T09:18:37+01:00", - "linkquality": 109, - "local_temperature_heat": 20.28, - "local_temperature_water": 21, - "occupied_heating_setpoint_heat": 19, - "occupied_heating_setpoint_water": 22, - "running_state_heat": "idle", - "running_state_water": "idle", - "system_mode_heat": "heat", - "system_mode_water": "heat", - "temperature_setpoint_hold_duration_heat": 0, - "temperature_setpoint_hold_duration_water": 0, - "temperature_setpoint_hold_heat": false, - "temperature_setpoint_hold_water": false, - "weekly_schedule_heat": { - "days": [ - "saturday" - ], - "transitions": [ - { - "heating_setpoint": 20, - "time": 420 - }, - { - "heating_setpoint": 19, - "time": 540 - }, - { - "heating_setpoint": 20, - "time": 1020 - }, - { - "heating_setpoint": 1, - "time": 1380 - }, - { - "heating_setpoint": 1, - "time": 1380 - }, - { - "heating_setpoint": 1, - "time": 1380 - } - ] - }, - "weekly_schedule_water": { - "days": [ - "saturday" - ], - "transitions": [ - { - "heating_setpoint": 99, - "time": 1200 - }, - { - "heating_setpoint": 0, - "time": 1320 - }, - { - "heating_setpoint": 0, - "time": 1320 - }, - { - "heating_setpoint": 0, - "time": 1320 - }, - { - "heating_setpoint": 0, - "time": 1320 - }, - { - "heating_setpoint": 0, - "time": 1320 - } - ] - } -} -```