Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Homebridge v2 #920

Merged
merged 6 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
-Dsonar.pullrequest.branch=${{ steps.pr.outputs.head_ref }}
-Dsonar.pullrequest.base=${{ steps.pr.outputs.base_ref }}

- name: Publish Code Coverage
- name: Publish Coverage to Codecov
uses: codecov/codecov-action@v4
with:
override_pr: ${{ steps.pr.outputs.number }}
Expand All @@ -96,6 +96,16 @@ jobs:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Publish Test Results to Codecov
uses: codecov/test-results-action@v1
with:
override_pr: ${{ steps.pr.outputs.number }}
override_commit: ${{ steps.pr.outputs.head_sha }}
files: ./reports/junit.xml
flags: tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Add comment to PR if job fails
if: ${{ failure() }}
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Update generated documentation

on:
schedule:
- cron: "0 16 * * *"
- cron: '30 19 * * 0-1,5-6'
workflow_dispatch:
inputs:
forced:
description: "Force regeneration even if the Zigbee2MQTT versions did not change"
description: 'Force regeneration even if the Zigbee2MQTT versions did not change'
required: false
default: false
type: boolean
Expand All @@ -20,10 +20,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 20.x
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x

- name: Determine Zigbee2MQTT version
id: version
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
echo "updated=0" >> $GITHUB_OUTPUT
node_modules/.bin/ts-node src/docgen/docgen.ts
git diff --exit-code -s docs ||echo "updated=1" >> $GITHUB_OUTPUT

- uses: actions/create-github-app-token@v1
id: pr-token
with:
Expand All @@ -68,10 +68,10 @@ jobs:
with:
token: ${{ steps.pr-token.outputs.token }}
assignees: itavero
commit-message: "Docs generated based on zigbee-herdsman-converters v${{ steps.version.outputs.herdsman }}"
commit-message: 'Docs generated based on zigbee-herdsman-converters v${{ steps.version.outputs.herdsman }}'
branch: update-device-docs
delete-branch: true
title: "Update device documentation (zigbee-herdsman-converters ${{ steps.version.outputs.herdsman }})"
title: 'Update device documentation (zigbee-herdsman-converters ${{ steps.version.outputs.herdsman }})'
body: |-
Documentation has been automatically regenerated, because a new version of :bee: Zigbee2MQTT and/or zigbee-herdsman-converters
was detected or because a forced update was requested.
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
- main
- "releases?/**"
- 'releases?/**'
tags:
- v[0-9]+.[0-9]+.[0-9]+*

Expand All @@ -17,12 +17,12 @@ jobs:
name: Verify
runs-on: ubuntu-latest
env:
node-version-analysis: 20.x
node-version-analysis: 22.x

strategy:
matrix:
# the Node.js versions to build on
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- name: Checkout
Expand Down Expand Up @@ -64,6 +64,7 @@ jobs:
coverage/lcov.info
coverage/clover.xml
reports/tests.xml
reports/junit.xml

- name: SonarCloud (on push)
uses: sonarsource/sonarcloud-github-action@v2
Expand All @@ -80,3 +81,12 @@ jobs:
flags: tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Codecov Test Results (on push)
uses: codecov/test-results-action@v1
if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis
with:
files: ./reports/junit.xml
flags: tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.formatOnSave": false
},
"cSpell.words": [
"Elgato",
"Zigbee"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ Since version 1.0.0, we try to follow the [Semantic Versioning](https://semver.o
### Changed

- For numeric characteristics that have a range set, the range is automatically updated if an out of range value is received from Zigbee2MQTT.
- Lights: `color_mode` is now always used (no longer an experimental flag; also see [#208](https://github.com/itavero/homebridge-z2m/issues/208))

### Fixed

- Processing JSON availability payload should not result in a TypeError anymore.
- Minor changes to be compatible with the upcoming Homebridge v2 release, among others:
- In most services where the (numeric) range of a characteristic is limited, the value is now set correctly before doing so, to prevent warnings from HAP-NodeJS.
- Sanitize accessory names so they only contain alphanumeric, space, and apostrophe characters, and start with an alphanumeric character.

## [1.11.0-beta.7] - 2025-01-04

Expand Down
1 change: 0 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,4 @@ In the latest (or next) release the following features can be enabled:

| Flag | Global | Device | Description |
| ---- | ------ | ------ | ----------- |
| `COLOR_MODE` | ✅ | ✅ | Possible workaround/fix for issue described in issue [#208](https://github.com/itavero/homebridge-z2m/issues/208) |
| `AVAILABILITY` | ✅ | ✅ | Enable Availability feature. Without this flag, the logic will still be executed, except for changing the status of characteristics. (see [#56](https://github.com/itavero/homebridge-z2m/issues/56) / [#593](https://github.com/itavero/homebridge-z2m/issues/593)) |
29 changes: 20 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ module.exports = {
testEnvironment: 'node',
setupFilesAfterEnv: ['jest-chain'],
coverageReporters: ['json', 'lcov', 'text', 'clover'],
collectCoverageFrom : [
'src/**/*.ts',
'!src/docgen/*.ts',
collectCoverageFrom: ['src/**/*.ts', '!src/docgen/*.ts'],
reporters: [
'default',
[
'jest-sonar',
{
outputDirectory: 'reports',
outputName: 'tests.xml',
reportedFilePath: 'relative',
},
],
[
'jest-junit',
{
outputDirectory: 'reports',
outputName: 'junit.xml',
reportedFilePath: 'relative',
},
],
],
reporters: ['default', ['jest-sonar', {
outputDirectory: 'reports',
outputName: 'tests.xml',
reportedFilePath: 'relative',
}]],
};
};
Loading
Loading