Compare commits

...
464 Commits
Author SHA1 Message Date
Koen Kantersandgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> ea39d86e6b chore: release 1.37.1 (#22569)
* chore: release dev

* chore(release): update helm-chart docs

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-09 22:23:15 +02:00
Koen KantersandKoenkk 06fd8a4eb1 fix(ignore): update zigbee-herdsman-converters to 19.37.2 (#22570)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-09 20:14:10 +00:00
Nerivec d26ccaed65 fix: Fix logger crashing on restart (#22565) 2024-05-09 21:42:28 +02:00
Koen KantersandKoenkk 989f667c81 fix(ignore): update zigbee-herdsman to 0.46.6 (#22558)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-09 06:17:53 +00:00
Koen Kanters cce41c20fb chore: set release-please pull-request-title-pattern 2024-05-08 23:43:55 +02:00
Koen Kanters 350c682e8f chore: make tests faster 2024-05-08 23:32:46 +02:00
Koen KantersandKoenkk 6bcb4b66b1 fix(ignore): update zigbee-herdsman to 0.46.5 (#22552)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-08 21:16:13 +00:00
Koen Kanters 58d37b0f92 chore: improve test speed 2024-05-08 23:09:23 +02:00
Koen Kanters aecdfe638b chore: another attempt to fix release_please 2024-05-08 22:55:46 +02:00
Koen KantersandKoenkk cc9a95c74e fix(ignore): update zigbee-herdsman-converters to 19.37.1 (#22549)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-08 20:49:51 +00:00
Koen Kanters 834626d2e9 chore: fix release_please.yml 2024-05-08 22:44:30 +02:00
Koen KantersandKoenkk 6b886f6268 fix(ignore): update zigbee-herdsman-converters to 19.37.0 (#22531)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-07 20:49:28 +00:00
Koen Kanters a0c9a1769f fix: Fix MQTT ECONNREFUSED error https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/605 2024-05-07 21:25:01 +02:00
Koen KantersandKoenkk 3544d5172e fix(ignore): update zigbee-herdsman-converters to 19.36.1 (#22503)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-06 20:00:06 +00:00
Koen KantersandKoenkk e44608a46d fix(ignore): update zigbee-herdsman to 0.46.4 (#22501)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-06 19:55:04 +00:00
Jose Luis Pedrosaandjose 6a69c16170 chore: Release please no longer overwrites .release-please-manifest.json (#22499)
Co-authored-by: jose <jose.pedrosa@reddit.com>
2024-05-06 21:43:55 +02:00
Jose Luis Pedrosaandjose b2e8b3e00c fix: Add Helm chart (#21852)
* Initial draft for helm chart

* Add CI using helm releaser

Add helm chart docummentation

Add configuration.yaml values

* Set maintainer

set right defaults on values.yaml

* Add ci to update values on chart

* Add chart version on CI

* Remove manual update of the chart

* Trigger update of Chart.yaml with release_please

* Add chart to release-please

* Add version to release-please manifest for chart

* remove the second release-please

* Update appVersion in chart.yaml too

* Add make target to generate helm-docs

* Generate docs and manage versions in release-please

* Add persistent static volumes

* Small fixes, ensure no volume works

* Fixes for static provisioned volume

* Delete yq dependency in CI

* Delete Makefile, update release-please to run doc generation directly

---------

Co-authored-by: jose <jose.pedrosa@reddit.com>
2024-05-06 20:30:09 +02:00
Koen KantersandKoenkk 358e2eee45 fix(ignore): update zigbee-herdsman-converters to 19.36.0 (#22472)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-05 20:45:29 +00:00
Koen KantersandKoenkk 316654b5d3 fix(ignore): update zigbee-herdsman to 0.46.3 (#22471)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-05 20:32:55 +00:00
Nerivec eb49f523bf fix: Add settings for finer control over debug log level (#22426)
* Add settings for finer control over debug log level.

* Updates from feedback.
2024-05-05 21:52:26 +02:00
Koen KantersandKoenkk b754b9d463 fix(ignore): update dependencies (#22456)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-05 21:44:20 +02:00
Koen KantersandKoenkk e4c9bac348 fix(ignore): update zigbee-herdsman to 0.46.2 (#22470)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-05 19:05:33 +00:00
Koen KantersandKoenkk beedfaefac fix(ignore): update zigbee-herdsman-converters to 19.35.0 (#22442)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-04 08:34:32 +00:00
Koen KantersandKoenkk 329d832337 fix(ignore): update zigbee-herdsman to 0.46.1 (#22439)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-04 07:00:44 +00:00
Koen Kantersandnurikk 23e97d0001 fix(ignore): update zigbee2mqtt-frontend to 0.6.167 (#22419)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-05-03 08:44:34 +00:00
Koen KantersandKoenkk 3a61f0acfa Update zigbee-herdsman-converters to 19.34.0 (#22411)
* fix(ignore): update zigbee-herdsman-converters to 19.34.0

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-02 20:20:06 +00:00
Koen Kantersandnurikk 5899436d74 fix(ignore): update zigbee2mqtt-frontend to 0.6.166 (#22410)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-05-02 20:00:06 +00:00
Koen Kanters 97d5c5c97a chore: merge master to dev 2024-05-02 21:18:48 +02:00
rbswift ee5cf5a901 chore: Improve update.sh (#22395)
Pulling without specifying how to reconcile divergent branches is discouraged and produces an ugly "hint" that can be a little disconcerting when running update.sh
2024-05-02 21:18:25 +02:00
Koen KantersandKoenkk 907591c467 fix(ignore): update zigbee-herdsman-converters to 19.33.0 (#22381)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-01 20:28:30 +00:00
Koen KantersandKoenkk 55b5f91a96 fix(ignore): update zigbee-herdsman to 0.46.0 (#22380)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-01 20:20:29 +00:00
github-actions[bot] ce915a6797 chore: promote to dev 2024-05-01 19:45:20 +00:00
Koen Kanters 46f34c8cc7 chore(dev): release 1.37.0 (#22022) 2024-05-01 21:23:10 +02:00
Koen KantersandKoenkk e03013c581 fix(ignore): update zigbee-herdsman-converters to 19.32.0 (#22377)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-05-01 19:17:13 +00:00
Koen Kantersandnurikk 8a288a9119 fix(ignore): update zigbee2mqtt-frontend to 0.6.165 (#22366)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-04-30 19:47:10 +00:00
Koen KantersandKoenkk 8e27ec24f6 fix(ignore): update zigbee-herdsman to 0.45.0 (#22365)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-30 19:38:26 +00:00
Koen KantersandKoenkk 4b291bf012 Update zigbee-herdsman-converters to 19.31.1 (#22341)
* fix(ignore): update zigbee-herdsman-converters to 19.31.1

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-29 20:01:56 +00:00
Koen Kantersandnurikk 10e6ad0e67 fix(ignore): update zigbee2mqtt-frontend to 0.6.164 (#22340)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-04-28 18:23:36 +00:00
Koen KantersandKoenkk 1b089ef6ae fix(ignore): update zigbee-herdsman to 0.44.0 (#22339)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-28 18:11:30 +00:00
Koen KantersandKoenkk d7e2d98a5a fix(ignore): update dependencies (#22331)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-28 08:56:01 +02:00
Koen Kanters eb69319674 chore: merge master to dev 2024-04-28 08:53:39 +02:00
Koen Kanters 8c8a6a3ecf chore: don't autoupdate eslint 2024-04-28 08:53:17 +02:00
Koen Kanters baa1d703d4 chore: don't autoupdate eslint 2024-04-28 08:50:56 +02:00
Koen KantersandKoenkk 37551265a2 fix(ignore): update zigbee-herdsman-converters to 19.29.0 (#22325)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-27 07:19:33 +00:00
Koen KantersandKoenkk 245afb1126 fix(ignore): update zigbee-herdsman-converters to 19.28.0 (#22318)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-25 20:31:11 +00:00
Koen KantersandKoenkk 389779d4e3 fix(ignore): update zigbee-herdsman to 0.43.1 (#22317)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-25 19:50:10 +00:00
Koen KantersandKoenkk df23240683 fix(ignore): update zigbee-herdsman-converters to 19.27.0 (#22301)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-23 20:46:01 +00:00
Koen KantersandKoenkk 75f9743528 fix(ignore): update zigbee-herdsman to 0.43.0 (#22300)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-23 20:25:41 +00:00
Koen Kantersandnurikk e5d632bc91 fix(ignore): update zigbee2mqtt-frontend to 0.6.163 (#22288)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-04-22 11:31:56 +00:00
Koen KantersandKoenkk 4f97a7ad2c fix(ignore): update zigbee-herdsman to 0.42.5 (#22285)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-21 20:47:08 +00:00
Koen KantersandKoenkk 4bf2ffa7dd fix(ignore): update zigbee-herdsman-converters to 19.26.0 (#22284)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-21 19:09:52 +00:00
Koen KantersandKoenkk a8f6bec673 fix(ignore): update zigbee-herdsman to 0.42.4 (#22283)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-21 19:01:53 +00:00
Koen KantersandKoenkk 80504b943d fix(ignore): update zigbee-herdsman-converters to 19.25.0 (#22266)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-20 10:04:27 +00:00
Koen KantersandKoenkk d9628df17b fix(ignore): update zigbee-herdsman-converters to 19.24.0 (#22254)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-18 20:29:12 +00:00
Koen KantersandKoenkk f7abbd5f5a fix(ignore): update zigbee-herdsman to 0.42.3 (#22253)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-18 20:15:59 +00:00
Koen KantersandKoenkk 1544317fce fix(ignore): update zigbee-herdsman-converters to 19.23.0 (#22232)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-16 19:49:38 +00:00
Koen KantersandKoenkk 172aa7461a fix(ignore): update zigbee-herdsman-converters to 19.22.0 (#22221)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-15 20:13:35 +00:00
Koen KantersandKoenkk 76f5425452 fix(ignore): update zigbee-herdsman to 0.42.2 (#22220)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-15 19:55:40 +00:00
Koen KantersandKoenkk 87aa18d14c fix(ignore): update zigbee-herdsman-converters to 19.21.0 (#22199)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-13 08:07:00 +00:00
Koen KantersandKoenkk e10ab5ccb2 fix(ignore): update zigbee-herdsman-converters to 19.20.0 (#22187)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-11 19:46:11 +00:00
f774753213 fix(ignore): update zigbee-herdsman-converters to 19.19.1 (#22171)
* fix(ignore): update zigbee-herdsman-converters to 19.19.1

* fix(configure): pass definition to function call (#22154)

* Pass definition to configure

* fix test

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
Co-authored-by: Sergei Salimov <32013287+mrskycriper@users.noreply.github.com>
2024-04-10 22:02:12 +02:00
Koen KantersandKoenkk a210c238f1 fix(ignore): update zigbee-herdsman to 0.42.1 (#22143)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-10 19:56:41 +00:00
Koen KantersandKoenkk cdbbe0d49f fix(ignore): update zigbee-herdsman-converters to 19.19.0 (#22153)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-09 19:21:28 +00:00
Koen Kanters c98e5a74de fix: Remove deprecated Home Assistant color_mode (#22142) 2024-04-08 21:19:17 +02:00
Koen KantersandKoenkk 8b8d660b06 fix(ignore): update zigbee-herdsman-converters to 19.18.0 (#22141)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-08 19:14:41 +00:00
Nerivec 3c1a4afcb7 fix: Convert logger into a class (#22129) 2024-04-07 20:52:55 +02:00
Koen KantersandKoenkk cabc9f5e2f fix(ignore): update zigbee-herdsman-converters to 19.17.0 (#22122)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-07 08:46:33 +00:00
Koen KantersandKoenkk 28b8aff1ae fix(ignore): update zigbee-herdsman to 0.42.0 (#22121)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-07 10:42:45 +02:00
Koen KantersandKoenkk e7487189cf fix(ignore): update dependencies (#22007)
* fix(ignore): update dependencies

* fix

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-06 13:02:02 +02:00
Koen Kanters 92f53235f3 fix: Fix crash when stopping in case MQTT client did not connect yet (#22110) 2024-04-06 10:49:22 +00:00
Koen Kanters 002050f35b fix: Reduce MQTT publishing by excluding debug logging from bridge/logging (#22066)
* fix: Reduce MQTT publishing by excluding debug logging from `bridge/logging`

* fix tests

* fix
2024-04-06 12:44:43 +02:00
Koen KantersandKoenkk 394a3fbd8a fix(ignore): update zigbee-herdsman-converters to 19.16.0 (#22107)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-06 09:46:26 +00:00
Koen Kanters af3a0332f9 chore: Update stale.yml 2024-04-06 08:33:30 +02:00
Koen Kantersandnurikk 0c80129466 fix(ignore): update zigbee2mqtt-frontend to 0.6.162 (#22094)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-04-05 11:51:31 +00:00
Koen KantersandKoenkk ae35aaed5e fix(ignore): update zigbee-herdsman-converters to 19.15.0 (#22089)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-04 20:06:53 +00:00
Koen Kanters 9d251dbad5 fix: Disable automatic reconfigure when configureKey changes (#22088) 2024-04-04 21:47:44 +02:00
Koen KantersandKoenkk a020138f6b fix(ignore): update zigbee-herdsman to 0.41.2 (#22087)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-04 19:36:33 +00:00
Koen KantersandKoenkk 701cdda38c Update zigbee-herdsman-converters to 19.14.0 (#22065)
* fix(ignore): update zigbee-herdsman-converters to 19.14.0

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-04 19:33:39 +00:00
Nerivec 919c4eee73 fix: Cleanup old logger leftovers (#22069) 2024-04-04 20:24:39 +02:00
Koen KantersandKoenkk 3e913495b1 fix(ignore): update zigbee-herdsman to 0.41.1 (#22064)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-03 18:26:22 +00:00
Koen Kanters bbb6f9e042 fix: Change MQTT publish log to debug (#22063) 2024-04-03 18:13:46 +00:00
Koen Kanters cdd6fb0864 fix(ignore): fix 73566df 2024-04-02 22:39:33 +02:00
Koen Kanters 780c065fa1 fix(ignore): fix 73566dff98 2024-04-02 22:38:02 +02:00
Koen KantersandKoenkk db7d9e1120 fix(ignore): update zigbee-herdsman-converters to 19.13.0 (#22046)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-02 22:37:10 +02:00
NerivecandKoen Kanters 73566dff98 feat: Unified logging across z2m/zh/zhc (#21984)
* Unified logging across z2m/zh/zhc

* Updates

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-04-02 22:33:51 +02:00
Koen KantersandKoenkk bd0a41107a fix(ignore): update zigbee-herdsman to 0.41.0 (#22045)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-02 22:33:26 +02:00
Koen KantersandKoenkk 62844ff637 Update zigbee-herdsman-converters to 19.12.1 (#22044)
* fix(ignore): update zigbee-herdsman-converters to 19.12.1

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-02 20:17:43 +00:00
github-actions[bot] 5077b03a02 chore: promote to dev 2024-04-01 18:06:23 +00:00
Koen Kanters ffc2ff1d0e chore(dev): release 1.36.1 (#21638) 2024-04-01 19:52:17 +02:00
Koen KantersandKoenkk 3aadab0925 fix(ignore): update zigbee-herdsman-converters to 19.11.2 (#22021)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-01 17:49:24 +00:00
Koen KantersandKoenkk 85c00b8b43 fix(ignore): update zigbee-herdsman-converters to 19.11.1 (#22014)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-31 19:12:44 +00:00
Koen KantersandKoenkk e51792c65a fix(ignore): update zigbee-herdsman-converters to 19.11.0 (#22013)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-31 18:44:03 +00:00
Koen KantersandKoenkk 1e74b2f53f fix(ignore): update zigbee-herdsman to 0.40.3 (#22010)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-31 08:01:06 +00:00
Koen KantersandKoenkk 886b5345d7 fix(ignore): update zigbee-herdsman to 0.40.2 (#22000)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-30 10:14:12 +00:00
Koen KantersandKoenkk 7d8b5374ad fix(ignore): update zigbee-herdsman-converters to 19.10.0 (#21996)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-29 19:48:10 +00:00
Koen KantersandKoenkk 0c7730f4c5 fix(ignore): update zigbee-herdsman to 0.40.1 (#21987)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-28 20:08:42 +00:00
Koen KantersandKoenkk a7aab714ba fix(ignore): update zigbee-herdsman-converters to 19.9.0 (#21970)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-27 19:57:56 +00:00
Koen KantersandKoenkk 032b9a096e fix(ignore): update zigbee-herdsman-converters to 19.8.0 (#21957)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-26 19:47:40 +00:00
Koen KantersandKoenkk 1f3d61dc7f Update zigbee-herdsman-converters to 19.7.0 (#21947)
* fix(ignore): update zigbee-herdsman-converters to 19.7.0

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-25 21:24:00 +00:00
Koen KantersandKoenkk 32b173c653 fix(ignore): update zigbee-herdsman-converters to 19.6.0 (#21927)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-24 13:48:20 +00:00
Koen KantersandKoenkk 8c4cd8c9aa fix(ignore): update dependencies (#21923)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-24 08:06:46 +01:00
Koen KantersandKoenkk 73423ebd60 fix(ignore): update zigbee-herdsman-converters to 19.5.0 (#21902)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-21 19:35:31 +00:00
Koen KantersandKoenkk 334e260b85 fix(ignore): update zigbee-herdsman to 0.40.0 (#21901)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-21 19:32:32 +00:00
Koen Kanters 731957dab9 chore: merge master to dev 2024-03-21 20:10:51 +01:00
wexmanandJens Weiermann 9c505fd75f chore: optimized svg logo (#21874)
* optimized svg image

* preserved original border

---------

Co-authored-by: Jens Weiermann <j.weiermann@wilms.com>
2024-03-21 20:10:33 +01:00
Koen KantersandKoenkk 25cec20f0d fix(ignore): update zigbee-herdsman-converters to 19.4.2 (#21892)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-20 20:40:45 +00:00
Koen KantersandKoenkk f05d501380 fix(ignore): update zigbee-herdsman to 0.39.1 (#21891)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-20 20:27:30 +00:00
Koen KantersandKoenkk b02c34c6e5 fix(ignore): update zigbee-herdsman-converters to 19.4.1 (#21872)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-19 20:57:38 +00:00
Koen KantersandKoenkk 801134b630 fix(ignore): update zigbee-herdsman to 0.39.0 (#21871)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-19 20:50:21 +00:00
Koen KantersandKoenkk 73d43007d4 fix(ignore): update zigbee-herdsman-converters to 19.4.0 (#21870)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-19 20:30:52 +00:00
Koen KantersandKoenkk 1a9e05e6ab fix(ignore): update zigbee-herdsman-converters to 19.3.0 (#21851)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-17 20:21:30 +00:00
Koen KantersandKoenkk 1006725b09 fix(ignore): update dependencies (#21832)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-17 10:18:56 +01:00
Koen KantersandKoenkk a4f9c49ab5 fix(ignore): update zigbee-herdsman-converters to 19.2.1 (#21801)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-14 19:58:50 +00:00
Koen KantersandKoenkk 658622880f fix(ignore): update zigbee-herdsman to 0.38.1 (#21802)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-14 20:55:17 +01:00
Koen KantersandKoenkk 720fc491ce fix(ignore): update zigbee-herdsman-converters to 19.1.1 (#21789)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-13 19:45:48 +00:00
Koen KantersandKoenkk 56feb77f2d fix(ignore): update zigbee-herdsman-converters to 19.1.0 (#21778)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-12 20:42:14 +00:00
Koen KantersandKoenkk 233d263e13 fix(ignore): update zigbee-herdsman to 0.38.0 (#21777)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-12 20:32:24 +00:00
Koen KantersandKoenkk dbd616fbe5 fix(ignore): update zigbee-herdsman-converters to 19.0.0 (#21768)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-11 20:51:22 +00:00
Koen KantersandKoenkk 86c2e90e06 Update zigbee-herdsman-converters to 18.49.0 (#21767)
* fix(ignore): update zigbee-herdsman-converters to 18.49.0

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-11 20:40:55 +00:00
Koen KantersandKoenkk 43610bbff4 fix(ignore): Update dependencies (#21740)
* fix(ignore): update dependencies

* fix

* fix

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-10 19:08:48 +00:00
Koen Kanters 29543bad4b fix(ignore): fix tests 2024-03-10 19:54:35 +01:00
Koen KantersandKoenkk 2a047a469c fix(ignore): update zigbee-herdsman-converters to 18.48.0 (#21753)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-10 19:45:41 +01:00
Koen Kanters 83502f2d30 fix(ignore): Update manufacturer codes (#21729) 2024-03-10 19:45:22 +01:00
Koen KantersandKoenkk b60f679814 fix(ignore): update zigbee-herdsman to 0.37.0 (#21743)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-10 19:41:50 +01:00
Sergei Salimov 14e044093c fix: Home Assistant: remove button name if device_class is present (#21726)
* Remove preset name if button has device class

* fix device_class for consumer_connected

* combine device_class checks
2024-03-08 22:39:15 +01:00
Koen KantersandKoenkk 3188038a7b fix(ignore): update zigbee-herdsman-converters to 18.47.0 (#21728)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-08 21:36:44 +00:00
Koen KantersandKoenkk ebf996acd8 fix(ignore): update zigbee-herdsman to 0.36.2 (#21727)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-08 21:26:15 +00:00
Koen KantersandKoenkk 0e0eccbd13 fix(ignore): update zigbee-herdsman-converters to 18.46.0 (#21714)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-07 21:03:26 +00:00
Koen KantersandKoenkk e834e93deb fix(ignore): update zigbee-herdsman to 0.36.1 (#21713)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-07 20:05:21 +00:00
Koen KantersandKoenkk d37c164993 fix(ignore): update zigbee-herdsman-converters to 18.45.0 (#21699)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-06 19:36:32 +00:00
Koen KantersandKoenkk 6daa7aa61d fix(ignore): update zigbee-herdsman-converters to 18.44.0 (#21690)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-05 21:36:10 +00:00
koenkk 1110d3f8ef fix: Fix incorrect update state when Z2M is restarted during OTA update https://github.com/Koenkk/zigbee2mqtt/issues/12794 2024-03-05 22:33:33 +01:00
Koen KantersandKoenkk 1d73d9d476 fix(ignore): update zigbee-herdsman to 0.36.0 (#21689)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-05 20:51:14 +00:00
Simon RettbergandKoen Kanters 2da80954d6 fix: Fix crash due to race condition during interview (#21680)
Fixes #21118
Mentioned in #21036 and #20688

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-03-05 21:28:35 +01:00
koenkk e2fa66a38c chore: fix ci 2024-03-05 21:23:07 +01:00
koenkk 94382ee418 chore: fix ci 2024-03-05 21:19:56 +01:00
Koen KantersandKoenkk 94c92ef021 Update zigbee-herdsman-converters to 18.43.0 (#21678)
* fix(ignore): update zigbee-herdsman-converters to 18.43.0

* Update configure.test.js

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-04 21:44:31 +00:00
Koen KantersandKoenkk 8c86849bb9 fix(ignore): update dependencies (#21657)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-04 22:32:11 +01:00
Koen KantersandKoenkk 30909d57fb fix(ignore): update zigbee-herdsman to 0.35.3 (#21677)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-04 21:23:13 +00:00
Koen Kantersandnurikk aaed8ab95e fix(ignore): update zigbee2mqtt-frontend to 0.6.161 (#21660)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-03-03 09:39:49 +00:00
Koen Kanters f24b20b133 chore: merge master to dev 2024-03-02 22:19:13 +01:00
koenkk 2a53b8e59b chore: fix release ci 2024-03-02 22:18:48 +01:00
Koen KantersandKoenkk ccaa1281a3 fix(ignore): update zigbee-herdsman to 0.35.2 (#21654)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-02 21:16:37 +00:00
Sergei Salimov 01843fe6c4 fix: Add more Home Assistant entity icons (#21652) 2024-03-02 21:46:46 +01:00
Koen Kanters 66fb672492 fix: Fix set endpoint name conversion (#21653)
* fix: Fix `set` endpoint name conversion https://github.com/Koenkk/zigbee2mqtt/issues/21646

* fix
2024-03-02 21:45:19 +01:00
koenkk 38ed953599 chore: promote to dev 2024-03-01 21:17:51 +01:00
Koen Kanters 86ed71cb1f chore(dev): release 1.36.0 (#21266) 2024-03-01 20:58:11 +01:00
Koen KantersandKoenkk ccc31670ec fix(ignore): update zigbee-herdsman-converters to 18.42.0 (#21637)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-01 19:50:46 +00:00
Koen KantersandKoenkk 0d8f5780dd fix(ignore): update zigbee-herdsman to 0.35.1 (#21636)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-03-01 19:45:01 +00:00
Koen Kantersandnurikk a8a262640f fix(ignore): update zigbee2mqtt-frontend to 0.6.159 (#21623)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-29 20:45:12 +00:00
Koen KantersandKoenkk 72333f0888 fix(ignore): update zigbee-herdsman-converters to 18.41.0 (#21622)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-29 20:20:07 +00:00
Koen KantersandKoenkk a84083be40 fix(ignore): update zigbee-herdsman to 0.35.0 (#21621)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-29 16:57:19 +00:00
Sergei Salimov 9b8583e778 fix: Add noise and noise_detected to HA lookup (#21610) 2024-02-29 17:42:48 +01:00
Koen KantersandKoenkk aeaa040920 fix(ignore): update zigbee-herdsman-converters to 18.40.0 (#21603)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-27 20:04:02 +00:00
Koen KantersandKoenkk 222b67b1b0 fix(ignore): update zigbee-herdsman to 0.34.9 (#21602)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-27 19:04:44 +00:00
Koen KantersandKoenkk 1ee1710a96 Update zigbee-herdsman-converters to 18.39.1 (#21590)
* fix(ignore): update zigbee-herdsman-converters to 18.39.1

* fix

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-26 21:32:08 +00:00
Koen Kanters a1e2ee7837 chore: merge master to dev 2024-02-26 21:45:09 +01:00
koenkk f04ade6d76 chore: Update problem_report template 2024-02-26 21:44:00 +01:00
Koen KantersandKoenkk fee0811893 fix(ignore): update zigbee-herdsman to 0.34.8 (#21588)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-26 19:21:45 +00:00
Koen Kanters 956003aa0a fix: Fix endpoint matching for TuYa dummy endpoints (#21576) 2024-02-26 20:02:05 +01:00
Koen KantersandKoenkk 8fb28f9e2f Update zigbee-herdsman-converters to 18.38.0 (#21568)
* fix(ignore): update zigbee-herdsman-converters to 18.38.0

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-25 21:09:35 +00:00
Koen KantersandKoenkk a06a0ea059 fix(ignore): update zigbee-herdsman to 0.34.7 (#21575)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-25 21:04:49 +00:00
Koen KantersandKoenkk 4f71c1e8bf fix(ignore): update zigbee-herdsman to 0.34.6 (#21567)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-25 13:57:37 +00:00
Koen KantersandKoenkk c56470c83f fix(ignore): update dependencies (#21561)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-25 14:12:46 +01:00
Koen KantersandKoenkk cc27032752 fix(ignore): update zigbee-herdsman to 0.34.5 (#21563)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-25 09:03:54 +00:00
Koen KantersandKoenkk 7c97902d4a fix(ignore): update zigbee-herdsman-converters to 18.37.1 (#21549)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-24 08:31:39 +00:00
Koen KantersandKoenkk 23959c5b0e fix(ignore): update zigbee-herdsman to 0.34.4 (#21545)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-23 20:40:51 +00:00
Koen KantersandKoenkk e726d5907e fix(ignore): update zigbee-herdsman to 0.34.3 (#21530)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-22 19:37:33 +00:00
Koen KantersandKoenkk 1337f54e4a fix(ignore): update zigbee-herdsman-converters to 18.37.0 (#21533)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-22 19:32:59 +00:00
Oleksandr Masliuchenko 471902e531 fix: Improve nested group and device name match (#21521) 2024-02-22 19:54:09 +01:00
Koen KantersandKoenkk 22d33360f6 fix(ignore): update zigbee-herdsman-converters to 18.36.0 (#21504)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-20 20:04:54 +00:00
koenkk db1e3b73d1 fix: Only configure routers on startup https://github.com/Koenkk/zigbee2mqtt/issues/21446 2024-02-20 20:24:03 +01:00
Artem Draft fe73db4ff6 fix: trigger_count & power_outage_count adjustments in HA (#21492) 2024-02-20 19:47:45 +01:00
Koen Kanters 9dd6eeee7b chore: merge master to dev 2024-02-20 19:47:25 +01:00
Oleksandr Masliuchenko 3c609658fd fix: Fix parsing entity name that contains slash in the name and endpoint specification (#21493) 2024-02-20 19:47:22 +01:00
Anthony Bourguignon 8b694432aa fix: Check if Zigbee2MQTT is running in update.sh (#21494) 2024-02-20 19:46:44 +01:00
Koen KantersandKoenkk b32bd309ca fix(ignore): update zigbee-herdsman-converters to 18.35.0 (#21487)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-19 21:08:45 +00:00
Koen KantersandKoenkk 78b5e6fd4b fix(ignore): update zigbee-herdsman to 0.34.2 (#21478)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-19 20:46:48 +00:00
Koen Kanters c5c0a8b193 feat: Add experimental Ember adapter @Nerivec https://github.com/Koenkk/zigbee-herdsman/pull/918 (#21459) 2024-02-18 22:11:09 +01:00
Koen KantersandKoenkk b51eef2319 fix(ignore): update zigbee-herdsman to 0.34.1 (#21461)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-18 21:01:03 +00:00
Koen KantersandKoenkk ebed9d31d7 fix(ignore): update zigbee-herdsman-converters to 18.34.0 (#21456)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-18 16:39:07 +00:00
Koen KantersandKoenkk 16b251d3c9 fix(ignore): update dependencies (#21444)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-18 16:23:36 +01:00
Koen KantersandKoenkk 5766bf479b fix(ignore): update zigbee-herdsman-converters to 18.33.2 (#21416)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-15 19:01:26 +00:00
Koen KantersandKoenkk 8a9477f2bb fix(ignore): update zigbee-herdsman-converters to 18.33.1 (#21400)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-14 18:49:57 +00:00
Koen KantersandKoenkk 2aaf878889 fix(ignore): update zigbee-herdsman-converters to 18.33.0 (#21387)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-13 19:28:16 +00:00
Koen KantersandKoenkk dfa499659e fix(ignore): update zigbee-herdsman to 0.33.9 (#21386)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-13 19:05:11 +00:00
Sergei SalimovandKoen Kanters 24b5f9b43a feat: Add support for button entity in Home Assistant (#21372)
* add button entity support

* add enabled_by_default to select

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-02-13 19:43:21 +01:00
Koen KantersandKoenkk 0ab7390a64 fix(ignore): update zigbee-herdsman-converters to 18.32.0 (#21373)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-12 20:31:38 +00:00
Koen KantersandKoenkk c7b820c376 fix(ignore): update zigbee-herdsman-converters to 18.31.0 (#21359)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-11 20:46:36 +00:00
Koen KantersandKoenkk ce41f2f8ba fix(ignore): update dependencies (#21347)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-11 21:07:38 +01:00
Koen Kantersandnurikk 8bc3c46c34 fix(ignore): update zigbee2mqtt-frontend to 0.6.158 (#21356)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-11 18:17:21 +00:00
Oleksandr Masliuchenko b4473d6e24 fix: Remove predefined endpoint list, remove limits on device friendly name (#21325)
* Get rid of predefined list of endpoints, correct friend name validations

* Fix minor bug while parsing a topic for an unknown device
2024-02-10 16:50:44 +01:00
Koen KantersandKoenkk 910f3a6860 fix(ignore): update zigbee-herdsman-converters to 18.30.0 (#21315)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-08 19:58:46 +00:00
Oleksandr MasliuchenkoandKoen Kanters 81335e5b4b fix: Remove dependency on predefined list of endpoints (parseEntityID() function) (#21264)
* Add function resolveEntityByID() function as an improved alternative for parseEntityID()

* Port deviceGroupMembership.ts from parseEntityID() to resolveEntityByID()

* Migrade groups.ts from parseEntityID() to resolveEntityByID()

* Improve test coverage on groups functionality

* Migrate from parseEntityID() to resolveEntityByID() for bridge functionality

* Migrate from parseEntityID() to resolveEntityByID() for bind functionality

* Finally get rid of parseEntityID() function

* Fix linter issues

* Move resolveEntityAndEndpoint() function to zigbee.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-02-08 20:54:05 +01:00
Koen KantersandKoenkk 55653c974e fix(ignore): update zigbee-herdsman-converters to 18.29.1 (#21290)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-07 20:32:47 +00:00
Oleksandr MasliuchenkoandKoen Kanters a5a87a79a8 fix: Match endpoint name in the MQTT topic based on endpoints listed in the definition (#21214)
* Add endpoint matching based on the endpoint names list in the device definition

* Cleanup debug prints

* Correct creating endpoint names list, filter out null elements

* Correct test due to slightly changed behavior

* Fix endpoint name lookup when converter does not provide full name-to-id mapping

* Simplify topic name matching

* Remove obsolete branches, improve code coverage

* Make linter happy

* Make linter happy

* Remove dependency on endpoint names while removing device from all groups

* Get rid of predefined list of endpoints when processing group state update

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-02-07 20:12:48 +01:00
Koen Kantersandnurikk a479bf9039 fix(ignore): update zigbee2mqtt-frontend to 0.6.157 (#21269)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-06 21:32:15 +00:00
koenkk b7e19cc86a chore: promote to dev 2024-02-06 21:06:28 +01:00
Koen Kanters fe0742a628 chore(dev): release 1.35.3 (#21139) 2024-02-06 20:48:14 +01:00
Koen KantersandKoenkk 29bae3a734 fix(ignore): update zigbee-herdsman-converters to 18.28.3 (#21265)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-06 19:44:44 +00:00
Koen Kanters 6aa6f04059 chore: merge master to dev 2024-02-06 17:46:32 +01:00
Issy Szemeti fc6d74e2b7 chore: Fix spelling/grammar (#21260) 2024-02-06 17:46:13 +01:00
Koen KantersandKoenkk 92e0d7895b Update zigbee-herdsman to 0.33.8 (#21246)
* fix(ignore): update zigbee-herdsman to 0.33.8

* fix

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-05 19:57:03 +00:00
Koen KantersandKoenkk 250d5bfc24 fix(ignore): update zigbee-herdsman-converters to 18.28.2 (#21245)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-05 19:38:54 +00:00
Koen Kantersandnurikk dfda63138f fix(ignore): update zigbee2mqtt-frontend to 0.6.156 (#21229)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-04 22:35:57 +00:00
Koen Kantersandnurikk 8ab6c16f6e fix(ignore): update zigbee2mqtt-frontend to 0.6.155 (#21228)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-04 22:20:13 +00:00
Koen KantersandKoenkk a6d51a60a8 fix(ignore): update zigbee-herdsman-converters to 18.28.1 (#21222)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-04 20:05:53 +00:00
Koen KantersandKoenkk 3d37892296 fix(ignore): update zigbee-herdsman-converters to 18.28.0 (#21207)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-04 08:28:03 +00:00
Koen KantersandKoenkk 1df54f071f fix(ignore): update dependencies (#21204)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-04 09:16:48 +01:00
koenkk b3253bacc4 chore: remove @types/rimraf 2024-02-04 09:13:03 +01:00
Koen KantersandKoenkk 4b1721721b fix(ignore): update zigbee-herdsman-converters to 18.27.1 (#21189)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-03 13:57:30 +00:00
Koen Kantersandnurikk 2db07236db fix(ignore): update zigbee2mqtt-frontend to 0.6.154 (#21188)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-03 12:14:17 +00:00
Koen Kantersandnurikk 7295955397 fix(ignore): update zigbee2mqtt-frontend to 0.6.153 (#21187)
Co-authored-by: nurikk <1525421+nurikk@users.noreply.github.com>
2024-02-03 12:10:41 +00:00
koenkk f83709d96c fix(ignore): set zhc logger 2024-02-03 12:27:04 +01:00
Koen KantersandKoenkk a678a1c652 fix(ignore): update zigbee-herdsman-converters to 18.27.0 (#21184)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-03 11:24:11 +00:00
Koen KantersandKoenkk 3d1336dc6c fix(ignore): update zigbee-herdsman to 0.33.7 (#21178)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-02 20:58:09 +00:00
koenkk da1d0d81c2 chore: fix release-please 2024-02-01 22:03:28 +01:00
koenkk 335e18fe98 chore: fix release-please 2024-02-01 22:02:01 +01:00
Koen Kanters 6e2539af09 chore: merge master to dev 2024-02-01 21:58:18 +01:00
koenkk fdc9f7d4d4 chore: fix dev -> master on release 2024-02-01 21:57:56 +01:00
Koen KantersandKoenkk 08c03e48cc fix(ignore): update zigbee-herdsman-converters to 18.26.0 (#21145)
Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-02-01 20:35:49 +00:00
koenkk 6621f6fd91 chore: promote to dev 2024-02-01 17:45:05 +01:00
Koen Kanters 06b3395cff chore(dev): release 1.35.2 (#20636) 2024-02-01 17:20:18 +01:00
Koen KantersandKoenkk 0b59a51c3c fix(ignore): update zigbee-herdsman-converters to 18.25.1 (#21129)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-31 19:36:04 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1cee011ca0 chore: Bump peter-evans/create-pull-request from 5 to 6 (#21122)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5 to 6.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v6)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 19:59:19 +01:00
Koen Kanters 630b4ec560 chore: merge master to dev 2024-01-30 21:03:09 +01:00
koenkk 4b6f50daf3 chore: fix update dep auto merge 2024-01-30 21:02:50 +01:00
Koen KantersandKoenkk 0361b13b66 Update zigbee-herdsman-converters to 18.25.0 (#21114)
* fix(ignore): update zigbee-herdsman-converters to 18.25.0

* fix

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-30 20:58:29 +01:00
Koen KantersandKoenkk 49dea233b6 fix(ignore): update zigbee-herdsman to 0.33.5 (#21113)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-30 20:24:23 +01:00
koenkk c16abdd832 fix: Use Alpine 3.18.4 as base https://github.com/Koenkk/zigbee2mqtt/issues/20868 2024-01-30 20:13:08 +01:00
koenkk c37f3e834e chore: remove onlythis 2024-01-30 20:12:52 +01:00
Koen KantersandKoenkk f3e79df4b4 fix(ignore): update zigbee-herdsman-converters to 18.24.0 (#21106)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-29 20:13:02 +00:00
Koen KantersandKoenkk 03ba745e46 fix(ignore): update zigbee-herdsman to 0.33.4 (#21104)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-29 19:02:40 +00:00
Koen KantersandKoenkk 7e7d3c6328 fix(ignore): update zigbee-herdsman-converters to 18.23.1 (#21093)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-28 20:03:43 +00:00
Koen KantersandKoenkk 59001babca fix(ignore): update zigbee-herdsman to 0.33.3 (#21094)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-28 19:52:46 +00:00
Koen KantersandKoenkk 0d716288bf Update zigbee-herdsman-converters to 18.22.0 (#21040)
* fix(ignore): update zigbee-herdsman-converters to 18.22.0

* Update homeassistant.test.js

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-27 08:55:15 +00:00
Koen KantersandKoenkk a879382cbd fix(ignore): update zigbee-herdsman-converters to 18.21.0 (#21012)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-25 19:23:45 +00:00
Koen Kantersandnurikk a858798054 fix(ignore): update zigbee2mqtt-frontend to 0.6.152 (#21003)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2024-01-25 11:15:44 +00:00
Koen KantersandKoenkk 416e561b32 fix(ignore): update zigbee-herdsman-converters to 18.20.0 (#20996)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-24 21:07:36 +00:00
Koen KantersandKoenkk a240487bb4 fix(ignore): update zigbee-herdsman to 0.33.2 (#20994)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-24 22:04:17 +01:00
Koen KantersandKoenkk 518972882c fix(ignore): update zigbee-herdsman-converters to 18.19.0 (#20966)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-23 19:23:56 +00:00
Koen KantersandKoenkk ed639ec9d7 fix(ignore): update zigbee-herdsman to 0.33.1 (#20965)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-23 18:56:19 +00:00
Der Mundschenk & Compagnie 6372d84259 fix: Republish correctly on scene changes to Home Assistant (#20952) 2024-01-23 19:25:18 +01:00
Koen KantersandKoenkk 45579dcf10 Update zigbee-herdsman-converters to 18.18.0 (#20933)
* fix(ignore): update zigbee-herdsman-converters to 18.18.0

* Update bridge.test.js

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-22 20:02:57 +00:00
chrthiandKoen Kanters 97eac16aaf fix: Notify systemd for start, stop, watchdog (#20482)
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-01-21 21:49:17 +01:00
Koen KantersandKoenkk 032557b1db fix(ignore): update zigbee-herdsman to 0.33.0 (#20932)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-21 20:35:49 +00:00
Koen KantersandKoenkk de7bc7cf60 fix(ignore): update zigbee-herdsman-converters to 18.17.0 (#20907)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-20 08:56:11 +00:00
Sergei Salimov 92588fefe3 fix: Home Assistant: additional icons for Aqara TRV entities and various others (#20903)
* Add schedule and schedule_settings icons

* Add various missing entities
2024-01-20 08:36:18 +01:00
Koen KantersandKoenkk 8de20e2cf1 fix(ignore): update zigbee-herdsman-converters to 18.16.0 (#20901)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-19 19:49:09 +00:00
Koen KantersandKoenkk a1360d8e90 fix(ignore): update zigbee-herdsman to 0.32.7 (#20900)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-19 19:26:05 +00:00
Koen KantersandKoenkk 9f3b10235c fix(ignore): update zigbee-herdsman-converters to 18.15.1 (#20876)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-18 21:15:15 +00:00
dependabot[bot] 1d6d386a47 chore: Bump actions/dependency-review-action from 3 to 4 (#20869) 2024-01-18 18:34:20 +01:00
dependabot[bot] 76ea57b732 chore: Bump actions/cache from 3 to 4 (#20870) 2024-01-18 18:34:04 +01:00
slugzero e76f568f0f fix: Remove deprecated sendWhen (#20861) 2024-01-18 18:28:52 +01:00
Koen KantersandKoenkk 080f3b6b50 fix(ignore): update zigbee-herdsman-converters to 18.15.0 (#20860)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-17 20:04:51 +00:00
koenkk a741b2f598 fix: Revert "Enable incremental TSC builds (#19293)" https://github.com/Koenkk/zigbee2mqtt/discussions/20805 2024-01-17 19:55:55 +01:00
mrskycriper ac74fac1db fix: Added icon and device_class for some Aqara device entities (#20746)
* Update homeassistant.ts

* Update homeassistant.ts

* Update homeassistant.ts

* Update homeassistant.ts

* Remove entity_category and add some icons and device classes

* Remove device_class for calibrated because of inverted state mapping
2024-01-17 19:44:52 +01:00
Koen KantersandKoenkk ab9124a517 fix(ignore): update zigbee-herdsman-converters to 18.14.0 (#20847)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-16 21:37:36 +00:00
Koen KantersandKoenkk 4e997c7b83 fix(ignore): update zigbee-herdsman to 0.32.6 (#20846)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-16 20:12:52 +00:00
slugzero 0007db42b0 fix(ignore): Ability to trigger events from converters on incoming Zigbee messages (#20776)
* emit event on converter triggers

* use meta.deviceExposesChanged() instead

* add ExposesChanged event for homeassistant discovery

* add tests for receive.ts and homeassistant.ts
2024-01-15 21:08:08 +01:00
Koen KantersandKoenkk 6ccbb11fc2 fix(ignore): update zigbee-herdsman-converters to 18.13.0 (#20828)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-15 21:07:35 +01:00
Koen KantersandKoenkk 4fe4e2ec2f fix(ignore): update zigbee-herdsman to 0.32.5 (#20826)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-15 19:09:15 +00:00
Koen KantersandKoenkk 2bd7df84eb Update zigbee-herdsman-converters to 18.12.0 (#20775)
* fix(ignore): update zigbee-herdsman-converters to 18.12.0

* Update configure.test.js

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-13 20:06:27 +00:00
Koen KantersandKoenkk ec3e37350d fix(ignore): update zigbee-herdsman to 0.32.4 (#20772)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-13 19:34:18 +00:00
Koen KantersandKoenkk 769bc14163 fix(ignore): update zigbee-herdsman to 0.32.3 (#20744)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-11 19:45:05 +00:00
Koen KantersandKoenkk a38b88455f fix(ignore): update zigbee-herdsman-converters to 18.11.0 (#20742)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-11 19:39:54 +00:00
Koen KantersandKoenkk 9a9bcd503e fix(ignore): update zigbee-herdsman to 0.32.2 (#20726)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-10 20:34:35 +00:00
Koen Kanters f58ee7ad58 chore: merge master to dev 2024-01-10 08:18:53 +01:00
Nerivec 3c9620428e chore: Add 'setup' field to problem report template (#20708)
Allow to discern patterns of behaviors emerging from specific setups (virtualization, low resource devices, etc).
2024-01-10 08:18:34 +01:00
Koen KantersandKoenkk 2bf244c2de fix(ignore): update zigbee-herdsman to 0.32.1 (#20706)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-09 20:26:46 +00:00
Koen KantersandKoenkk 5c8f95ae01 fix(ignore): update zigbee-herdsman-converters to 18.10.1 (#20705)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-09 20:23:01 +00:00
slugzero 363792aee8 fix: Set Home Assistant entity categories config and diagnostic according to expose categories (#20663)
* Add exposes starting with 'config' or 'diagnostic' to respective Home Assistant categories

* alt proposal: default category based on new Expose property

* Use single category 'system' instead of 'config' and 'diagnostic'

* Revert "Use single category 'system' instead of 'config' and 'diagnostic'"

This reverts commit 416dd9c568.

* lint
2024-01-09 19:54:49 +01:00
Koen KantersandKoenkk ce7d022fda Update zigbee-herdsman-converters to 18.10.0 (#20682)
* fix(ignore): update zigbee-herdsman-converters to 18.10.0

* Update bridge.test.js

* Update bridge.test.js

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-08 20:14:03 +00:00
Koen KantersandKoenkk 52f25eb101 fix(ignore): update zigbee-herdsman to 0.32.0 (#20681)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-08 19:27:08 +00:00
Koen KantersandKoenkk ef84ff86fe fix(ignore): update zigbee-herdsman to 0.31.0 (#20639)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-07 13:19:05 +00:00
koenkk dfbe93ef9d chore: fix release ci 2024-01-07 14:14:14 +01:00
koenkk 6bbe8d1844 chore: promote to dev 2024-01-07 14:08:07 +01:00
Koen Kanters 9eaaa0f9d1 chore(dev): release 1.35.1 (#20580) 2024-01-07 13:50:18 +01:00
koenkk 0807049b6c chore: fix changelog generator 2024-01-07 13:47:56 +01:00
Koen KantersandKoenkk 759c235923 fix(ignore): update zigbee-herdsman-converters to 18.9.0 (#20635)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-07 12:36:55 +00:00
Koen KantersandKoenkk 14ac9a8f68 fix(ignore): update zigbee-herdsman-converters to 18.8.0 (#20613)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-06 12:33:39 +00:00
Koen KantersandKoenkk d942db9a92 Update zigbee-herdsman-converters to 18.7.0 (#20607)
* fix(ignore): update zigbee-herdsman-converters to 18.7.0

* Update bridge.test.js

* Update frontend.test.js

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-06 10:32:21 +00:00
koenkk 212c70913c fix: Prevent extension errors from crashing Zigbee2MQTT https://github.com/Koenkk/zigbee2mqtt/issues/20477 2024-01-06 10:19:56 +01:00
Koen KantersandKoenkk b17c22bb50 fix(ignore): update zigbee-herdsman-converters to 18.6.0 (#20585)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-05 10:01:40 +00:00
koenkk c8c5ea2de3 chore: fix release-please 2024-01-04 22:34:33 +01:00
koenkk 00230baedf chore: fix release-please 2024-01-04 22:32:02 +01:00
koenkk 540969be21 chore: fix release-please 2024-01-04 22:30:28 +01:00
Koen KantersandKoenkk 804182e30c Update zigbee-herdsman-converters to 18.5.0 (#20573)
* fix(ignore): update zigbee-herdsman-converters to 18.5.0

* Update receive.ts

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-04 16:35:17 +01:00
Der Mundschenk & Compagnie 99a57bfd08 fix: Prevent warnings for bridge entities with legacy_entity_attributes enabled (#20548) 2024-01-04 14:54:39 +01:00
Der Mundschenk & Compagnie b8edf273c6 fix: Support legacy_availability_payload for Home Assistant connection_state (#20547) 2024-01-04 14:38:29 +01:00
koenkk e9aee4c6dc fix: Fix configure on startup crashing coordinator https://github.com/Koenkk/zigbee2mqtt/issues/20526 2024-01-03 10:51:05 +01:00
koenkk e6bcf91e17 fix: Fix crash due to unhandled Promise exception https://github.com/Koenkk/zigbee2mqtt/issues/20473 2024-01-03 09:09:18 +01:00
Koen KantersandKoenkk 7e37365a5f fix(ignore): update zigbee-herdsman-converters to 18.4.0 (#20523)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-02 22:00:24 +00:00
koenkk 32b1d5b073 fix: Fix Home Assistant program not truncated when too large https://github.com/Koenkk/zigbee2mqtt/issues/19788 2024-01-02 21:42:49 +01:00
Koen Kantersandnurikk cb7b773e0d fix(ignore): update zigbee2mqtt-frontend to 0.6.151 (#20509)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2024-01-02 14:36:20 +00:00
Koen Kanters 84387b27a4 chore: merge master to dev 2024-01-01 13:22:32 +01:00
koenkk 3d8f0fc3a8 chore: fix release-please 2024-01-01 13:22:03 +01:00
koenkk 02a587f745 chore: promote to dev 2024-01-01 12:33:54 +01:00
Koen Kanters b5a90e921b chore(dev): release 1.35.0 (#20467) 2024-01-01 12:29:01 +01:00
koenkk 32b0ded17c fix(ignore): fix dee8781e51 2024-01-01 12:18:25 +01:00
koenkk dee8781e51 fix(ignore): fix homeassistant.test.js 2024-01-01 11:42:48 +01:00
koenkk 64fd21c9c2 chore: fix release please 2024-01-01 11:14:28 +01:00
Koen KantersandKoenkk f9e0c2058f fix(ignore): update zigbee-herdsman-converters to 18.3.0 (#20465)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-01 09:57:41 +00:00
Koen KantersandKoenkk 16730b14a1 fix(ignore): update dependencies (#20452)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-01 10:53:14 +01:00
Koen KantersandKoenkk 05c65d31ed fix(ignore): update zigbee-herdsman to 0.30.0 (#20464)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2024-01-01 09:47:11 +00:00
Koen KantersandKoenkk a8c791b030 fix(ignore): update zigbee-herdsman-converters to 18.2.0 (#20451)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-30 21:59:55 +00:00
Koen KantersandKoenkk a3a87f4580 fix(ignore): update zigbee-herdsman-converters to 18.1.0 (#20426)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-29 07:47:48 +00:00
Koen KantersandKoenkk ffa43915f0 Update zigbee-herdsman-converters to 18.0.2 (#20404)
* fix(ignore): update zigbee-herdsman-converters to 18.0.2

* Update bridge.test.js

* Update networkMap.ts

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-27 20:53:57 +00:00
Koen KantersandKoenkk 7bca19dae7 fix(ignore): update zigbee-herdsman to 0.29.1 (#20406)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-27 21:27:35 +01:00
koenkk 6b6cc8aa34 fix(ignore): Revert module to commonjs 2023-12-27 21:24:08 +01:00
Koen KantersandKoenkk 03a1ce3895 fix(ignore): update zigbee-herdsman to 0.29.0 (#20403)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-27 19:39:32 +01:00
koenkk 82fea1fe41 Revert "fix(ignore): Update alpine to 3.19.0 (#20392)"
This reverts commit eaaf1b0b4f.
2023-12-27 13:21:16 +01:00
koenkk 084b048ff3 fix(ignore): Update tsconfig for Node 18 2023-12-27 13:19:54 +01:00
Guy Driesen 085b46c995 fix: Add Home Assistant entity_category for various Ubisys D1 entities (#20393) 2023-12-27 12:38:42 +01:00
Koen Kanters eaaf1b0b4f fix(ignore): Update alpine to 3.19.0 (#20392) 2023-12-27 12:35:54 +01:00
koenkk 265d280efc chore: remove unused @babel/plugin-proposal-class-properties 2023-12-26 20:52:06 +01:00
Koen Kanters e6e3d92971 fix(ignore): Changes for zhc 18.0.0 (#20390)
* fix(ignore): Changes for zhc 18.0.0

* fix
2023-12-26 19:49:49 +00:00
Koen KantersandKoenkk bf744f48dc fix(ignore): update zigbee-herdsman-converters to 18.0.0 (#20391)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-26 20:44:48 +01:00
Koen KantersandKoenkk ec06efe86a Update zigbee-herdsman-converters to 17.1.1 (#20385)
* fix(ignore): update zigbee-herdsman-converters to 17.1.1

* Update otaUpdate.ts

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-26 17:56:54 +00:00
Koen Kanters 56f57625b0 feat: Support automatically generating device definitions (#20358)
* feat: Support automatically generating device definitions

* updates

* update template
2023-12-25 12:46:57 +01:00
Koen KantersandKoenkk 2110954bb8 fix(ignore): update zigbee-herdsman-converters to 17.0.0 (#20378)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-25 12:44:08 +01:00
Koen Kantersandnurikk d616e57daf fix(ignore): update zigbee2mqtt-frontend to 0.6.150 (#20377)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-12-25 11:36:13 +00:00
Ilya KirovandKoen Kanters d702919735 fix(ignore): Ability to use a specified endpoint in the Tz.Converter (#20356)
* Ability to use a specified endpoint in the Tz.Converter

* Update publish.ts

* Update publish.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2023-12-25 10:48:15 +01:00
Koen KantersandKoenkk fe7e82f7d3 fix(ignore): update zigbee-herdsman-converters to 16.18.0 (#20374)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-25 09:41:40 +00:00
Koen KantersandKoenkk 03857916c4 fix(ignore): update dependencies (#20368)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-25 09:31:09 +01:00
Koen KantersandKoenkk 1a7265017a fix(ignore): update zigbee-herdsman-converters to 16.17.0 (#20359)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-23 08:49:50 +00:00
Koen KantersandKoenkk 89f8e43ad1 fix(ignore): update zigbee-herdsman to 0.28.0 (#20357)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-23 07:48:39 +00:00
Koen KantersandKoenkk 6875146211 fix(ignore): update zigbee-herdsman-converters to 16.16.0 (#20326)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-22 08:14:16 +00:00
Koen KantersandKoenkk 27ccd1a570 fix(ignore): update zigbee-herdsman-converters to 16.15.0 (#20318)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-20 19:38:52 +00:00
slugzero a5b959a6d5 fix: Clear old Home Assistant discovery topics when exposes are changed (#20313) 2023-12-20 19:46:59 +01:00
Roland Huß b67888f938 fix: Fix load of empty configuration .yaml file failing (#20289)
* Always return an object when loading a YAML file, even when it is empty or containing the `null` value.

Fixes #20283

* Add unit test for having multiple device files, with one is empty. This test breaks without the proposed.
2023-12-20 19:31:49 +01:00
Koen KantersandKoenkk af8c2d86fe fix(ignore): update zigbee-herdsman-converters to 16.14.1 (#20301)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-19 19:26:14 +00:00
Koen KantersandKoenkk 29635a9b6a fix(ignore): update zigbee-herdsman-converters to 16.13.0 (#20280)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-18 19:18:25 +00:00
Koen KantersandKoenkk 65d7f5f3e2 fix(ignore): update zigbee-herdsman to 0.27.1 (#20262)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-17 20:38:55 +00:00
Koen KantersandKoenkk c26a6a28e4 fix(ignore): update zigbee-herdsman-converters to 16.12.0 (#20258)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-17 14:39:55 +00:00
Koen KantersandKoenkk 19754c69e5 fix(ignore): update dependencies (#20257)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-17 15:11:01 +01:00
Koen KantersandKoenkk 1e4ac34c44 fix(ignore): update dependencies (#20256)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-17 15:03:35 +01:00
koenkk 89e6d307f2 chore: update_deps 2023-12-17 15:03:17 +01:00
koenkk e7e9616f7e chore: override zigbee-herdsman-converters zigbee-herdsman version 2023-12-17 14:59:16 +01:00
Koen KantersandKoenkk 6e52b2a7af fix(ignore): update dependencies (#20249)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-17 14:56:50 +01:00
koenkk 2e704f3ff7 fix(ignore): improve 8f62a0a 2023-12-17 14:42:48 +01:00
koenkk 8f62a0a618 fix: Fix Home Assistant Entity category config is invalid for sensors warning https://github.com/Koenkk/zigbee2mqtt/issues/20252 2023-12-17 14:24:12 +01:00
Der Mundschenk & Compagnie e0f50218d7 fix: Only republish changed scenes to Home Assistant when changed (#20248) 2023-12-17 09:21:59 +01:00
Koen KantersandKoenkk 2c5d3e14f7 fix(ignore): update zigbee-herdsman-converters to 16.11.0 (#20228)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-16 08:46:43 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 851e3f559a chore: Bump actions/upload-artifact from 3 to 4 (#20226)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 20:46:17 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> cefd6e5685 chore: Bump actions/download-artifact from 3 to 4 (#20225)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 20:46:09 +01:00
Koen KantersandKoenkk 25de4fded9 fix(ignore): update zigbee-herdsman-converters to 16.9.0 (#20200)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-13 19:52:28 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ca6b24304c chore: Bump github/codeql-action from 2 to 3 (#20197)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-13 20:11:55 +01:00
Koen KantersandKoenkk b415443126 fix(ignore): update dependencies (#20133)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-13 19:46:59 +01:00
Koen KantersandKoenkk bcf50bd0c5 fix(ignore): update zigbee-herdsman-converters to 16.8.0 (#20185)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-12 19:07:25 +00:00
Koen KantersandKoenkk 7c81eda46a fix(ignore): update zigbee-herdsman-converters to 16.7.0 (#20167)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-11 19:22:30 +00:00
koenkk abde909b71 fix(ignore): Fix OTA sensor discoverd while device doesn't support it https://github.com/Koenkk/zigbee2mqtt/issues/20131 2023-12-11 20:10:08 +01:00
Viacheslav Bocharov 48347a51dc fix: Allow null for zigbee_ota_override_index_location option (#20151) 2023-12-11 19:25:49 +01:00
koenkk f64c00c8d3 fix(ignore): Downgrade connect-gzip-static to 3.0.1 https://github.com/Koenkk/zigbee2mqtt/issues/20149 2023-12-11 19:24:36 +01:00
Koen KantersandKoenkk 87f6b9e81a fix(ignore): update zigbee-herdsman-converters to 16.6.0 (#20145)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-10 20:36:46 +00:00
Koen Kanters 0a2d9ba952 chore: merge master to dev 2023-12-10 21:21:18 +01:00
Mario Guggenberger 5aeec130b1 fix: Fix availability checks not stopped on extension stop (#20093)
* fix: availability checks not stopped on extension stop

* Add test

* Clarify comments

* Simplify test

* Simplify code
2023-12-10 21:20:59 +01:00
Koen KantersandKoenkk a26008f74c fix(ignore): update zigbee-herdsman to 0.26.1 (#20143)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-10 19:37:42 +00:00
Koen Kantersandnurikk c7e294482b fix(ignore): update zigbee2mqtt-frontend to 0.6.149 (#20141)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-12-10 15:41:52 +00:00
Koen KantersandKoenkk 5ff10c3e5c fix(ignore): update zigbee-herdsman-converters to 16.5.0 (#20125)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-09 16:57:25 +00:00
koenkk be17544598 Revert "chore: Bump alpine from 3.18.5 to 3.19.0 in /docker (#20103)"
This reverts commit 81033700e2.
2023-12-09 14:16:22 +01:00
Koen KantersandKoenkk 8929ab3b97 fix(ignore): update zigbee-herdsman to 0.26.0 (#20092)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-09 14:12:06 +01:00
koenkk d1501052ad fix(ignore): fix bind test 2023-12-09 14:11:45 +01:00
Koen KantersandKoenkk 4cc88f1e16 fix(ignore): update zigbee-herdsman-converters to 16.4.0 (#20120)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-09 13:20:40 +01:00
Koen KantersandKoenkk 4e6bc33a22 fix(ignore): update zigbee-herdsman-converters to 16.3.1 (#20109)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-08 20:19:31 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 81033700e2 chore: Bump alpine from 3.18.5 to 3.19.0 in /docker (#20103)
Bumps alpine from 3.18.5 to 3.19.0.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-08 19:53:32 +01:00
Der Mundschenk & Compagnie a17f650ccb fix: Prevent duplicate Home Assistant scene entities (#20097) 2023-12-08 19:34:37 +01:00
Der Mundschenk & Compagnie 59efc15f3a fix(ignore): Fix "Permit join timeout" template (#20096) 2023-12-08 19:33:30 +01:00
Koen KantersandKoenkk cb509426ec fix(ignore): update zigbee-herdsman-converters to 16.2.0 (#20094)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-07 20:59:01 +00:00
dependabot[bot] aa8144b739 chore: Bump actions/stale from 8 to 9 (#20088) 2023-12-07 19:31:47 +01:00
Der Mundschenk & Compagnie f11eb2459b feat: Support bridge discovery for Home Assistant (#19994)
* Simplify getDiscoverKey

* Add support for discovering bridge entities

* Add automatic discovery for bridge

* Make availability configurable and disable it
for `connection_state` entity

* Link devices & groups to bridge

* Additional entities (and some clean-up)
2023-12-06 19:36:45 +01:00
Koen KantersandKoenkk cb74db47f7 fix(ignore): update zigbee-herdsman-converters to 16.1.0 (#20059)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-05 19:44:28 +00:00
koenkk 299b37a721 chore: include frontend in changelog 2023-12-05 10:22:12 +01:00
Koen Kantersandnurikk ffcb8202f0 fix(ignore): update zigbee2mqtt-frontend to 0.6.148 (#20034)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-12-05 10:21:50 +01:00
Koen KantersandKoenkk e60b94b553 fix(ignore): update zigbee-herdsman-converters to 16.0.2 (#20027)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-04 20:29:11 +00:00
koenkk fbabe9674c chore: increase stale timeout 2023-12-04 20:46:18 +01:00
koenkk 8ab96e124f fix: Don't crash on startup when external converters fails to load https://github.com/Koenkk/zigbee2mqtt/issues/20010 2023-12-04 20:40:45 +01:00
Koen KantersandKoenkk 483acc3ca1 fix(ignore): update zigbee-herdsman to 0.25.3 (#20025)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-04 19:19:19 +00:00
Koen KantersandKoenkk e0deef8889 fix(ignore): update dependencies (#20023)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-04 20:00:39 +01:00
koenkk bbb0ea329c chore: update release-please config for v4 bf69db3e82 2023-12-04 19:55:44 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> bf69db3e82 chore: Bump google-github-actions/release-please-action from 3 to 4 (#20017)
Bumps [google-github-actions/release-please-action](https://github.com/google-github-actions/release-please-action) from 3 to 4.
- [Release notes](https://github.com/google-github-actions/release-please-action/releases)
- [Changelog](https://github.com/google-github-actions/release-please-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google-github-actions/release-please-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: google-github-actions/release-please-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-04 19:54:47 +01:00
koenkk adc08125fe fix: Support Node 21 and drop 16 2023-12-04 19:29:35 +01:00
koenkk aa9a916d61 chore: fix changelog generator 2023-12-04 19:13:57 +01:00
Koen KantersandKoenkk 5e3bd75f09 fix(ignore): update zigbee-herdsman-converters to 16.0.1 (#20012)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-04 09:52:13 +00:00
koenkk 04d8522b3b fix(ignore): fix dd1e0db407 2023-12-04 10:29:09 +01:00
Koen Kanters dd1e0db407 fix(ignore): Use zhc types (#20006)
* fix(ignore): Use zhc TS types

* updates
2023-12-04 10:05:05 +01:00
Koen KantersandKoenkk 2fa8afe37f fix(ignore): update zigbee-herdsman-converters to 16.0.0 (#20008)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-04 10:04:31 +01:00
Koen KantersandKoenkk 5afd16ac65 fix(ignore): update zigbee-herdsman-converters to 15.132.0 (#20005)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-03 21:01:30 +00:00
Koen KantersandKoenkk 9a2425a202 fix(ignore): update zigbee-herdsman to 0.25.2 (#19997)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-03 10:34:47 +00:00
Koen KantersandKoenkk af02370777 fix(ignore): update zigbee-herdsman-converters to 15.131.0 (#19987)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-02 21:10:40 +00:00
Jakub Jirutka 9c8aee17dc fix: Fix build on Node 20+ (#19983)
See https://github.com/bnoordhuis/node-unix-dgram/issues/61
2023-12-02 20:37:15 +01:00
Koen KantersandKoenkk a822873748 fix(ignore): update zigbee-herdsman to 0.25.1 (#19985)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-02 19:18:59 +00:00
Koen KantersandKoenkk 6e843d0f1c fix(ignore): update dependencies (#19896)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-02 20:13:41 +01:00
Impact 346cb90e9e fix: Make update script work from anywhere (#19965)
Makes update script work from anywhere changing the current directory to where the file is located.
2023-12-02 19:48:17 +01:00
Koen Kanters 6619146028 chore: merge master to dev 2023-12-02 13:10:26 +01:00
koenkk 56589dccf1 chore: automate HA addon updates 2023-12-02 13:10:03 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 982af4b724 chore: Bump alpine from 3.18.4 to 3.18.5 in /docker (#19962)
Bumps alpine from 3.18.4 to 3.18.5.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 19:52:54 +01:00
Koen Kanters 7a516bba16 chore: merge master to dev 2023-12-01 11:47:50 +01:00
koenkk 2080e36f19 chore: fix release_please 2023-12-01 11:47:28 +01:00
Koen Kanters a71f43d75b chore: merge master to dev 2023-12-01 10:57:36 +01:00
Koenkk c20293078a chore: promote to dev 2023-12-01 09:57:12 +00:00
Koen Kanters 37636b243f 2023-12-01 10:57:11 +01:00
Koen Kanters aae7312d8a chore(dev): release 1.34.0 (#19544) 2023-12-01 10:54:40 +01:00
Koen KantersandKoenkk 3bbf89cba0 fix(ignore): update zigbee-herdsman-converters to 15.130.1 (#19945)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-01 10:51:26 +01:00
Koen KantersandKoenkk f976d4efb4 fix(ignore): update zigbee-herdsman-converters to 15.130.0 (#19942)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-12-01 09:25:52 +00:00
slugzero a904e7a396 fix: Fix unable to configure again after configure fails (#19908)
* Remove device from "configuring" after error

* use finally for cleanup
2023-11-30 23:02:16 +01:00
Koen KantersandKoenkk 12521add39 fix(ignore): update zigbee-herdsman-converters to 15.129.0 (#19934)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-30 19:37:15 +00:00
Koen KantersandKoenkk 2dabc1e61b fix(ignore): update zigbee-herdsman to 0.25.0 (#19933)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-30 18:51:16 +00:00
Koen KantersandKoenkk e5dc271a78 fix(ignore): update zigbee-herdsman to 0.24.0 (#19926)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-30 10:57:31 +00:00
Koen KantersandKoenkk 4e128e26fe fix(ignore): update zigbee-herdsman-converters to 15.128.0 (#19906)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-28 19:05:56 +00:00
Koen KantersandKoenkk b4c0a59501 Update dependencies (#19895)
* fix(ignore): update dependencies

* fix

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-27 21:55:35 +01:00
Koen KantersandKoenkk 9032bb3d13 Update dependencies (#19866)
* fix(ignore): update dependencies

* fix

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-27 21:36:06 +01:00
Koen KantersandKoenkk 8a6d90d70e fix(ignore): update zigbee-herdsman-converters to 15.127.0 (#19894)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-27 19:10:10 +00:00
Koen KantersandKoenkk b17487e6bb fix(ignore): update zigbee-herdsman-converters to 15.126.0 (#19878)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-26 20:36:41 +00:00
Der Mundschenk & Compagnie 838629ca42 feat: Add Home Assistant scene discovery (#19838)
* Add device info for Zigbee Groups

* Move Scene and getScenes to utils.ts

* Add auto-discovery for group scenes

* Update scene auto-discovery on change

* Add support for single endpoint scenes

* Add test for onScenesChanged

* Move Scene to types.d.ts

* Allow optional object_id_postfix key in payload

* Add scene name to object_id for nicer HA entity_id
2023-11-26 19:38:53 +01:00
Koen KantersandKoenkk 51a93418fa fix(ignore): update zigbee-herdsman-converters to 15.125.1 (#19867)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-26 08:42:21 +00:00
Koen KantersandKoenkk ef00a64bf8 fix(ignore): update zigbee-herdsman-converters to 15.125.0 (#19854)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-24 20:50:08 +00:00
Koen KantersandKoenkk ef4d9e1e55 fix(ignore): update zigbee-herdsman-converters to 15.124.0 (#19836)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-23 19:29:23 +00:00
Koen KantersandKoenkk 2d08baf620 fix(ignore): update zigbee-herdsman-converters to 15.123.1 (#19809)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-22 20:48:46 +00:00
koenkk 8cf41a137a fix(ignore): remove console.log in test 2023-11-22 21:42:44 +01:00
Koen Kantersandnurikk 61b08c94bf fix(ignore): update zigbee2mqtt-frontend to 0.6.147 (#19801)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-11-21 10:58:37 +00:00
Koen Kantersandnurikk c87ac9cc2b fix(ignore): update zigbee2mqtt-frontend to 0.6.146 (#19784)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-11-20 11:30:45 +00:00
Koen Kantersandnurikk ed20e2a1bc fix(ignore): update zigbee2mqtt-frontend to 0.6.145 (#19778)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-11-20 00:57:52 +00:00
Koen KantersandKoenkk d4e3aa9d97 fix(ignore): update zigbee-herdsman-converters to 15.121.0 (#19777)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-19 20:05:34 +00:00
Koen Kantersandnurikk 91aed7e98e fix(ignore): update zigbee2mqtt-frontend to 0.6.144 (#19776)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-11-19 19:51:41 +00:00
Koen KantersandKoenkk fd19c86cb1 fix(ignore): update zigbee-herdsman-converters to 15.120.0 (#19761)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-18 20:20:27 +00:00
Koen KantersandKoenkk ad4bed8921 fix(ignore): update zigbee-herdsman-converters to 15.119.0 (#19740)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-16 21:02:58 +00:00
koenkk 01d32cb230 fix(ignore): Fix color_temp_percent test 2023-11-16 21:55:07 +01:00
Koen KantersandKoenkk 746066c920 fix(ignore): update zigbee-herdsman-converters to 15.117.0 (#19727)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-15 19:46:18 +00:00
Koen KantersandKoenkk 4815ac7110 fix(ignore): update zigbee-herdsman-converters to 15.116.0 (#19714)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-14 20:11:34 +00:00
Koen Kanters 035e2a3023 chore: merge master to dev 2023-11-14 20:17:06 +01:00
koenkk 311ea070b1 chore: Add build step to update script https://github.com/Koenkk/zigbee2mqtt/pull/19232 2023-11-14 20:16:40 +01:00
dependabot[bot] 736caac46d chore: Bump actions/github-script from 6 to 7 (#19710) 2023-11-14 19:16:09 +01:00
Koen KantersandKoenkk 157dff14d3 fix(ignore): update zigbee-herdsman-converters to 15.115.0 (#19701)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-13 20:00:33 +00:00
Koen KantersandKoenkk a152bded93 fix(ignore): update zigbee-herdsman to 0.23.0 (#19700)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-13 19:34:48 +00:00
Koen KantersandKoenkk 6587812b72 fix(ignore): update zigbee-herdsman-converters to 15.114.0 (#19692)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-12 20:46:35 +00:00
Koen KantersandKoenkk c8848be981 fix(ignore): update dependencies (#19679)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-12 21:37:34 +01:00
Der Mundschenk & Compagnie baae082258 fix(ignore): Fixes quote type for update JSON attribute discovery (#19668) 2023-11-11 15:24:32 +01:00
Koen KantersandKoenkk c8dcd716ab fix(ignore): update zigbee-herdsman-converters to 15.113.0 (#19663)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-10 21:11:17 +00:00
Nicolas Thumann 45ac44dd06 fix: Make frontend listen on both IPv4 and IPv6 by default (#19660)
* Change: Set frontend host to null by default

* Change: Allow frontend to listen on port without host

* Change: Unit test

* Add: Unit test
2023-11-10 21:57:53 +01:00
Der Mundschenk & Compagnie da04d223b4 fix: Fix invalid JSON error in Home Assistant update entity (#19659) 2023-11-10 21:41:36 +01:00
Koen KantersandKoenkk d26ea1a411 fix(ignore): update zigbee-herdsman-converters to 15.112.0 (#19643)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-09 20:50:15 +00:00
Koen Kantersandnurikk 9d5d61754d fix(ignore): update zigbee2mqtt-frontend to 0.6.143 (#19642)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-11-09 20:42:43 +00:00
Koen Kanters 2bb77a31cf chore: merge master to dev 2023-11-09 20:36:22 +01:00
Ivan Belokobylskiy 86ae0ed90f fix: Set entity category config for Home Assistant temperature_display_mode sensor (#19631) 2023-11-09 20:36:00 +01:00
koenkk 2540fbd771 fix: Fix Home Assistant in_progress Erroneous JSON error https://github.com/Koenkk/zigbee2mqtt/issues/19597 2023-11-08 21:52:02 +01:00
Koen KantersandKoenkk 354ada5c4c fix(ignore): update zigbee-herdsman-converters to 15.111.0 (#19630)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-08 20:40:37 +00:00
Koen Kanters 0fec5958fa chore: merge master to dev 2023-11-08 20:13:23 +01:00
koenkk ccc08a3fc7 chore: Set days-before-stale to 100 2023-11-08 20:13:02 +01:00
Koen KantersandKoenkk 5889cdd9ab fix(ignore): update zigbee-herdsman-converters to 15.110.0 (#19619)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-07 21:04:25 +00:00
koenkk 93af087264 chore: fix changelog generator 2023-11-06 20:58:45 +01:00
Koen KantersandKoenkk 2d5bb2462e fix(ignore): update zigbee-herdsman to 0.22.1 (#19602)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-06 19:30:05 +00:00
Koen KantersandKoenkk b71aa0a3fd fix(ignore): update zigbee-herdsman-converters to 15.109.0 (#19601)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-06 19:12:45 +00:00
Koen KantersandKoenkk 1fd1686ee6 fix(ignore): update zigbee-herdsman-converters to 15.108.0 (#19589)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-05 20:25:57 +00:00
Koen KantersandKoenkk fc073e8743 fix(ignore): update dependencies (#19570)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-05 21:10:02 +01:00
Rotzbua be48d545cc fix(ignore): remove unused variable (#19584) 2023-11-05 21:02:15 +01:00
Rotzbua 13443a42ce fix(typo): correct misspell (#19581)
Credit to `codespell`.
2023-11-05 21:01:55 +01:00
koenkk 071842ef49 fix: Fix entity category for Home Assistant binary_sensor https://github.com/Koenkk/zigbee2mqtt/pull/19474 2023-11-05 20:56:06 +01:00
Koen KantersandKoenkk 366e29d4d9 fix(ignore): update zigbee-herdsman-converters to 15.107.0 (#19548)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-03 19:31:32 +00:00
Koen KantersandKoenkk 02a5a1b14f fix(ignore): update zigbee-herdsman to 0.22.0 (#19547)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-11-03 20:20:30 +01:00
Arne Rekdal 64b26e47da fix: Map climate idle to idle instead of off in Home Assistant (#19545)
* Missing HA Climate Idle state

Idle is mapped to idle state in HA

* Update homeassistant.test.js
2023-11-03 20:14:25 +01:00
Laxilef 1f2bd841c4 fix: Fix in_progress attribute for Home Assistant update sensor (#19542) 2023-11-03 17:16:57 +01:00
koenkk 1e905598f2 chore: fix release-please 2023-11-01 20:33:51 +01:00
koenkk e76b0ff282 chore: promote to dev 2023-11-01 20:23:03 +01:00
87 changed files with 5218 additions and 10153 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ blank_issues_enabled: false
contact_links:
- name: "IMPORTANT: Check development branch changelog first!!"
url: https://gist.github.com/Koenkk/bfd4c3d1725a2cccacc11d6ba51008ba
about: "Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click 'Open' to see the release notes of the development branch. In case it is, you can read here how to switch to the development branch: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html"
about: "Before submitting an issue, check that the issue hasn't already been solved in the development branch. Click 'Open' to see the release notes of the development branch. In case it is, you can read here how to switch to the development branch: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html"
- name: Questions/discussion
url: https://github.com/Koenkk/zigbee2mqtt/discussions/new
about: Ask questions, discuss about devices or show things you made
+2 -2
View File
@@ -7,12 +7,12 @@ body:
attributes:
value: |
**IMPORTANT:** Before submitting:
- Is your feature request related to the fronted? Then click [here](https://github.com/nurikk/zigbee2mqtt-frontend/issues/new?assignees=&labels=&template=feature_request.md&title=)
- Is your feature request related to the frontend? Then click [here](https://github.com/nurikk/zigbee2mqtt-frontend/issues/new?assignees=&labels=&template=feature_request.md&title=)
- type: textarea
id: textarea1
attributes:
label: Is your feature request related to a problem? Please describe
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
placeholder: A clear and concise description of what the problem is. Eg. I'm always frustrated when [...]
validations:
required: true
- type: textarea
+5 -17
View File
@@ -7,7 +7,7 @@ body:
attributes:
value: |
**IMPORTANT:** Before submitting:
- Make sure this device is not already supported in the [dev branch](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
- Make sure this device is not already supported in the dev branch by checking the [dev branch changelog](https://gist.github.com/Koenkk/bfd4c3d1725a2cccacc11d6ba51008ba#new-supported-devices)
- Make sure there is no existing issue or PR for this device already, search for your device here: https://github.com/Koenkk/zigbee2mqtt/issues
- Follow this [guide](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html)
- If you are using the Home Assistant addon and are still on 1.18.1, check the first point of [this](https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.19.0)
@@ -36,20 +36,8 @@ body:
required: true
- type: textarea
attributes:
label: External converter
description: In case you tried to create an external converter, put it below
label: External definition
description: See [Creating the external definition](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-creating-the-external-definition)
render: shell
- type: markdown
attributes:
value: |
# Lights
In case this device is a light, fill in the fields below:
- type: input
attributes:
label: Supported color modes
placeholder: color temperature, color (rgb)
- type: input
attributes:
label: Color temperature range
description: In case this light supports color temperature, provide the color temperature range. [How to do this](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_3-1-retrieving-color-temperature-range-only-required-for-lights-which-support-color-temperature).
placeholder: '{"colorTempPhysicalMin":153,"colorTempPhysicalMax":454}'
validations:
required: true
+11 -2
View File
@@ -7,11 +7,12 @@ body:
value: |
**IMPORTANT:** Before submitting:
- You read the [FAQ](https://www.zigbee2mqtt.io/guide/faq/)
- Are you using an EZSP adapter (e.g. Dongle-E/SkyConnect)? Try the [new driver](https://github.com/Koenkk/zigbee2mqtt/discussions/21462)
- Zigbee2MQTT fails to start? Read [this](https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html)
- Make sure the bug also occurs in the [dev branch](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
- Make sure you are using the [latest firmware](https://www.zigbee2mqtt.io/guide/adapters/#recommended) on your adapter
- The issue has not been [reported already](https://github.com/Koenkk/zigbee2mqtt/issues)
- Is your issue related to the fronted? Then click [here](https://github.com/nurikk/zigbee2mqtt-frontend/issues/new?assignees=&labels=bug%2Ctriage&template=bug_report.yaml&title=%5BBug%5D%3A+)
- Is your issue related to the frontend? Then click [here](https://github.com/nurikk/zigbee2mqtt-frontend/issues/new?assignees=&labels=bug%2Ctriage&template=bug_report.yaml&title=%5BBug%5D%3A+)
- If you are using the Home Assistant addon and are still on 1.18.1, check the first point of [this](https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.19.0)
- type: textarea
id: what_happend
@@ -30,7 +31,7 @@ body:
id: reproduce
attributes:
label: How to reproduce it (minimal and precise)
placeholder: First do this, than this..
placeholder: First do this, then this..
validations:
required: false
- type: input
@@ -57,6 +58,14 @@ body:
placeholder: Electrolama zig-a-zig-ah! (zzh!), Slaesh's CC2652RB stick, ...
validations:
required: true
- type: input
id: setup
attributes:
label: Setup
description: How do you run Z2M (plain, add-on...) and on what machine (Pi, x86-64, containerized...)?
placeholder: Add-on on Home Assistant OS on Intel NUC, Plain on Docker container, ...
validations:
required: true
- type: textarea
id: log
attributes:
+42 -5
View File
@@ -11,6 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: (github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push'
with:
# Required for `release: merge dev -> master and promote dev`
token: ${{secrets.GH_TOKEN}}
- uses: actions/checkout@v4
if: ((github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push') == false
- uses: actions/setup-node@v4
with:
node-version: 20
@@ -41,7 +47,7 @@ jobs:
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Docker build dev
- name: "dev: Docker build"
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
run: |
docker buildx build \
@@ -52,7 +58,7 @@ jobs:
--push \
-t koenkk/zigbee2mqtt:latest-dev -t ghcr.io/koenkk/zigbee2mqtt:latest-dev \
.
- name: Docker build release
- name: "release: Docker build"
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
TAG="$(git describe --tags)"
@@ -64,12 +70,12 @@ jobs:
--push \
-t koenkk/zigbee2mqtt:latest -t "koenkk/zigbee2mqtt:$TAG" -t ghcr.io/koenkk/zigbee2mqtt:latest -t "ghcr.io/koenkk/zigbee2mqtt:$TAG" \
.
- name: Publish to npm
- name: "release: Publish to npm"
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }}
- name: Trigger zigbee2mqtt/hassio-zigbee2mqtt build
- name: "dev: Trigger zigbee2mqtt/hassio-zigbee2mqtt build"
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
run: |
curl \
@@ -78,12 +84,43 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/actions/workflows/ci.yml/dispatches \
-d '{"ref":"master","inputs":{}}'
- name: "release: Trigger zigbee2mqtt/hassio-zigbee2mqtt build"
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
TAG=${GITHUB_REF#refs/*/}
echo "Triggering with tag '$TAG'"
curl \
-X POST \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/dispatches \
--data "{\"event_type\": \"release\", \"client_payload\": { \"version\": \"$TAG-1\"}}"
- name: "release: merge dev -> master and promote dev"
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
TAG=${GITHUB_REF#refs/*/}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git fetch --unshallow
git fetch origin
git checkout master
git merge --ff-only origin/dev
git push origin master
git checkout dev
jq ".version = \"$TAG-dev\"" package.json > package.json.tmp
jq ".version = \"$TAG-dev\"" package-lock.json > package-lock.json.tmp
mv package.json.tmp package.json
mv package-lock.json.tmp package-lock.json
git add -A
git commit -m "chore: promote to dev"
git push origin dev
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [16, 18, 20]
node: [18, 20]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
+3 -3
View File
@@ -16,8 +16,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
+1 -1
View File
@@ -11,4 +11,4 @@ jobs:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Dependency review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
steps:
- name: Delete untagged images
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
+31
View File
@@ -0,0 +1,31 @@
name: Release Charts
on:
push:
branches:
- main
paths:
- 'charts/**'
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+43 -54
View File
@@ -20,15 +20,46 @@ jobs:
with:
node-version: 20
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node
package-name: release-please-action
default-branch: dev
target-branch: dev
token: ${{secrets.GH_TOKEN}}
include-v-in-tag: false
skip-github-release: true
# we use grep,awk,sed here because the output from release-please despite being JSON, it's not valid (probably shell-escaping) and
# jq fails to parse it. Creates the output pr_branch
- name: Get the branch of the release-please PR
id: get_pr_branch
if: ${{ steps.release.outputs.prs_created == 'true' }}
run: |
BRANCH=$(echo '${{ steps.release.outputs.prs }}' | grep -o -P '\"headBranchName\":\"(.*?)\"' | awk -F':' '{print $2}' | tr -d \")
echo "pr_branch=${BRANCH}" >> $GITHUB_OUTPUT
# Checkout PR branch
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.prs_created == 'true' }}
with:
repository: koenkk/zigbee2mqtt
path: ./z2m-pr
ref: ${{ steps.get_pr_branch.outputs.pr_branch }}
token: ${{secrets.GH_TOKEN}}
- name: Add updated helm chart release versions and documentation to release PR
if: ${{ steps.release.outputs.prs_created == 'true' }}
run: |
pushd ./z2m-pr
Z2M_VERSION="$(jq -r '."."' .release-please-manifest.json)"
yq -i ".appVersion=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/Chart.yaml
yq -i ".image.tag=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/values.yaml
# Keep chart version in step lock with zigbee2mqtt
jq ".\"charts/zigbee2mqtt\"=\"${Z2M_VERSION}\"" .release-please-manifest.json > .release-please-manifest.json.tmp
mv .release-please-manifest.json.tmp .release-please-manifest.json
go run github.com/norwoodj/helm-docs/cmd/helm-docs@latest
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "chore(release): update helm-chart docs"
git push
# Checkout repos
- uses: actions/checkout@v4
@@ -42,7 +73,7 @@ jobs:
ref: master
- name: Restore cache commit-user-lookup.json
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: z2m/scripts/commit-user-lookup.json
key: commit-user-lookup-dummy
@@ -53,63 +84,21 @@ jobs:
MASTER_Z2M_VERSION=$(cat z2m-master/package.json | jq -r '.version')
MASTER_ZHC_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman-converters"')
MASTER_ZH_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman"')
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev--components--release-please-action/CHANGELOG.md > z2m/CHANGELOG.md || true
MASTER_FRONTEND_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee2mqtt-frontend"')
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev/CHANGELOG.md > z2m/CHANGELOG.md
cd z2m
npm ci
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION >> ../changelog.md
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION $MASTER_FRONTEND_VERSION >> ../changelog.md
env:
GH_TOKEN: ${{secrets.GH_TOKEN}}
- name: Update changelog in release PR
- name: Update changelog gist
run: |
gh gist edit bfd4c3d1725a2cccacc11d6ba51008ba -a changelog.md
env:
GH_TOKEN: ${{secrets.GH_TOKEN}}
- name: Upload changelog
uses: actions/upload-artifact@v3
with:
name: changelog
path: changelog.md
- name: Save cache commit-user-lookup.json
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: always()
with:
path: z2m/scripts/commit-user-lookup.json
key: commit-user-lookup-${{ hashFiles('z2m/scripts/commit-user-lookup.json') }}
create_release:
runs-on: ubuntu-latest
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v4
with:
ref: dev
token: ${{secrets.GH_TOKEN}}
- name: Download changelog
uses: actions/download-artifact@v3
with:
name: changelog
path: ../changelog
- uses: ncipollo/release-action@v1
name: Create release
with:
bodyFile: ../changelog/changelog.md
draft: true
name: ${{ needs.release-please.outputs.version }}
tag: ${{ needs.release-please.outputs.version }}
- name: Merge dev -> master
uses: devmasx/merge-branch@master
with:
type: now
from_branch: dev
target_branch: master
github_token: ${{secrets.GH_TOKEN}}
- name: Promote to dev
run: |
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package.json > package.json.tmp
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package-lock.json > package-lock.json.tmp
mv package.json.tmp package.json
mv package-lock.json.tmp package-lock.json
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: promote to dev"
+5 -5
View File
@@ -9,12 +9,12 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days'
stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days'
days-before-stale: 30
days-before-close: 7
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days'
stale-pr-message: 'This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days'
days-before-stale: 180
days-before-close: 30
exempt-issue-labels: dont-stale
operations-per-run: 500
+4 -6
View File
@@ -22,7 +22,7 @@ jobs:
node-version: 20
cache: npm
- run: npm install ${{ github.event.client_payload.package }}@${{ github.event.client_payload.version }} --save-exact
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
id: cpr
with:
commit-message: "fix(ignore): update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }}"
@@ -30,9 +30,7 @@ jobs:
title: Update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }}
token: ${{ secrets.GH_TOKEN }}
- run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail
- uses: peter-evans/enable-pull-request-automerge@v3
- run: gh pr merge --squash --auto "${{ steps.cpr.outputs.pull-request-number }}"
if: steps.cpr.outputs.pull-request-operation == 'created'
with:
token: ${{ secrets.GH_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
+5 -4
View File
@@ -22,11 +22,12 @@ jobs:
with:
node-version: 20
cache: npm
# connect-gzip-static only supports node 16
# @types/ws 8.5.5 is broken
- run: npx npm-check-updates -u -x connect-gzip-static -x @types/ws
# connect-gzip-static@4.0.0 requires Node 20 >=
# eslint: https://github.com/typescript-eslint/typescript-eslint/issues/8211
- run: npx npm-check-updates -u -x connect-gzip-static -x eslint
- run: rm -f package-lock.json
- run: npm install
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
commit-message: "fix(ignore): update dependencies"
branch: "deps/all"
+3 -3
View File
@@ -1,4 +1,4 @@
{
".": "1.33.2",
"bootstrap-sha": "7ee207fc0e05f32c9636c0298b48eea1b91ed9e1"
}
".": "1.37.1",
"charts/zigbee2mqtt": "1.37.1"
}
+420
View File
@@ -1,5 +1,425 @@
# Changelog
## [1.37.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.37.0...1.37.1) (2024-05-09)
### Bug Fixes
* Add Helm chart ([#21852](https://github.com/Koenkk/zigbee2mqtt/issues/21852)) ([b2e8b3e](https://github.com/Koenkk/zigbee2mqtt/commit/b2e8b3e00c152540109e7b9101784f3b03261b40))
* Add settings for finer control over debug log level ([#22426](https://github.com/Koenkk/zigbee2mqtt/issues/22426)) ([eb49f52](https://github.com/Koenkk/zigbee2mqtt/commit/eb49f523bf3a0c085655cfae7aac97d7da749db9))
* Fix logger crashing on restart ([#22565](https://github.com/Koenkk/zigbee2mqtt/issues/22565)) ([d26ccae](https://github.com/Koenkk/zigbee2mqtt/commit/d26ccaed65b922b00f1a7599941289ead4b7fb31))
* Fix MQTT `ECONNREFUSED error` https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/605 ([a0c9a17](https://github.com/Koenkk/zigbee2mqtt/commit/a0c9a1769f7e25673672e3a312b2e4bd3812ff32))
* **ignore:** update dependencies ([#22456](https://github.com/Koenkk/zigbee2mqtt/issues/22456)) ([b754b9d](https://github.com/Koenkk/zigbee2mqtt/commit/b754b9d4635ef3300893acba51eadae4e41039a3))
* **ignore:** update zigbee-herdsman to 0.46.0 ([#22380](https://github.com/Koenkk/zigbee2mqtt/issues/22380)) ([55b5f91](https://github.com/Koenkk/zigbee2mqtt/commit/55b5f91a96f589fd0e3da5f4800dad32dbd57cf7))
* **ignore:** update zigbee-herdsman to 0.46.1 ([#22439](https://github.com/Koenkk/zigbee2mqtt/issues/22439)) ([329d832](https://github.com/Koenkk/zigbee2mqtt/commit/329d832337cda15b324c46a2adf6a24c5d38a8bd))
* **ignore:** update zigbee-herdsman to 0.46.2 ([#22470](https://github.com/Koenkk/zigbee2mqtt/issues/22470)) ([e4c9bac](https://github.com/Koenkk/zigbee2mqtt/commit/e4c9bac348680f5571cef0b79407fb9459757a36))
* **ignore:** update zigbee-herdsman to 0.46.3 ([#22471](https://github.com/Koenkk/zigbee2mqtt/issues/22471)) ([316654b](https://github.com/Koenkk/zigbee2mqtt/commit/316654b5d3acc6452e888d0e48a77908c431e783))
* **ignore:** update zigbee-herdsman to 0.46.4 ([#22501](https://github.com/Koenkk/zigbee2mqtt/issues/22501)) ([e44608a](https://github.com/Koenkk/zigbee2mqtt/commit/e44608a46dfe3baab1f82dd430f66afe0ac09c4f))
* **ignore:** update zigbee-herdsman to 0.46.5 ([#22552](https://github.com/Koenkk/zigbee2mqtt/issues/22552)) ([6bcb4b6](https://github.com/Koenkk/zigbee2mqtt/commit/6bcb4b66b1a69f19b49a3b9a4c9be32e8f1df4e4))
* **ignore:** update zigbee-herdsman to 0.46.6 ([#22558](https://github.com/Koenkk/zigbee2mqtt/issues/22558)) ([989f667](https://github.com/Koenkk/zigbee2mqtt/commit/989f667c81e4f2b61edd379382d2c8f77c556e3b))
* **ignore:** update zigbee-herdsman-converters to 19.33.0 ([#22381](https://github.com/Koenkk/zigbee2mqtt/issues/22381)) ([907591c](https://github.com/Koenkk/zigbee2mqtt/commit/907591c467f926af172427ff641e7b20e5fa309c))
* **ignore:** update zigbee-herdsman-converters to 19.35.0 ([#22442](https://github.com/Koenkk/zigbee2mqtt/issues/22442)) ([beedfae](https://github.com/Koenkk/zigbee2mqtt/commit/beedfaefacdb53d3c379164dbb4dae5de396d40d))
* **ignore:** update zigbee-herdsman-converters to 19.36.0 ([#22472](https://github.com/Koenkk/zigbee2mqtt/issues/22472)) ([358e2ee](https://github.com/Koenkk/zigbee2mqtt/commit/358e2eee4551baee58c4d212d9d65562d2e84bd6))
* **ignore:** update zigbee-herdsman-converters to 19.36.1 ([#22503](https://github.com/Koenkk/zigbee2mqtt/issues/22503)) ([3544d51](https://github.com/Koenkk/zigbee2mqtt/commit/3544d5172e03cdcbd61cde13ebc20c2e5fbeaba5))
* **ignore:** update zigbee-herdsman-converters to 19.37.0 ([#22531](https://github.com/Koenkk/zigbee2mqtt/issues/22531)) ([6b886f6](https://github.com/Koenkk/zigbee2mqtt/commit/6b886f626863cae8acc2895a7fe2482b068138d6))
* **ignore:** update zigbee-herdsman-converters to 19.37.1 ([#22549](https://github.com/Koenkk/zigbee2mqtt/issues/22549)) ([cc9a95c](https://github.com/Koenkk/zigbee2mqtt/commit/cc9a95c74e53261636dc7329be2becddf4772fdc))
* **ignore:** update zigbee-herdsman-converters to 19.37.2 ([#22570](https://github.com/Koenkk/zigbee2mqtt/issues/22570)) ([06fd8a4](https://github.com/Koenkk/zigbee2mqtt/commit/06fd8a4eb120f03dd9f3a1d59ab7b20a32fe15a9))
* **ignore:** update zigbee2mqtt-frontend to 0.6.166 ([#22410](https://github.com/Koenkk/zigbee2mqtt/issues/22410)) ([5899436](https://github.com/Koenkk/zigbee2mqtt/commit/5899436d74cb0c67016758797c2e928f35715d9d))
* **ignore:** update zigbee2mqtt-frontend to 0.6.167 ([#22419](https://github.com/Koenkk/zigbee2mqtt/issues/22419)) ([23e97d0](https://github.com/Koenkk/zigbee2mqtt/commit/23e97d0001048269662c6336a8aef6788615934c))
## [1.37.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.36.1...1.37.0) (2024-05-01)
### Features
* Unified logging across z2m/zh/zhc ([#21984](https://github.com/Koenkk/zigbee2mqtt/issues/21984)) ([73566df](https://github.com/Koenkk/zigbee2mqtt/commit/73566dff98e64038117ec71c7aaa897a4070474d))
### Bug Fixes
* Change `MQTT publish` log to `debug` ([#22063](https://github.com/Koenkk/zigbee2mqtt/issues/22063)) ([bbb6f9e](https://github.com/Koenkk/zigbee2mqtt/commit/bbb6f9e042a5c6cce78591e402d8ab0f7ab4195e))
* Cleanup old logger leftovers ([#22069](https://github.com/Koenkk/zigbee2mqtt/issues/22069)) ([919c4ee](https://github.com/Koenkk/zigbee2mqtt/commit/919c4eee739d9c2dee855cf868e88f7848e6af36))
* Convert logger into a class ([#22129](https://github.com/Koenkk/zigbee2mqtt/issues/22129)) ([3c1a4af](https://github.com/Koenkk/zigbee2mqtt/commit/3c1a4afcb723eecccf6ab9c3e04e1e0eca7b2cbb))
* Disable automatic reconfigure when configureKey changes ([#22088](https://github.com/Koenkk/zigbee2mqtt/issues/22088)) ([9d251db](https://github.com/Koenkk/zigbee2mqtt/commit/9d251dbad5660f7663a79360a584df69d6f10875))
* Fix crash when stopping in case MQTT client did not connect yet ([#22110](https://github.com/Koenkk/zigbee2mqtt/issues/22110)) ([92f5323](https://github.com/Koenkk/zigbee2mqtt/commit/92f53235f3e143ade8883dce01439f87913e2679))
* **ignore:** fix 73566df ([cdd6fb0](https://github.com/Koenkk/zigbee2mqtt/commit/cdd6fb086419892e2725fc545b8015d83dea145d))
* **ignore:** fix 73566dff98e64038117ec71c7aaa897a4070474d ([780c065](https://github.com/Koenkk/zigbee2mqtt/commit/780c065fa106358683bbef6fd72b0257adca5bae))
* **ignore:** update dependencies ([#22007](https://github.com/Koenkk/zigbee2mqtt/issues/22007)) ([e748718](https://github.com/Koenkk/zigbee2mqtt/commit/e7487189cf6b2143a5606ce9bac7d4fa6e240587))
* **ignore:** update dependencies ([#22331](https://github.com/Koenkk/zigbee2mqtt/issues/22331)) ([d7e2d98](https://github.com/Koenkk/zigbee2mqtt/commit/d7e2d98a5a79689cfdc06e1f9bd3b1ed10251132))
* **ignore:** update zigbee-herdsman to 0.41.0 ([#22045](https://github.com/Koenkk/zigbee2mqtt/issues/22045)) ([bd0a411](https://github.com/Koenkk/zigbee2mqtt/commit/bd0a41107a18ab725d0d669af7993f2ad57cd9dd))
* **ignore:** update zigbee-herdsman to 0.41.1 ([#22064](https://github.com/Koenkk/zigbee2mqtt/issues/22064)) ([3e91349](https://github.com/Koenkk/zigbee2mqtt/commit/3e913495b1a843cf0d67e4f2ffba975f56dd5f94))
* **ignore:** update zigbee-herdsman to 0.41.2 ([#22087](https://github.com/Koenkk/zigbee2mqtt/issues/22087)) ([a020138](https://github.com/Koenkk/zigbee2mqtt/commit/a020138f6b4e90377d8bacf475fd33f62abb24e5))
* **ignore:** update zigbee-herdsman to 0.42.0 ([#22121](https://github.com/Koenkk/zigbee2mqtt/issues/22121)) ([28b8aff](https://github.com/Koenkk/zigbee2mqtt/commit/28b8aff1ae8cabce8f61e34c85cd0b72b52a1e83))
* **ignore:** update zigbee-herdsman to 0.42.1 ([#22143](https://github.com/Koenkk/zigbee2mqtt/issues/22143)) ([a210c23](https://github.com/Koenkk/zigbee2mqtt/commit/a210c238f1156bdbb56ba5fc223d0b2159c07273))
* **ignore:** update zigbee-herdsman to 0.42.2 ([#22220](https://github.com/Koenkk/zigbee2mqtt/issues/22220)) ([76f5425](https://github.com/Koenkk/zigbee2mqtt/commit/76f54254529d13bfa0e9a40a0c7455b0c1e61bc8))
* **ignore:** update zigbee-herdsman to 0.42.3 ([#22253](https://github.com/Koenkk/zigbee2mqtt/issues/22253)) ([f7abbd5](https://github.com/Koenkk/zigbee2mqtt/commit/f7abbd5f5ab878bea364cc0cda4222b8941fd487))
* **ignore:** update zigbee-herdsman to 0.42.4 ([#22283](https://github.com/Koenkk/zigbee2mqtt/issues/22283)) ([a8f6bec](https://github.com/Koenkk/zigbee2mqtt/commit/a8f6bec673f43fd76c3495927c2c44e831ade6da))
* **ignore:** update zigbee-herdsman to 0.42.5 ([#22285](https://github.com/Koenkk/zigbee2mqtt/issues/22285)) ([4f97a7a](https://github.com/Koenkk/zigbee2mqtt/commit/4f97a7ad2c12ec70ff459dc233d55bada734e7ab))
* **ignore:** update zigbee-herdsman to 0.43.0 ([#22300](https://github.com/Koenkk/zigbee2mqtt/issues/22300)) ([75f9743](https://github.com/Koenkk/zigbee2mqtt/commit/75f9743528ac3f55b837548f234b29bdf8182a0d))
* **ignore:** update zigbee-herdsman to 0.43.1 ([#22317](https://github.com/Koenkk/zigbee2mqtt/issues/22317)) ([389779d](https://github.com/Koenkk/zigbee2mqtt/commit/389779d4e332db1945ff7b490ec881eec71b4721))
* **ignore:** update zigbee-herdsman to 0.44.0 ([#22339](https://github.com/Koenkk/zigbee2mqtt/issues/22339)) ([1b089ef](https://github.com/Koenkk/zigbee2mqtt/commit/1b089ef6ae364786602c485ea5deafad4e21f023))
* **ignore:** update zigbee-herdsman to 0.45.0 ([#22365](https://github.com/Koenkk/zigbee2mqtt/issues/22365)) ([8e27ec2](https://github.com/Koenkk/zigbee2mqtt/commit/8e27ec24f664ca702eba93f90b42c9f4e74d16df))
* **ignore:** update zigbee-herdsman-converters to 19.13.0 ([#22046](https://github.com/Koenkk/zigbee2mqtt/issues/22046)) ([db7d9e1](https://github.com/Koenkk/zigbee2mqtt/commit/db7d9e1120e01dd6b4e20bd352689eebb9a8912f))
* **ignore:** update zigbee-herdsman-converters to 19.15.0 ([#22089](https://github.com/Koenkk/zigbee2mqtt/issues/22089)) ([ae35aae](https://github.com/Koenkk/zigbee2mqtt/commit/ae35aaed5ef3591f288019d9cb35d90a31aa4798))
* **ignore:** update zigbee-herdsman-converters to 19.16.0 ([#22107](https://github.com/Koenkk/zigbee2mqtt/issues/22107)) ([394a3fb](https://github.com/Koenkk/zigbee2mqtt/commit/394a3fbd8aeb1dd4708326d8f854ac7db4b28dbf))
* **ignore:** update zigbee-herdsman-converters to 19.17.0 ([#22122](https://github.com/Koenkk/zigbee2mqtt/issues/22122)) ([cabc9f5](https://github.com/Koenkk/zigbee2mqtt/commit/cabc9f5e2f6e22fb380e259093d29ec506a3b1f3))
* **ignore:** update zigbee-herdsman-converters to 19.18.0 ([#22141](https://github.com/Koenkk/zigbee2mqtt/issues/22141)) ([8b8d660](https://github.com/Koenkk/zigbee2mqtt/commit/8b8d660b0622072696113c3a66458cbde1918838))
* **ignore:** update zigbee-herdsman-converters to 19.19.0 ([#22153](https://github.com/Koenkk/zigbee2mqtt/issues/22153)) ([cdbbe0d](https://github.com/Koenkk/zigbee2mqtt/commit/cdbbe0d49fff21a3fb5000ecef25bb71b3d64360))
* **ignore:** update zigbee-herdsman-converters to 19.19.1 ([#22171](https://github.com/Koenkk/zigbee2mqtt/issues/22171)) ([f774753](https://github.com/Koenkk/zigbee2mqtt/commit/f77475321300a11ca0d30525fe38afa7d079f42e))
* **ignore:** update zigbee-herdsman-converters to 19.20.0 ([#22187](https://github.com/Koenkk/zigbee2mqtt/issues/22187)) ([e10ab5c](https://github.com/Koenkk/zigbee2mqtt/commit/e10ab5ccb272fdc3b2922fd28c043d84860137e1))
* **ignore:** update zigbee-herdsman-converters to 19.21.0 ([#22199](https://github.com/Koenkk/zigbee2mqtt/issues/22199)) ([87aa18d](https://github.com/Koenkk/zigbee2mqtt/commit/87aa18d14cbf19a89d7d0dced6eb86393f0239af))
* **ignore:** update zigbee-herdsman-converters to 19.22.0 ([#22221](https://github.com/Koenkk/zigbee2mqtt/issues/22221)) ([172aa74](https://github.com/Koenkk/zigbee2mqtt/commit/172aa7461ac507aa55dcd653d40873445c827f28))
* **ignore:** update zigbee-herdsman-converters to 19.23.0 ([#22232](https://github.com/Koenkk/zigbee2mqtt/issues/22232)) ([1544317](https://github.com/Koenkk/zigbee2mqtt/commit/1544317fce5de3be71395af06450a5e997b39dab))
* **ignore:** update zigbee-herdsman-converters to 19.24.0 ([#22254](https://github.com/Koenkk/zigbee2mqtt/issues/22254)) ([d9628df](https://github.com/Koenkk/zigbee2mqtt/commit/d9628df17b228a0908d7b95e35cbb97171c2485c))
* **ignore:** update zigbee-herdsman-converters to 19.25.0 ([#22266](https://github.com/Koenkk/zigbee2mqtt/issues/22266)) ([80504b9](https://github.com/Koenkk/zigbee2mqtt/commit/80504b943d742a20481b458eb0fdc9cdf9452961))
* **ignore:** update zigbee-herdsman-converters to 19.26.0 ([#22284](https://github.com/Koenkk/zigbee2mqtt/issues/22284)) ([4bf2ffa](https://github.com/Koenkk/zigbee2mqtt/commit/4bf2ffa7ddd0de3d70160ccefbaf483fc9a83a22))
* **ignore:** update zigbee-herdsman-converters to 19.27.0 ([#22301](https://github.com/Koenkk/zigbee2mqtt/issues/22301)) ([df23240](https://github.com/Koenkk/zigbee2mqtt/commit/df232406838b991c87ddbaa6c28ebcedd6226fcf))
* **ignore:** update zigbee-herdsman-converters to 19.28.0 ([#22318](https://github.com/Koenkk/zigbee2mqtt/issues/22318)) ([245afb1](https://github.com/Koenkk/zigbee2mqtt/commit/245afb112648c23c74c8e1e9d9b038c84d71ca40))
* **ignore:** update zigbee-herdsman-converters to 19.29.0 ([#22325](https://github.com/Koenkk/zigbee2mqtt/issues/22325)) ([3755126](https://github.com/Koenkk/zigbee2mqtt/commit/37551265a204b6509b2534b5b0fcc9825b5188ac))
* **ignore:** update zigbee-herdsman-converters to 19.32.0 ([#22377](https://github.com/Koenkk/zigbee2mqtt/issues/22377)) ([e03013c](https://github.com/Koenkk/zigbee2mqtt/commit/e03013c58180391d9f3fe6878712ab032896a94f))
* **ignore:** update zigbee2mqtt-frontend to 0.6.162 ([#22094](https://github.com/Koenkk/zigbee2mqtt/issues/22094)) ([0c80129](https://github.com/Koenkk/zigbee2mqtt/commit/0c801294661b0f6e592dd09f681c83bff376414d))
* **ignore:** update zigbee2mqtt-frontend to 0.6.163 ([#22288](https://github.com/Koenkk/zigbee2mqtt/issues/22288)) ([e5d632b](https://github.com/Koenkk/zigbee2mqtt/commit/e5d632bc9177c134d6856f9b5881f26be4ed4140))
* **ignore:** update zigbee2mqtt-frontend to 0.6.164 ([#22340](https://github.com/Koenkk/zigbee2mqtt/issues/22340)) ([10e6ad0](https://github.com/Koenkk/zigbee2mqtt/commit/10e6ad0e67a237693365c5bc8752ba3cbefe757f))
* **ignore:** update zigbee2mqtt-frontend to 0.6.165 ([#22366](https://github.com/Koenkk/zigbee2mqtt/issues/22366)) ([8a288a9](https://github.com/Koenkk/zigbee2mqtt/commit/8a288a91192bfa47aad80435a02cf3313da0b4bc))
* Reduce MQTT publishing by excluding debug logging from `bridge/logging` ([#22066](https://github.com/Koenkk/zigbee2mqtt/issues/22066)) ([002050f](https://github.com/Koenkk/zigbee2mqtt/commit/002050f35bd6228a464482d17a7feee82f9f5d31))
* Remove deprecated Home Assistant `color_mode` ([#22142](https://github.com/Koenkk/zigbee2mqtt/issues/22142)) ([c98e5a7](https://github.com/Koenkk/zigbee2mqtt/commit/c98e5a74de1c322533f9c0defa0bbf0b5627b775))
## [1.36.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.36.0...1.36.1) (2024-04-01)
### Bug Fixes
* Add more Home Assistant entity icons ([#21652](https://github.com/Koenkk/zigbee2mqtt/issues/21652)) ([01843fe](https://github.com/Koenkk/zigbee2mqtt/commit/01843fe6c43210ade1d1dfcd134fdd979d47f194))
* Fix `set` endpoint name conversion ([#21653](https://github.com/Koenkk/zigbee2mqtt/issues/21653)) ([66fb672](https://github.com/Koenkk/zigbee2mqtt/commit/66fb672492c8f049368d5dbda3925500941cd534))
* Fix crash due to race condition during interview ([#21680](https://github.com/Koenkk/zigbee2mqtt/issues/21680)) ([2da8095](https://github.com/Koenkk/zigbee2mqtt/commit/2da80954d69c753bcfbef30c2579584d7a0f8779))
* Fix incorrect update state when Z2M is restarted during OTA update https://github.com/Koenkk/zigbee2mqtt/issues/12794 ([1110d3f](https://github.com/Koenkk/zigbee2mqtt/commit/1110d3f8efff948811a980968f8dc84465500d4f))
* Home Assistant: remove button name if `device_class` is present ([#21726](https://github.com/Koenkk/zigbee2mqtt/issues/21726)) ([14e0440](https://github.com/Koenkk/zigbee2mqtt/commit/14e044093c4f481fc7c4f58c35c68ebddddf621c))
* **ignore:** fix tests ([29543ba](https://github.com/Koenkk/zigbee2mqtt/commit/29543bad4bb8768bb66c15f4f084b0d9ccc6c1bc))
* **ignore:** update dependencies ([#21657](https://github.com/Koenkk/zigbee2mqtt/issues/21657)) ([8c86849](https://github.com/Koenkk/zigbee2mqtt/commit/8c86849bb992e1125e9fed301eef8655aa95466c))
* **ignore:** Update dependencies ([#21740](https://github.com/Koenkk/zigbee2mqtt/issues/21740)) ([43610bb](https://github.com/Koenkk/zigbee2mqtt/commit/43610bbff44572937650ee03ccd239d084d9959f))
* **ignore:** update dependencies ([#21832](https://github.com/Koenkk/zigbee2mqtt/issues/21832)) ([1006725](https://github.com/Koenkk/zigbee2mqtt/commit/1006725b09a6e07e60586409798de3cbc7f3c1f1))
* **ignore:** update dependencies ([#21923](https://github.com/Koenkk/zigbee2mqtt/issues/21923)) ([8c4cd8c](https://github.com/Koenkk/zigbee2mqtt/commit/8c4cd8c9aa8777027d538a114fc9310b1f2fe7a2))
* **ignore:** Update manufacturer codes ([#21729](https://github.com/Koenkk/zigbee2mqtt/issues/21729)) ([83502f2](https://github.com/Koenkk/zigbee2mqtt/commit/83502f2d30cf2d79f3ea8576ab065590da29abd8))
* **ignore:** update zigbee-herdsman to 0.35.2 ([#21654](https://github.com/Koenkk/zigbee2mqtt/issues/21654)) ([ccaa128](https://github.com/Koenkk/zigbee2mqtt/commit/ccaa1281a35249874a065fd2d4975aeab93f05f4))
* **ignore:** update zigbee-herdsman to 0.35.3 ([#21677](https://github.com/Koenkk/zigbee2mqtt/issues/21677)) ([30909d5](https://github.com/Koenkk/zigbee2mqtt/commit/30909d57fba7f7a45caeb14afcbf5f8ac724c876))
* **ignore:** update zigbee-herdsman to 0.36.0 ([#21689](https://github.com/Koenkk/zigbee2mqtt/issues/21689)) ([1d73d9d](https://github.com/Koenkk/zigbee2mqtt/commit/1d73d9d4768d8511ca24066fe199d4096b0301ac))
* **ignore:** update zigbee-herdsman to 0.36.1 ([#21713](https://github.com/Koenkk/zigbee2mqtt/issues/21713)) ([e834e93](https://github.com/Koenkk/zigbee2mqtt/commit/e834e93debbd343236e71e275bbd3726a3b4ae3c))
* **ignore:** update zigbee-herdsman to 0.36.2 ([#21727](https://github.com/Koenkk/zigbee2mqtt/issues/21727)) ([ebf996a](https://github.com/Koenkk/zigbee2mqtt/commit/ebf996acd83f32668be7dfd3994c2976db52bc58))
* **ignore:** update zigbee-herdsman to 0.37.0 ([#21743](https://github.com/Koenkk/zigbee2mqtt/issues/21743)) ([b60f679](https://github.com/Koenkk/zigbee2mqtt/commit/b60f679814294ce454e4e7c08fc3dd11b9a224ff))
* **ignore:** update zigbee-herdsman to 0.38.0 ([#21777](https://github.com/Koenkk/zigbee2mqtt/issues/21777)) ([233d263](https://github.com/Koenkk/zigbee2mqtt/commit/233d263e132e7b046194dedd620ae687a815f1ec))
* **ignore:** update zigbee-herdsman to 0.38.1 ([#21802](https://github.com/Koenkk/zigbee2mqtt/issues/21802)) ([6586228](https://github.com/Koenkk/zigbee2mqtt/commit/658622880ffc7eee1c27ba499ce75da03b25c216))
* **ignore:** update zigbee-herdsman to 0.39.0 ([#21871](https://github.com/Koenkk/zigbee2mqtt/issues/21871)) ([801134b](https://github.com/Koenkk/zigbee2mqtt/commit/801134b6303ecea0d41254ac84a6f0f96393dc3f))
* **ignore:** update zigbee-herdsman to 0.39.1 ([#21891](https://github.com/Koenkk/zigbee2mqtt/issues/21891)) ([f05d501](https://github.com/Koenkk/zigbee2mqtt/commit/f05d501380a5416fb610f6eeeea7c9b7a04394cb))
* **ignore:** update zigbee-herdsman to 0.40.0 ([#21901](https://github.com/Koenkk/zigbee2mqtt/issues/21901)) ([334e260](https://github.com/Koenkk/zigbee2mqtt/commit/334e260b851535379548e52a61cbef5956411f46))
* **ignore:** update zigbee-herdsman to 0.40.1 ([#21987](https://github.com/Koenkk/zigbee2mqtt/issues/21987)) ([0c7730f](https://github.com/Koenkk/zigbee2mqtt/commit/0c7730f4c50fb97313de35533140a8c99f6ad374))
* **ignore:** update zigbee-herdsman to 0.40.2 ([#22000](https://github.com/Koenkk/zigbee2mqtt/issues/22000)) ([886b534](https://github.com/Koenkk/zigbee2mqtt/commit/886b5345d7c134f27aa14e259ce1cfd8423b8636))
* **ignore:** update zigbee-herdsman to 0.40.3 ([#22010](https://github.com/Koenkk/zigbee2mqtt/issues/22010)) ([1e74b2f](https://github.com/Koenkk/zigbee2mqtt/commit/1e74b2f53ff7af8d1067265c966f75aef8a794f1))
* **ignore:** update zigbee-herdsman-converters to 18.44.0 ([#21690](https://github.com/Koenkk/zigbee2mqtt/issues/21690)) ([6daa7aa](https://github.com/Koenkk/zigbee2mqtt/commit/6daa7aa61db7c6ceef707ab27afca14e31a2e79f))
* **ignore:** update zigbee-herdsman-converters to 18.45.0 ([#21699](https://github.com/Koenkk/zigbee2mqtt/issues/21699)) ([d37c164](https://github.com/Koenkk/zigbee2mqtt/commit/d37c164993cd4b3bc2f027be3a3a2b9a5b30d200))
* **ignore:** update zigbee-herdsman-converters to 18.46.0 ([#21714](https://github.com/Koenkk/zigbee2mqtt/issues/21714)) ([0e0eccb](https://github.com/Koenkk/zigbee2mqtt/commit/0e0eccbd139e38df31b0860af26c50032f629fae))
* **ignore:** update zigbee-herdsman-converters to 18.47.0 ([#21728](https://github.com/Koenkk/zigbee2mqtt/issues/21728)) ([3188038](https://github.com/Koenkk/zigbee2mqtt/commit/3188038a7bf673b2053783910229e1e60b6f5921))
* **ignore:** update zigbee-herdsman-converters to 18.48.0 ([#21753](https://github.com/Koenkk/zigbee2mqtt/issues/21753)) ([2a047a4](https://github.com/Koenkk/zigbee2mqtt/commit/2a047a469c70f17a3c12d0a6f6fc2de9744835e7))
* **ignore:** update zigbee-herdsman-converters to 19.0.0 ([#21768](https://github.com/Koenkk/zigbee2mqtt/issues/21768)) ([dbd616f](https://github.com/Koenkk/zigbee2mqtt/commit/dbd616fbe5a62986d2c28bbcc9cea93d293da397))
* **ignore:** update zigbee-herdsman-converters to 19.1.0 ([#21778](https://github.com/Koenkk/zigbee2mqtt/issues/21778)) ([56feb77](https://github.com/Koenkk/zigbee2mqtt/commit/56feb77f2d1c357d59245db3b7cc37520554ed41))
* **ignore:** update zigbee-herdsman-converters to 19.1.1 ([#21789](https://github.com/Koenkk/zigbee2mqtt/issues/21789)) ([720fc49](https://github.com/Koenkk/zigbee2mqtt/commit/720fc491ce70f197778b5abe750ac2d779a9ad4c))
* **ignore:** update zigbee-herdsman-converters to 19.10.0 ([#21996](https://github.com/Koenkk/zigbee2mqtt/issues/21996)) ([7d8b537](https://github.com/Koenkk/zigbee2mqtt/commit/7d8b5374adca3c97976e557f1d44e1b85728d575))
* **ignore:** update zigbee-herdsman-converters to 19.11.0 ([#22013](https://github.com/Koenkk/zigbee2mqtt/issues/22013)) ([e51792c](https://github.com/Koenkk/zigbee2mqtt/commit/e51792c65afa5a2bc863bb619c0057fc7242b191))
* **ignore:** update zigbee-herdsman-converters to 19.11.1 ([#22014](https://github.com/Koenkk/zigbee2mqtt/issues/22014)) ([85c00b8](https://github.com/Koenkk/zigbee2mqtt/commit/85c00b8b43e2716231203599fac8bf01662535d5))
* **ignore:** update zigbee-herdsman-converters to 19.11.2 ([#22021](https://github.com/Koenkk/zigbee2mqtt/issues/22021)) ([3aadab0](https://github.com/Koenkk/zigbee2mqtt/commit/3aadab0925d52839baf6d884ea59d25ff083a015))
* **ignore:** update zigbee-herdsman-converters to 19.2.1 ([#21801](https://github.com/Koenkk/zigbee2mqtt/issues/21801)) ([a4f9c49](https://github.com/Koenkk/zigbee2mqtt/commit/a4f9c49ab5ef647829b8f505df7f91df8fca5036))
* **ignore:** update zigbee-herdsman-converters to 19.3.0 ([#21851](https://github.com/Koenkk/zigbee2mqtt/issues/21851)) ([1a9e05e](https://github.com/Koenkk/zigbee2mqtt/commit/1a9e05e6ab93a1e93024600a58c5b8e62544daf4))
* **ignore:** update zigbee-herdsman-converters to 19.4.0 ([#21870](https://github.com/Koenkk/zigbee2mqtt/issues/21870)) ([73d4300](https://github.com/Koenkk/zigbee2mqtt/commit/73d43007d45ee3cfc2d49ff2f4475fef63560421))
* **ignore:** update zigbee-herdsman-converters to 19.4.1 ([#21872](https://github.com/Koenkk/zigbee2mqtt/issues/21872)) ([b02c34c](https://github.com/Koenkk/zigbee2mqtt/commit/b02c34c6e52cf97364f6affce82b281cd40c1780))
* **ignore:** update zigbee-herdsman-converters to 19.4.2 ([#21892](https://github.com/Koenkk/zigbee2mqtt/issues/21892)) ([25cec20](https://github.com/Koenkk/zigbee2mqtt/commit/25cec20f0d0b6201679b719bf8dec9e7ebb26b62))
* **ignore:** update zigbee-herdsman-converters to 19.5.0 ([#21902](https://github.com/Koenkk/zigbee2mqtt/issues/21902)) ([73423eb](https://github.com/Koenkk/zigbee2mqtt/commit/73423ebd60a04f0caf7ac40743422cea3ef052e9))
* **ignore:** update zigbee-herdsman-converters to 19.6.0 ([#21927](https://github.com/Koenkk/zigbee2mqtt/issues/21927)) ([32b173c](https://github.com/Koenkk/zigbee2mqtt/commit/32b173c6537a4cdc3c303e521c5fa159cfcfb58d))
* **ignore:** update zigbee-herdsman-converters to 19.8.0 ([#21957](https://github.com/Koenkk/zigbee2mqtt/issues/21957)) ([032b9a0](https://github.com/Koenkk/zigbee2mqtt/commit/032b9a096eac7ba01a8eee188c042287db55bfed))
* **ignore:** update zigbee-herdsman-converters to 19.9.0 ([#21970](https://github.com/Koenkk/zigbee2mqtt/issues/21970)) ([a7aab71](https://github.com/Koenkk/zigbee2mqtt/commit/a7aab714ba1861eab15d0df3228e222feb8fa996))
* **ignore:** update zigbee2mqtt-frontend to 0.6.161 ([#21660](https://github.com/Koenkk/zigbee2mqtt/issues/21660)) ([aaed8ab](https://github.com/Koenkk/zigbee2mqtt/commit/aaed8ab95ec031ad5ea1f00933cc5f79b58fce29))
## [1.36.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.35.3...1.36.0) (2024-03-01)
### Features
* Add experimental Ember adapter @Nerivec https://github.com/Koenkk/zigbee-herdsman/pull/918 ([#21459](https://github.com/Koenkk/zigbee2mqtt/issues/21459)) ([c5c0a8b](https://github.com/Koenkk/zigbee2mqtt/commit/c5c0a8b1938ed51887b21ded06d584f200ba32d1))
* Add support for button entity in Home Assistant ([#21372](https://github.com/Koenkk/zigbee2mqtt/issues/21372)) ([24b5f9b](https://github.com/Koenkk/zigbee2mqtt/commit/24b5f9b43af8303f87fd5f29e57cca4a850d7b1d))
### Bug Fixes
* `trigger_count` & `power_outage_count` adjustments in HA ([#21492](https://github.com/Koenkk/zigbee2mqtt/issues/21492)) ([fe73db4](https://github.com/Koenkk/zigbee2mqtt/commit/fe73db4ff686915841fc045750c7c7c98457422d))
* Add noise and noise_detected to HA lookup ([#21610](https://github.com/Koenkk/zigbee2mqtt/issues/21610)) ([9b8583e](https://github.com/Koenkk/zigbee2mqtt/commit/9b8583e778ffbd92ba82315d5a53ed68f51e4fc3))
* Check if Zigbee2MQTT is running in `update.sh` ([#21494](https://github.com/Koenkk/zigbee2mqtt/issues/21494)) ([8b69443](https://github.com/Koenkk/zigbee2mqtt/commit/8b694432aaa229823674eb4933eded3f2ab1517a))
* Fix endpoint matching for TuYa dummy endpoints ([#21576](https://github.com/Koenkk/zigbee2mqtt/issues/21576)) ([956003a](https://github.com/Koenkk/zigbee2mqtt/commit/956003aa0ab104f611cf3d0c61bec1c476ac17d0))
* Fix parsing entity name that contains slash in the name and endpoint specification ([#21493](https://github.com/Koenkk/zigbee2mqtt/issues/21493)) ([3c60965](https://github.com/Koenkk/zigbee2mqtt/commit/3c609658fd788410270af3343f01cc47b6ef0ab1))
* **ignore:** update dependencies ([#21347](https://github.com/Koenkk/zigbee2mqtt/issues/21347)) ([ce41f2f](https://github.com/Koenkk/zigbee2mqtt/commit/ce41f2f8ba89d31926cdce7d2d93ec19ffccf7fc))
* **ignore:** update dependencies ([#21444](https://github.com/Koenkk/zigbee2mqtt/issues/21444)) ([16b251d](https://github.com/Koenkk/zigbee2mqtt/commit/16b251d3c9c0651436899de6b63033d98e7b1353))
* **ignore:** update dependencies ([#21561](https://github.com/Koenkk/zigbee2mqtt/issues/21561)) ([c56470c](https://github.com/Koenkk/zigbee2mqtt/commit/c56470c83fd3b9ea366f67814e09146bcac6d188))
* **ignore:** update zigbee-herdsman to 0.33.9 ([#21386](https://github.com/Koenkk/zigbee2mqtt/issues/21386)) ([dfa4996](https://github.com/Koenkk/zigbee2mqtt/commit/dfa499659ec69db40ccc3d5c1dff874f446587d0))
* **ignore:** update zigbee-herdsman to 0.34.1 ([#21461](https://github.com/Koenkk/zigbee2mqtt/issues/21461)) ([b51eef2](https://github.com/Koenkk/zigbee2mqtt/commit/b51eef2319adf2b26b7b9a4a279adf2b671dd380))
* **ignore:** update zigbee-herdsman to 0.34.2 ([#21478](https://github.com/Koenkk/zigbee2mqtt/issues/21478)) ([78b5e6f](https://github.com/Koenkk/zigbee2mqtt/commit/78b5e6fd4b11ba138f83e848c60ac017fe5b10f2))
* **ignore:** update zigbee-herdsman to 0.34.3 ([#21530](https://github.com/Koenkk/zigbee2mqtt/issues/21530)) ([e726d59](https://github.com/Koenkk/zigbee2mqtt/commit/e726d5907e86ca3fabef4491579994d9e89f0fe0))
* **ignore:** update zigbee-herdsman to 0.34.4 ([#21545](https://github.com/Koenkk/zigbee2mqtt/issues/21545)) ([23959c5](https://github.com/Koenkk/zigbee2mqtt/commit/23959c5b0ec7e36183400920617e3052cd9bf17a))
* **ignore:** update zigbee-herdsman to 0.34.5 ([#21563](https://github.com/Koenkk/zigbee2mqtt/issues/21563)) ([cc27032](https://github.com/Koenkk/zigbee2mqtt/commit/cc2703275272c268b1f04ce75488027d6c70b870))
* **ignore:** update zigbee-herdsman to 0.34.6 ([#21567](https://github.com/Koenkk/zigbee2mqtt/issues/21567)) ([4f71c1e](https://github.com/Koenkk/zigbee2mqtt/commit/4f71c1e8bf3fe430cc03d3054a6e2a75ba6ec7de))
* **ignore:** update zigbee-herdsman to 0.34.7 ([#21575](https://github.com/Koenkk/zigbee2mqtt/issues/21575)) ([a06a0ea](https://github.com/Koenkk/zigbee2mqtt/commit/a06a0ea059354ac43de47c9d4e6d573bd6186288))
* **ignore:** update zigbee-herdsman to 0.34.8 ([#21588](https://github.com/Koenkk/zigbee2mqtt/issues/21588)) ([fee0811](https://github.com/Koenkk/zigbee2mqtt/commit/fee0811893a6bc90b86978e5c80cdb4e1a23ef70))
* **ignore:** update zigbee-herdsman to 0.34.9 ([#21602](https://github.com/Koenkk/zigbee2mqtt/issues/21602)) ([222b67b](https://github.com/Koenkk/zigbee2mqtt/commit/222b67b1b0c9151222c4d9cc2e531bf74a080ba6))
* **ignore:** update zigbee-herdsman to 0.35.0 ([#21621](https://github.com/Koenkk/zigbee2mqtt/issues/21621)) ([a84083b](https://github.com/Koenkk/zigbee2mqtt/commit/a84083be404a54303eb9337cc86c3938a1d5d41e))
* **ignore:** update zigbee-herdsman to 0.35.1 ([#21636](https://github.com/Koenkk/zigbee2mqtt/issues/21636)) ([0d8f578](https://github.com/Koenkk/zigbee2mqtt/commit/0d8f5780ddf05d176b199a152b3a1a212bca6810))
* **ignore:** update zigbee-herdsman-converters to 18.29.1 ([#21290](https://github.com/Koenkk/zigbee2mqtt/issues/21290)) ([55653c9](https://github.com/Koenkk/zigbee2mqtt/commit/55653c974ef72e8b5d8107d1b2e1b67efb70e4e1))
* **ignore:** update zigbee-herdsman-converters to 18.30.0 ([#21315](https://github.com/Koenkk/zigbee2mqtt/issues/21315)) ([910f3a6](https://github.com/Koenkk/zigbee2mqtt/commit/910f3a68603bf4b7f31d7a80370816d02f7126b8))
* **ignore:** update zigbee-herdsman-converters to 18.31.0 ([#21359](https://github.com/Koenkk/zigbee2mqtt/issues/21359)) ([c7b820c](https://github.com/Koenkk/zigbee2mqtt/commit/c7b820c3763e6052cc6755e0e12926c316de7f42))
* **ignore:** update zigbee-herdsman-converters to 18.32.0 ([#21373](https://github.com/Koenkk/zigbee2mqtt/issues/21373)) ([0ab7390](https://github.com/Koenkk/zigbee2mqtt/commit/0ab7390a642a723fc4e1847bbd95ea12487388ab))
* **ignore:** update zigbee-herdsman-converters to 18.33.0 ([#21387](https://github.com/Koenkk/zigbee2mqtt/issues/21387)) ([2aaf878](https://github.com/Koenkk/zigbee2mqtt/commit/2aaf878889b4211b8a470c847721c75b5a91e39e))
* **ignore:** update zigbee-herdsman-converters to 18.33.1 ([#21400](https://github.com/Koenkk/zigbee2mqtt/issues/21400)) ([8a9477f](https://github.com/Koenkk/zigbee2mqtt/commit/8a9477f2bb6afbfeacf64547c8bfe4ae4f18ca7f))
* **ignore:** update zigbee-herdsman-converters to 18.33.2 ([#21416](https://github.com/Koenkk/zigbee2mqtt/issues/21416)) ([5766bf4](https://github.com/Koenkk/zigbee2mqtt/commit/5766bf479ba548d819f87de2046f554b6de15945))
* **ignore:** update zigbee-herdsman-converters to 18.34.0 ([#21456](https://github.com/Koenkk/zigbee2mqtt/issues/21456)) ([ebed9d3](https://github.com/Koenkk/zigbee2mqtt/commit/ebed9d31d710ac6853e3eee6b677cfe6e84fd556))
* **ignore:** update zigbee-herdsman-converters to 18.35.0 ([#21487](https://github.com/Koenkk/zigbee2mqtt/issues/21487)) ([b32bd30](https://github.com/Koenkk/zigbee2mqtt/commit/b32bd309ca7748d4dcb0b3ca5b3428578a86487c))
* **ignore:** update zigbee-herdsman-converters to 18.36.0 ([#21504](https://github.com/Koenkk/zigbee2mqtt/issues/21504)) ([22d3336](https://github.com/Koenkk/zigbee2mqtt/commit/22d33360f6966625afb9f456d5ffe96c42baaa3f))
* **ignore:** update zigbee-herdsman-converters to 18.37.0 ([#21533](https://github.com/Koenkk/zigbee2mqtt/issues/21533)) ([1337f54](https://github.com/Koenkk/zigbee2mqtt/commit/1337f54e4a49ac9e28b9c3eb780829915b59cb57))
* **ignore:** update zigbee-herdsman-converters to 18.37.1 ([#21549](https://github.com/Koenkk/zigbee2mqtt/issues/21549)) ([7c97902](https://github.com/Koenkk/zigbee2mqtt/commit/7c97902d4a088d680010511148b67ac19d05b91a))
* **ignore:** update zigbee-herdsman-converters to 18.40.0 ([#21603](https://github.com/Koenkk/zigbee2mqtt/issues/21603)) ([aeaa040](https://github.com/Koenkk/zigbee2mqtt/commit/aeaa0409203e19d54511601cf7e0124db6a09778))
* **ignore:** update zigbee-herdsman-converters to 18.41.0 ([#21622](https://github.com/Koenkk/zigbee2mqtt/issues/21622)) ([72333f0](https://github.com/Koenkk/zigbee2mqtt/commit/72333f0888b5be3abacb286ed0a227438d593563))
* **ignore:** update zigbee-herdsman-converters to 18.42.0 ([#21637](https://github.com/Koenkk/zigbee2mqtt/issues/21637)) ([ccc3167](https://github.com/Koenkk/zigbee2mqtt/commit/ccc31670ec5b93bddaa8cef3f965fd8cc77e51a4))
* **ignore:** update zigbee2mqtt-frontend to 0.6.157 ([#21269](https://github.com/Koenkk/zigbee2mqtt/issues/21269)) ([a479bf9](https://github.com/Koenkk/zigbee2mqtt/commit/a479bf9039248d0b0ebc7e0f65dfc8ff342090d4))
* **ignore:** update zigbee2mqtt-frontend to 0.6.158 ([#21356](https://github.com/Koenkk/zigbee2mqtt/issues/21356)) ([8bc3c46](https://github.com/Koenkk/zigbee2mqtt/commit/8bc3c46c34e1c13c893b5d52143f6e357ff58546))
* **ignore:** update zigbee2mqtt-frontend to 0.6.159 ([#21623](https://github.com/Koenkk/zigbee2mqtt/issues/21623)) ([a8a2626](https://github.com/Koenkk/zigbee2mqtt/commit/a8a262640ff075e92bfb8d0491f4f9efe8f33ce2))
* Improve nested group and device name match ([#21521](https://github.com/Koenkk/zigbee2mqtt/issues/21521)) ([471902e](https://github.com/Koenkk/zigbee2mqtt/commit/471902e53134dbf2baddb9c37e2c20105b8f0043))
* Match endpoint name in the MQTT topic based on endpoints listed in the definition ([#21214](https://github.com/Koenkk/zigbee2mqtt/issues/21214)) ([a5a87a7](https://github.com/Koenkk/zigbee2mqtt/commit/a5a87a79a80aaa261a34a8fb541f47347c4ca729))
* Only configure routers on startup https://github.com/Koenkk/zigbee2mqtt/issues/21446 ([db1e3b7](https://github.com/Koenkk/zigbee2mqtt/commit/db1e3b73d1d4a2a98879ab10e5b18f84b30bd3bc))
* Remove dependency on predefined list of endpoints (`parseEntityID()` function) ([#21264](https://github.com/Koenkk/zigbee2mqtt/issues/21264)) ([81335e5](https://github.com/Koenkk/zigbee2mqtt/commit/81335e5b4b0ed0e1dacdd764de1711f5a1481f7f))
* Remove predefined endpoint list, remove limits on device friendly name ([#21325](https://github.com/Koenkk/zigbee2mqtt/issues/21325)) ([b4473d6](https://github.com/Koenkk/zigbee2mqtt/commit/b4473d6e24de8dc2db0ae7cb7bbb014788854ae4))
## [1.35.3](https://github.com/Koenkk/zigbee2mqtt/compare/1.35.2...1.35.3) (2024-02-06)
### Bug Fixes
* **ignore:** set zhc logger ([f83709d](https://github.com/Koenkk/zigbee2mqtt/commit/f83709d96c4a98b2c5f34a2e06fe2ea26f9cb9d5))
* **ignore:** update dependencies ([#21204](https://github.com/Koenkk/zigbee2mqtt/issues/21204)) ([1df54f0](https://github.com/Koenkk/zigbee2mqtt/commit/1df54f071f301240f4a7efeb8db87a9a66babf44))
* **ignore:** update zigbee-herdsman to 0.33.7 ([#21178](https://github.com/Koenkk/zigbee2mqtt/issues/21178)) ([3d1336d](https://github.com/Koenkk/zigbee2mqtt/commit/3d1336dc6cb3f73810f4ed467df443e46cca23e0))
* **ignore:** update zigbee-herdsman-converters to 18.26.0 ([#21145](https://github.com/Koenkk/zigbee2mqtt/issues/21145)) ([08c03e4](https://github.com/Koenkk/zigbee2mqtt/commit/08c03e48cc47b344c3f5664147afd3c4fe8c1802))
* **ignore:** update zigbee-herdsman-converters to 18.27.0 ([#21184](https://github.com/Koenkk/zigbee2mqtt/issues/21184)) ([a678a1c](https://github.com/Koenkk/zigbee2mqtt/commit/a678a1c652a1a77fe80245d5944945ab7c75352b))
* **ignore:** update zigbee-herdsman-converters to 18.27.1 ([#21189](https://github.com/Koenkk/zigbee2mqtt/issues/21189)) ([4b17217](https://github.com/Koenkk/zigbee2mqtt/commit/4b1721721b1580115ff952a2f49cd0c4e0dabafb))
* **ignore:** update zigbee-herdsman-converters to 18.28.0 ([#21207](https://github.com/Koenkk/zigbee2mqtt/issues/21207)) ([3d37892](https://github.com/Koenkk/zigbee2mqtt/commit/3d3789229692eb522ef3f4b5d920f90336cf2be9))
* **ignore:** update zigbee-herdsman-converters to 18.28.1 ([#21222](https://github.com/Koenkk/zigbee2mqtt/issues/21222)) ([a6d51a6](https://github.com/Koenkk/zigbee2mqtt/commit/a6d51a60a8b338f1245a17d228212364a6bf235c))
* **ignore:** update zigbee-herdsman-converters to 18.28.2 ([#21245](https://github.com/Koenkk/zigbee2mqtt/issues/21245)) ([250d5bf](https://github.com/Koenkk/zigbee2mqtt/commit/250d5bfc24c146e6055db7f069770af02fccca7c))
* **ignore:** update zigbee-herdsman-converters to 18.28.3 ([#21265](https://github.com/Koenkk/zigbee2mqtt/issues/21265)) ([29bae3a](https://github.com/Koenkk/zigbee2mqtt/commit/29bae3a73421c18c8437d21d727d70f10e08a1e9))
* **ignore:** update zigbee2mqtt-frontend to 0.6.153 ([#21187](https://github.com/Koenkk/zigbee2mqtt/issues/21187)) ([7295955](https://github.com/Koenkk/zigbee2mqtt/commit/7295955397dd829a15de08081c08ed236dee2c21))
* **ignore:** update zigbee2mqtt-frontend to 0.6.154 ([#21188](https://github.com/Koenkk/zigbee2mqtt/issues/21188)) ([2db0723](https://github.com/Koenkk/zigbee2mqtt/commit/2db07236dbc3b8ed2817209c72fd7103efb5fba7))
* **ignore:** update zigbee2mqtt-frontend to 0.6.155 ([#21228](https://github.com/Koenkk/zigbee2mqtt/issues/21228)) ([8ab6c16](https://github.com/Koenkk/zigbee2mqtt/commit/8ab6c16f6ecbf8dde9a208ea51f48603f5e21b68))
* **ignore:** update zigbee2mqtt-frontend to 0.6.156 ([#21229](https://github.com/Koenkk/zigbee2mqtt/issues/21229)) ([dfda631](https://github.com/Koenkk/zigbee2mqtt/commit/dfda63138ff4e0c6a0b28503d3e9c9482991b8b8))
## [1.35.2](https://github.com/Koenkk/zigbee2mqtt/compare/1.35.1...1.35.2) (2024-01-31)
### Bug Fixes
* Added icon and device_class for some Aqara device entities ([#20746](https://github.com/Koenkk/zigbee2mqtt/issues/20746)) ([ac74fac](https://github.com/Koenkk/zigbee2mqtt/commit/ac74fac1db9b1ee6d473c5045989003548e451f6))
* Home Assistant: additional icons for Aqara TRV entities and various others ([#20903](https://github.com/Koenkk/zigbee2mqtt/issues/20903)) ([92588fe](https://github.com/Koenkk/zigbee2mqtt/commit/92588fefe3f10783c93c145b9b937c39bd6a5773))
* **ignore:** Ability to trigger events from converters on incoming Zigbee messages ([#20776](https://github.com/Koenkk/zigbee2mqtt/issues/20776)) ([0007db4](https://github.com/Koenkk/zigbee2mqtt/commit/0007db42b0365c0b14510f2b03f60277a2a22303))
* **ignore:** update zigbee-herdsman to 0.31.0 ([#20639](https://github.com/Koenkk/zigbee2mqtt/issues/20639)) ([ef84ff8](https://github.com/Koenkk/zigbee2mqtt/commit/ef84ff86fed89d0957961580f92541b20546b951))
* **ignore:** update zigbee-herdsman to 0.32.0 ([#20681](https://github.com/Koenkk/zigbee2mqtt/issues/20681)) ([52f25eb](https://github.com/Koenkk/zigbee2mqtt/commit/52f25eb101ba6102a2c9fcb20d0bb9c56d1bd627))
* **ignore:** update zigbee-herdsman to 0.32.1 ([#20706](https://github.com/Koenkk/zigbee2mqtt/issues/20706)) ([2bf244c](https://github.com/Koenkk/zigbee2mqtt/commit/2bf244c2dea1b6c9db6f8273dcb03e4a40fbe18a))
* **ignore:** update zigbee-herdsman to 0.32.2 ([#20726](https://github.com/Koenkk/zigbee2mqtt/issues/20726)) ([9a9bcd5](https://github.com/Koenkk/zigbee2mqtt/commit/9a9bcd503eb736d3227dcf4fd3853739cfee293a))
* **ignore:** update zigbee-herdsman to 0.32.3 ([#20744](https://github.com/Koenkk/zigbee2mqtt/issues/20744)) ([769bc14](https://github.com/Koenkk/zigbee2mqtt/commit/769bc14163666df402d52abba4c14a7eef99667a))
* **ignore:** update zigbee-herdsman to 0.32.4 ([#20772](https://github.com/Koenkk/zigbee2mqtt/issues/20772)) ([ec3e373](https://github.com/Koenkk/zigbee2mqtt/commit/ec3e37350dde666512d7a966dd28db54d3da7e7c))
* **ignore:** update zigbee-herdsman to 0.32.5 ([#20826](https://github.com/Koenkk/zigbee2mqtt/issues/20826)) ([4fe4e2e](https://github.com/Koenkk/zigbee2mqtt/commit/4fe4e2ec2f9d0d1a6173c7cca2641204c702e933))
* **ignore:** update zigbee-herdsman to 0.32.6 ([#20846](https://github.com/Koenkk/zigbee2mqtt/issues/20846)) ([4e997c7](https://github.com/Koenkk/zigbee2mqtt/commit/4e997c7b83772dfbd73272f7ebd3acbda1a1c55e))
* **ignore:** update zigbee-herdsman to 0.32.7 ([#20900](https://github.com/Koenkk/zigbee2mqtt/issues/20900)) ([a1360d8](https://github.com/Koenkk/zigbee2mqtt/commit/a1360d8e901ae0c5b3e3987215794e48f56ec65d))
* **ignore:** update zigbee-herdsman to 0.33.0 ([#20932](https://github.com/Koenkk/zigbee2mqtt/issues/20932)) ([032557b](https://github.com/Koenkk/zigbee2mqtt/commit/032557b1dbf810872cef61c3a65e2f6df93441e7))
* **ignore:** update zigbee-herdsman to 0.33.1 ([#20965](https://github.com/Koenkk/zigbee2mqtt/issues/20965)) ([ed639ec](https://github.com/Koenkk/zigbee2mqtt/commit/ed639ec9d7867785aeb776c63c927929b365993d))
* **ignore:** update zigbee-herdsman to 0.33.2 ([#20994](https://github.com/Koenkk/zigbee2mqtt/issues/20994)) ([a240487](https://github.com/Koenkk/zigbee2mqtt/commit/a240487bb4711a1403fd1f069a8f32dc454e5b55))
* **ignore:** update zigbee-herdsman to 0.33.3 ([#21094](https://github.com/Koenkk/zigbee2mqtt/issues/21094)) ([59001ba](https://github.com/Koenkk/zigbee2mqtt/commit/59001babca79f04938127e1592f553106b2b0b9f))
* **ignore:** update zigbee-herdsman to 0.33.4 ([#21104](https://github.com/Koenkk/zigbee2mqtt/issues/21104)) ([03ba745](https://github.com/Koenkk/zigbee2mqtt/commit/03ba745e46b849cf7a62bdf598b8bf1d128281d2))
* **ignore:** update zigbee-herdsman to 0.33.5 ([#21113](https://github.com/Koenkk/zigbee2mqtt/issues/21113)) ([49dea23](https://github.com/Koenkk/zigbee2mqtt/commit/49dea233b6248d699a2d0f641ce0a84c9b91e92c))
* **ignore:** update zigbee-herdsman-converters to 18.10.1 ([#20705](https://github.com/Koenkk/zigbee2mqtt/issues/20705)) ([5c8f95a](https://github.com/Koenkk/zigbee2mqtt/commit/5c8f95ae0146aff91c305643c9fa41c8dc690fa7))
* **ignore:** update zigbee-herdsman-converters to 18.11.0 ([#20742](https://github.com/Koenkk/zigbee2mqtt/issues/20742)) ([a38b884](https://github.com/Koenkk/zigbee2mqtt/commit/a38b88455f8a77fe5e9997f05374d3454b100b41))
* **ignore:** update zigbee-herdsman-converters to 18.13.0 ([#20828](https://github.com/Koenkk/zigbee2mqtt/issues/20828)) ([6ccbb11](https://github.com/Koenkk/zigbee2mqtt/commit/6ccbb11fc20d63f86eea03ffc26c9bd790b2ee5e))
* **ignore:** update zigbee-herdsman-converters to 18.14.0 ([#20847](https://github.com/Koenkk/zigbee2mqtt/issues/20847)) ([ab9124a](https://github.com/Koenkk/zigbee2mqtt/commit/ab9124a5179bd87d496944d7bab5794eab6505e3))
* **ignore:** update zigbee-herdsman-converters to 18.15.0 ([#20860](https://github.com/Koenkk/zigbee2mqtt/issues/20860)) ([080f3b6](https://github.com/Koenkk/zigbee2mqtt/commit/080f3b6b50c58636aa217d143a0f3d18fbb55c7f))
* **ignore:** update zigbee-herdsman-converters to 18.15.1 ([#20876](https://github.com/Koenkk/zigbee2mqtt/issues/20876)) ([9f3b102](https://github.com/Koenkk/zigbee2mqtt/commit/9f3b10235cf0f5db38098c4a73bd64d4d53ba6c2))
* **ignore:** update zigbee-herdsman-converters to 18.16.0 ([#20901](https://github.com/Koenkk/zigbee2mqtt/issues/20901)) ([8de20e2](https://github.com/Koenkk/zigbee2mqtt/commit/8de20e2cf1107366dd958c7e781a2011f7dd8f2d))
* **ignore:** update zigbee-herdsman-converters to 18.17.0 ([#20907](https://github.com/Koenkk/zigbee2mqtt/issues/20907)) ([de7bc7c](https://github.com/Koenkk/zigbee2mqtt/commit/de7bc7cf60752874262f684ac7f3923057aab3c2))
* **ignore:** update zigbee-herdsman-converters to 18.19.0 ([#20966](https://github.com/Koenkk/zigbee2mqtt/issues/20966)) ([5189728](https://github.com/Koenkk/zigbee2mqtt/commit/518972882c7a02bfc076aa5093853f23947d769d))
* **ignore:** update zigbee-herdsman-converters to 18.20.0 ([#20996](https://github.com/Koenkk/zigbee2mqtt/issues/20996)) ([416e561](https://github.com/Koenkk/zigbee2mqtt/commit/416e561b329b65fa50af23e08c3d82cbc52387da))
* **ignore:** update zigbee-herdsman-converters to 18.21.0 ([#21012](https://github.com/Koenkk/zigbee2mqtt/issues/21012)) ([a879382](https://github.com/Koenkk/zigbee2mqtt/commit/a879382cbd32bd0935d91b62e6cbbf2a0c9987a4))
* **ignore:** update zigbee-herdsman-converters to 18.23.1 ([#21093](https://github.com/Koenkk/zigbee2mqtt/issues/21093)) ([7e7d3c6](https://github.com/Koenkk/zigbee2mqtt/commit/7e7d3c6328c0cbd89264d6313367dbd1295b0b42))
* **ignore:** update zigbee-herdsman-converters to 18.24.0 ([#21106](https://github.com/Koenkk/zigbee2mqtt/issues/21106)) ([f3e79df](https://github.com/Koenkk/zigbee2mqtt/commit/f3e79df4b4c7a5c68a70375e25507e58c6378b1a))
* **ignore:** update zigbee-herdsman-converters to 18.25.1 ([#21129](https://github.com/Koenkk/zigbee2mqtt/issues/21129)) ([0b59a51](https://github.com/Koenkk/zigbee2mqtt/commit/0b59a51c3c740da5c5d7b86514651c21a5c7387b))
* **ignore:** update zigbee2mqtt-frontend to 0.6.152 ([#21003](https://github.com/Koenkk/zigbee2mqtt/issues/21003)) ([a858798](https://github.com/Koenkk/zigbee2mqtt/commit/a85879805489761d429d1dec4d98c1ae2ebd9400))
* Notify systemd for start, stop, watchdog ([#20482](https://github.com/Koenkk/zigbee2mqtt/issues/20482)) ([97eac16](https://github.com/Koenkk/zigbee2mqtt/commit/97eac16aaf10d9bec4a5353b07ae3ebef92868e5))
* Remove deprecated sendWhen ([#20861](https://github.com/Koenkk/zigbee2mqtt/issues/20861)) ([e76f568](https://github.com/Koenkk/zigbee2mqtt/commit/e76f568f0fe0a36e5324b20b8ca3173f618cd8e6))
* Republish correctly on scene changes to Home Assistant ([#20952](https://github.com/Koenkk/zigbee2mqtt/issues/20952)) ([6372d84](https://github.com/Koenkk/zigbee2mqtt/commit/6372d842596240685ead4a5a10f9a739ec208504))
* Revert "Enable incremental TSC builds ([#19293](https://github.com/Koenkk/zigbee2mqtt/issues/19293))" https://github.com/Koenkk/zigbee2mqtt/discussions/20805 ([a741b2f](https://github.com/Koenkk/zigbee2mqtt/commit/a741b2f598159e1fbd6799619d0e575ad11c0256))
* Set Home Assistant entity categories `config` and `diagnostic` according to expose categories ([#20663](https://github.com/Koenkk/zigbee2mqtt/issues/20663)) ([363792a](https://github.com/Koenkk/zigbee2mqtt/commit/363792aee8f9535163e7c0aa3e5b9961165fc088))
* Use Alpine 3.18.4 as base https://github.com/Koenkk/zigbee2mqtt/issues/20868 ([c16abdd](https://github.com/Koenkk/zigbee2mqtt/commit/c16abdd83233c51fa5f7d6b56db6b19bea9b81f6))
## [1.35.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.35.0...1.35.1) (2024-01-07)
### Bug Fixes
* Fix configure on startup crashing coordinator https://github.com/Koenkk/zigbee2mqtt/issues/20526 ([e9aee4c](https://github.com/Koenkk/zigbee2mqtt/commit/e9aee4c6dc1b7dcfedfa821723b029e1a0423d15))
* Fix crash due to unhandled Promise exception https://github.com/Koenkk/zigbee2mqtt/issues/20473 ([e6bcf91](https://github.com/Koenkk/zigbee2mqtt/commit/e6bcf91e17747eff38ce7774107d697aeff4be15))
* Fix Home Assistant `program` not truncated when too large https://github.com/Koenkk/zigbee2mqtt/issues/19788 ([32b1d5b](https://github.com/Koenkk/zigbee2mqtt/commit/32b1d5b0732544a2026f8582f8bb12a3e5691b2b))
* **ignore:** update zigbee-herdsman-converters to 18.4.0 ([#20523](https://github.com/Koenkk/zigbee2mqtt/issues/20523)) ([7e37365](https://github.com/Koenkk/zigbee2mqtt/commit/7e37365a5faec6d8d33db406ed18d5492fa2fc19))
* **ignore:** update zigbee-herdsman-converters to 18.6.0 ([#20585](https://github.com/Koenkk/zigbee2mqtt/issues/20585)) ([b17c22b](https://github.com/Koenkk/zigbee2mqtt/commit/b17c22bb501599fcc68685ff0fc65642d1dea9ca))
* **ignore:** update zigbee-herdsman-converters to 18.8.0 ([#20613](https://github.com/Koenkk/zigbee2mqtt/issues/20613)) ([14ac9a8](https://github.com/Koenkk/zigbee2mqtt/commit/14ac9a8f68480c433450cb1f33f8feda00359268))
* **ignore:** update zigbee-herdsman-converters to 18.9.0 ([#20635](https://github.com/Koenkk/zigbee2mqtt/issues/20635)) ([759c235](https://github.com/Koenkk/zigbee2mqtt/commit/759c2359234a5f83b9a7f2a5b97e75aef9d0d567))
* **ignore:** update zigbee2mqtt-frontend to 0.6.151 ([#20509](https://github.com/Koenkk/zigbee2mqtt/issues/20509)) ([cb7b773](https://github.com/Koenkk/zigbee2mqtt/commit/cb7b773e0defb1e28dc17af42e3807e7628338df))
* Prevent extension errors from crashing Zigbee2MQTT https://github.com/Koenkk/zigbee2mqtt/issues/20477 ([212c709](https://github.com/Koenkk/zigbee2mqtt/commit/212c70913c06a97dea8dac7d532a7d601c69a3d1))
* Prevent warnings for bridge entities with legacy_entity_attributes enabled ([#20548](https://github.com/Koenkk/zigbee2mqtt/issues/20548)) ([99a57bf](https://github.com/Koenkk/zigbee2mqtt/commit/99a57bfd080fcf311f7cc45e7d0d04cdc0a6138a))
* Support legacy_availability_payload for Home Assistant connection_state ([#20547](https://github.com/Koenkk/zigbee2mqtt/issues/20547)) ([b8edf27](https://github.com/Koenkk/zigbee2mqtt/commit/b8edf273c6de799e30c95c607f315f02b0dcacdd))
## [1.35.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.34.0...v1.35.0) (2024-01-01)
### Features
* Support automatically generating device definitions ([#20358](https://github.com/Koenkk/zigbee2mqtt/issues/20358)) ([56f5762](https://github.com/Koenkk/zigbee2mqtt/commit/56f57625b0d5ce5b3bf6fa6a1a048f6ae8902311))
* Support bridge discovery for Home Assistant ([#19994](https://github.com/Koenkk/zigbee2mqtt/issues/19994)) ([f11eb24](https://github.com/Koenkk/zigbee2mqtt/commit/f11eb2459bd1ad89a1588b8d2d023d949faf3313))
### Bug Fixes
* Add Home Assistant `entity_category` for various Ubisys D1 entities ([#20393](https://github.com/Koenkk/zigbee2mqtt/issues/20393)) ([085b46c](https://github.com/Koenkk/zigbee2mqtt/commit/085b46c995c888751ca5a1ff73391b8f56591826))
* Allow `null` for `zigbee_ota_override_index_location` option ([#20151](https://github.com/Koenkk/zigbee2mqtt/issues/20151)) ([48347a5](https://github.com/Koenkk/zigbee2mqtt/commit/48347a51dcff3ce8ed533c71cc27651bc884228b))
* Clear old Home Assistant discovery topics when exposes are changed ([#20313](https://github.com/Koenkk/zigbee2mqtt/issues/20313)) ([a5b959a](https://github.com/Koenkk/zigbee2mqtt/commit/a5b959a6d520679bce1586c50f01a57f13d6af01))
* Don't crash on startup when external converters fails to load https://github.com/Koenkk/zigbee2mqtt/issues/20010 ([8ab96e1](https://github.com/Koenkk/zigbee2mqtt/commit/8ab96e124fa5e24e504b2a11ae6cf9836d93f5c8))
* Fix availability checks not stopped on extension stop ([#20093](https://github.com/Koenkk/zigbee2mqtt/issues/20093)) ([5aeec13](https://github.com/Koenkk/zigbee2mqtt/commit/5aeec130b19e112ad52cbc506a810dcdfc2e2605))
* Fix build on Node 20+ ([#19983](https://github.com/Koenkk/zigbee2mqtt/issues/19983)) ([9c8aee1](https://github.com/Koenkk/zigbee2mqtt/commit/9c8aee17dc9ee0cea311d99c282f1558d2fb841b))
* Fix Home Assistant `Entity category `config` is invalid for sensors` warning https://github.com/Koenkk/zigbee2mqtt/issues/20252 ([8f62a0a](https://github.com/Koenkk/zigbee2mqtt/commit/8f62a0a61899837c63d7053efd68b7a315d623ac))
* Fix load of empty configuration `.yaml` file failing ([#20289](https://github.com/Koenkk/zigbee2mqtt/issues/20289)) ([b67888f](https://github.com/Koenkk/zigbee2mqtt/commit/b67888f938e9e04b8547d7569b78058ba3fb017b))
* **ignore:** Ability to use a specified endpoint in the Tz.Converter ([#20356](https://github.com/Koenkk/zigbee2mqtt/issues/20356)) ([d702919](https://github.com/Koenkk/zigbee2mqtt/commit/d702919735c2f399d73c3fb902721e4b5367b320))
* **ignore:** Changes for zhc 18.0.0 ([#20390](https://github.com/Koenkk/zigbee2mqtt/issues/20390)) ([e6e3d92](https://github.com/Koenkk/zigbee2mqtt/commit/e6e3d92971162494ff999f74d13b00429b164c51))
* **ignore:** Downgrade connect-gzip-static to 3.0.1 https://github.com/Koenkk/zigbee2mqtt/issues/20149 ([f64c00c](https://github.com/Koenkk/zigbee2mqtt/commit/f64c00c8d34dae64279a607368c82c06dc9dc53a))
* **ignore:** Fix "Permit join timeout" template ([#20096](https://github.com/Koenkk/zigbee2mqtt/issues/20096)) ([59efc15](https://github.com/Koenkk/zigbee2mqtt/commit/59efc15f3adb58954f3a9eb524d728679fa28e77))
* **ignore:** fix bind test ([d150105](https://github.com/Koenkk/zigbee2mqtt/commit/d1501052ad1dc7d1cdf9e0f925c3e9694c748226))
* **ignore:** fix dd1e0db407f80add7355879823cf519ae869a7f6 ([04d8522](https://github.com/Koenkk/zigbee2mqtt/commit/04d8522b3ba95f83e0b569373726e4da7a1ece13))
* **ignore:** fix dee8781e51f2aac466e273fb81cbdd31da56ac18 ([32b0ded](https://github.com/Koenkk/zigbee2mqtt/commit/32b0ded17c781fea0474c9928d795a3eb3c81acf))
* **ignore:** fix homeassistant.test.js ([dee8781](https://github.com/Koenkk/zigbee2mqtt/commit/dee8781e51f2aac466e273fb81cbdd31da56ac18))
* **ignore:** Fix OTA sensor discoverd while device doesn't support it https://github.com/Koenkk/zigbee2mqtt/issues/20131 ([abde909](https://github.com/Koenkk/zigbee2mqtt/commit/abde909b7106ffdc0d841c44b9791aaafd874cc2))
* **ignore:** improve 8f62a0a ([2e704f3](https://github.com/Koenkk/zigbee2mqtt/commit/2e704f3ff7ac1dbe1b6f12c7cdace29850a288cf))
* **ignore:** Revert module to commonjs ([6b6cc8a](https://github.com/Koenkk/zigbee2mqtt/commit/6b6cc8aa34ec8b63db332cd8ad33d3592e6c515b))
* **ignore:** Update alpine to 3.19.0 ([#20392](https://github.com/Koenkk/zigbee2mqtt/issues/20392)) ([eaaf1b0](https://github.com/Koenkk/zigbee2mqtt/commit/eaaf1b0b4f6ebd631117ae13666e5e0ebcb89b23))
* **ignore:** update dependencies ([#19896](https://github.com/Koenkk/zigbee2mqtt/issues/19896)) ([6e843d0](https://github.com/Koenkk/zigbee2mqtt/commit/6e843d0f1cdf0e76a2a07cf3d33f3287f0a5e70c))
* **ignore:** update dependencies ([#20023](https://github.com/Koenkk/zigbee2mqtt/issues/20023)) ([e0deef8](https://github.com/Koenkk/zigbee2mqtt/commit/e0deef8889835949af99e4dfd4c47a182d329514))
* **ignore:** update dependencies ([#20133](https://github.com/Koenkk/zigbee2mqtt/issues/20133)) ([b415443](https://github.com/Koenkk/zigbee2mqtt/commit/b415443126e3ee0bda25a9fee8e37615c2290b2e))
* **ignore:** update dependencies ([#20249](https://github.com/Koenkk/zigbee2mqtt/issues/20249)) ([6e52b2a](https://github.com/Koenkk/zigbee2mqtt/commit/6e52b2a7af0ec9bd636a9be12ff7aa16e2c37f04))
* **ignore:** update dependencies ([#20256](https://github.com/Koenkk/zigbee2mqtt/issues/20256)) ([1e4ac34](https://github.com/Koenkk/zigbee2mqtt/commit/1e4ac34c443e29df9631b97ed83c407c2c174af1))
* **ignore:** update dependencies ([#20257](https://github.com/Koenkk/zigbee2mqtt/issues/20257)) ([19754c6](https://github.com/Koenkk/zigbee2mqtt/commit/19754c69e51d642dd9360aa27c3d0a121f8d5d61))
* **ignore:** update dependencies ([#20368](https://github.com/Koenkk/zigbee2mqtt/issues/20368)) ([0385791](https://github.com/Koenkk/zigbee2mqtt/commit/03857916c455a08c42bc241bc643af7a91061b5d))
* **ignore:** update dependencies ([#20452](https://github.com/Koenkk/zigbee2mqtt/issues/20452)) ([16730b1](https://github.com/Koenkk/zigbee2mqtt/commit/16730b14a1d1de396fd8f6260567a1da4afae623))
* **ignore:** Update tsconfig for Node 18 ([084b048](https://github.com/Koenkk/zigbee2mqtt/commit/084b048ff389261edbd72f05e0c461e725574b6e))
* **ignore:** update zigbee-herdsman to 0.25.1 ([#19985](https://github.com/Koenkk/zigbee2mqtt/issues/19985)) ([a822873](https://github.com/Koenkk/zigbee2mqtt/commit/a8228737480dac0d61768131c7b4850a614db4fc))
* **ignore:** update zigbee-herdsman to 0.25.2 ([#19997](https://github.com/Koenkk/zigbee2mqtt/issues/19997)) ([9a2425a](https://github.com/Koenkk/zigbee2mqtt/commit/9a2425a202bc70a6d7f4ba534e145bcb3736f041))
* **ignore:** update zigbee-herdsman to 0.25.3 ([#20025](https://github.com/Koenkk/zigbee2mqtt/issues/20025)) ([483acc3](https://github.com/Koenkk/zigbee2mqtt/commit/483acc3ca156e441bb82d9e8040ccf9dc7a5e1e5))
* **ignore:** update zigbee-herdsman to 0.26.0 ([#20092](https://github.com/Koenkk/zigbee2mqtt/issues/20092)) ([8929ab3](https://github.com/Koenkk/zigbee2mqtt/commit/8929ab3b9704e924fc2f0f5e84e6d15e5c14a8b5))
* **ignore:** update zigbee-herdsman to 0.26.1 ([#20143](https://github.com/Koenkk/zigbee2mqtt/issues/20143)) ([a26008f](https://github.com/Koenkk/zigbee2mqtt/commit/a26008f74c7a8ef138e51debc79965fde53ca61b))
* **ignore:** update zigbee-herdsman to 0.27.1 ([#20262](https://github.com/Koenkk/zigbee2mqtt/issues/20262)) ([65d7f5f](https://github.com/Koenkk/zigbee2mqtt/commit/65d7f5f3e27ad4a8dbe2abeca1f5ffa349c9631b))
* **ignore:** update zigbee-herdsman to 0.28.0 ([#20357](https://github.com/Koenkk/zigbee2mqtt/issues/20357)) ([89f8e43](https://github.com/Koenkk/zigbee2mqtt/commit/89f8e43ad11ffd84cf6a3c9d3bd57d5577063e15))
* **ignore:** update zigbee-herdsman to 0.29.0 ([#20403](https://github.com/Koenkk/zigbee2mqtt/issues/20403)) ([03a1ce3](https://github.com/Koenkk/zigbee2mqtt/commit/03a1ce3895cbc9dafb1c83a7013e1f96409db05a))
* **ignore:** update zigbee-herdsman to 0.29.1 ([#20406](https://github.com/Koenkk/zigbee2mqtt/issues/20406)) ([7bca19d](https://github.com/Koenkk/zigbee2mqtt/commit/7bca19dae777eb919a0017b4c52304ec83972e73))
* **ignore:** update zigbee-herdsman to 0.30.0 ([#20464](https://github.com/Koenkk/zigbee2mqtt/issues/20464)) ([05c65d3](https://github.com/Koenkk/zigbee2mqtt/commit/05c65d31ed76f0f5f080518a4196ca7999a41adc))
* **ignore:** update zigbee-herdsman-converters to 15.131.0 ([#19987](https://github.com/Koenkk/zigbee2mqtt/issues/19987)) ([af02370](https://github.com/Koenkk/zigbee2mqtt/commit/af02370777fc5e81363810c759359e5ba17e3bf7))
* **ignore:** update zigbee-herdsman-converters to 15.132.0 ([#20005](https://github.com/Koenkk/zigbee2mqtt/issues/20005)) ([5afd16a](https://github.com/Koenkk/zigbee2mqtt/commit/5afd16ac652560250ec9a21f4d05fba7e25af853))
* **ignore:** update zigbee-herdsman-converters to 16.0.0 ([#20008](https://github.com/Koenkk/zigbee2mqtt/issues/20008)) ([2fa8afe](https://github.com/Koenkk/zigbee2mqtt/commit/2fa8afe37f99425234b2841a3ffd8c954a7b78c6))
* **ignore:** update zigbee-herdsman-converters to 16.0.1 ([#20012](https://github.com/Koenkk/zigbee2mqtt/issues/20012)) ([5e3bd75](https://github.com/Koenkk/zigbee2mqtt/commit/5e3bd75f098b28a5df544ef5b06eab9f35020419))
* **ignore:** update zigbee-herdsman-converters to 16.0.2 ([#20027](https://github.com/Koenkk/zigbee2mqtt/issues/20027)) ([e60b94b](https://github.com/Koenkk/zigbee2mqtt/commit/e60b94b55329e30f00c1dec5094f139233d08521))
* **ignore:** update zigbee-herdsman-converters to 16.1.0 ([#20059](https://github.com/Koenkk/zigbee2mqtt/issues/20059)) ([cb74db4](https://github.com/Koenkk/zigbee2mqtt/commit/cb74db47f7140357796618350c1ae73b7b1d4d1a))
* **ignore:** update zigbee-herdsman-converters to 16.11.0 ([#20228](https://github.com/Koenkk/zigbee2mqtt/issues/20228)) ([2c5d3e1](https://github.com/Koenkk/zigbee2mqtt/commit/2c5d3e14f779ff138949f11f6a443fd8821e0120))
* **ignore:** update zigbee-herdsman-converters to 16.12.0 ([#20258](https://github.com/Koenkk/zigbee2mqtt/issues/20258)) ([c26a6a2](https://github.com/Koenkk/zigbee2mqtt/commit/c26a6a28e4562d7cc97763f6c02782525575f84f))
* **ignore:** update zigbee-herdsman-converters to 16.13.0 ([#20280](https://github.com/Koenkk/zigbee2mqtt/issues/20280)) ([29635a9](https://github.com/Koenkk/zigbee2mqtt/commit/29635a9b6aedd8f140c126a36813bb922f6a450e))
* **ignore:** update zigbee-herdsman-converters to 16.14.1 ([#20301](https://github.com/Koenkk/zigbee2mqtt/issues/20301)) ([af8c2d8](https://github.com/Koenkk/zigbee2mqtt/commit/af8c2d86fe1b50934ec8ccd675b298dc2f86a29a))
* **ignore:** update zigbee-herdsman-converters to 16.15.0 ([#20318](https://github.com/Koenkk/zigbee2mqtt/issues/20318)) ([27ccd1a](https://github.com/Koenkk/zigbee2mqtt/commit/27ccd1a5704b366f86b4c708865831abe40cd2ad))
* **ignore:** update zigbee-herdsman-converters to 16.16.0 ([#20326](https://github.com/Koenkk/zigbee2mqtt/issues/20326)) ([6875146](https://github.com/Koenkk/zigbee2mqtt/commit/687514621152c48809d922af9e712a45c762173d))
* **ignore:** update zigbee-herdsman-converters to 16.17.0 ([#20359](https://github.com/Koenkk/zigbee2mqtt/issues/20359)) ([1a72650](https://github.com/Koenkk/zigbee2mqtt/commit/1a7265017a0b7facbe88058daa1ef47fcc79747e))
* **ignore:** update zigbee-herdsman-converters to 16.18.0 ([#20374](https://github.com/Koenkk/zigbee2mqtt/issues/20374)) ([fe7e82f](https://github.com/Koenkk/zigbee2mqtt/commit/fe7e82f7d34db4d79448f198f51902592633fbc1))
* **ignore:** update zigbee-herdsman-converters to 16.2.0 ([#20094](https://github.com/Koenkk/zigbee2mqtt/issues/20094)) ([cb50942](https://github.com/Koenkk/zigbee2mqtt/commit/cb509426eca455d693723b5631313163b931dbc9))
* **ignore:** update zigbee-herdsman-converters to 16.3.1 ([#20109](https://github.com/Koenkk/zigbee2mqtt/issues/20109)) ([4e6bc33](https://github.com/Koenkk/zigbee2mqtt/commit/4e6bc33a2203591a9bcee84eb90cefdb9c883c69))
* **ignore:** update zigbee-herdsman-converters to 16.4.0 ([#20120](https://github.com/Koenkk/zigbee2mqtt/issues/20120)) ([4cc88f1](https://github.com/Koenkk/zigbee2mqtt/commit/4cc88f1e16e5bd8e901c555c6950f14d46013787))
* **ignore:** update zigbee-herdsman-converters to 16.5.0 ([#20125](https://github.com/Koenkk/zigbee2mqtt/issues/20125)) ([5ff10c3](https://github.com/Koenkk/zigbee2mqtt/commit/5ff10c3e5ced22a6070360f76ea9ffd7e9805194))
* **ignore:** update zigbee-herdsman-converters to 16.6.0 ([#20145](https://github.com/Koenkk/zigbee2mqtt/issues/20145)) ([87f6b9e](https://github.com/Koenkk/zigbee2mqtt/commit/87f6b9e81a4efaa857c06ba179665535e1beb742))
* **ignore:** update zigbee-herdsman-converters to 16.7.0 ([#20167](https://github.com/Koenkk/zigbee2mqtt/issues/20167)) ([7c81eda](https://github.com/Koenkk/zigbee2mqtt/commit/7c81eda46a1b7d3ce190a11f89618e60afaba7b5))
* **ignore:** update zigbee-herdsman-converters to 16.8.0 ([#20185](https://github.com/Koenkk/zigbee2mqtt/issues/20185)) ([bcf50bd](https://github.com/Koenkk/zigbee2mqtt/commit/bcf50bd0c532d822768d380cb99f793e00db07f0))
* **ignore:** update zigbee-herdsman-converters to 16.9.0 ([#20200](https://github.com/Koenkk/zigbee2mqtt/issues/20200)) ([25de4fd](https://github.com/Koenkk/zigbee2mqtt/commit/25de4fded9bd67bafb2e8a596490988c624dce88))
* **ignore:** update zigbee-herdsman-converters to 17.0.0 ([#20378](https://github.com/Koenkk/zigbee2mqtt/issues/20378)) ([2110954](https://github.com/Koenkk/zigbee2mqtt/commit/2110954bb8c47b4fb9b3b536e857183cb4fc83ac))
* **ignore:** update zigbee-herdsman-converters to 18.0.0 ([#20391](https://github.com/Koenkk/zigbee2mqtt/issues/20391)) ([bf744f4](https://github.com/Koenkk/zigbee2mqtt/commit/bf744f48dc820f46f9944cf52513437908586d79))
* **ignore:** update zigbee-herdsman-converters to 18.1.0 ([#20426](https://github.com/Koenkk/zigbee2mqtt/issues/20426)) ([a3a87f4](https://github.com/Koenkk/zigbee2mqtt/commit/a3a87f4580ad4b2a77d1c039232035f7cf5797ac))
* **ignore:** update zigbee-herdsman-converters to 18.2.0 ([#20451](https://github.com/Koenkk/zigbee2mqtt/issues/20451)) ([a8c791b](https://github.com/Koenkk/zigbee2mqtt/commit/a8c791b0302cb885671bdfd0dd785a83185dffe0))
* **ignore:** update zigbee-herdsman-converters to 18.3.0 ([#20465](https://github.com/Koenkk/zigbee2mqtt/issues/20465)) ([f9e0c20](https://github.com/Koenkk/zigbee2mqtt/commit/f9e0c2058fe15517d6b17445eb48ad6c9777c3db))
* **ignore:** update zigbee2mqtt-frontend to 0.6.148 ([#20034](https://github.com/Koenkk/zigbee2mqtt/issues/20034)) ([ffcb820](https://github.com/Koenkk/zigbee2mqtt/commit/ffcb8202f01d9ba627a362abdbc350793e269647))
* **ignore:** update zigbee2mqtt-frontend to 0.6.149 ([#20141](https://github.com/Koenkk/zigbee2mqtt/issues/20141)) ([c7e2944](https://github.com/Koenkk/zigbee2mqtt/commit/c7e294482bfd7dacb5fc70858041141070a6971d))
* **ignore:** update zigbee2mqtt-frontend to 0.6.150 ([#20377](https://github.com/Koenkk/zigbee2mqtt/issues/20377)) ([d616e57](https://github.com/Koenkk/zigbee2mqtt/commit/d616e57daf89f36b145a46bec01b80deaaaae5a7))
* **ignore:** Use zhc types ([#20006](https://github.com/Koenkk/zigbee2mqtt/issues/20006)) ([dd1e0db](https://github.com/Koenkk/zigbee2mqtt/commit/dd1e0db407f80add7355879823cf519ae869a7f6))
* Make update script work from anywhere ([#19965](https://github.com/Koenkk/zigbee2mqtt/issues/19965)) ([346cb90](https://github.com/Koenkk/zigbee2mqtt/commit/346cb90e9e78fd08ffb49cb954bcbee2f3bc9191))
* Only republish changed scenes to Home Assistant when changed ([#20248](https://github.com/Koenkk/zigbee2mqtt/issues/20248)) ([e0f5021](https://github.com/Koenkk/zigbee2mqtt/commit/e0f50218d70c1932fbc32f28f60737a4bff5f048))
* Prevent duplicate Home Assistant scene entities ([#20097](https://github.com/Koenkk/zigbee2mqtt/issues/20097)) ([a17f650](https://github.com/Koenkk/zigbee2mqtt/commit/a17f650ccbb8113874dc5dd5f5ad3e3419dc6c15))
* Support Node 21 and drop 16 ([adc0812](https://github.com/Koenkk/zigbee2mqtt/commit/adc08125fe892dfe456edf3a4d85da23b6f5798d))
## [1.34.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.33.2...1.34.0) (2023-12-01)
### Features
* Add Home Assistant scene discovery ([#19838](https://github.com/Koenkk/zigbee2mqtt/issues/19838)) ([838629c](https://github.com/Koenkk/zigbee2mqtt/commit/838629ca42162d3d910b06bbc100b6270f75de33))
### Bug Fixes
* Fix `in_progress` attribute for Home Assistant update sensor ([#19542](https://github.com/Koenkk/zigbee2mqtt/issues/19542)) ([1f2bd84](https://github.com/Koenkk/zigbee2mqtt/commit/1f2bd841c4548777fc0c0f6ad6c54dfe913b3fd0))
* Fix entity category for Home Assistant `binary_sensor` https://github.com/Koenkk/zigbee2mqtt/pull/19474 ([071842e](https://github.com/Koenkk/zigbee2mqtt/commit/071842ef49eccc002efefbad3abf2780e6fdd0a2))
* Fix Home Assistant `in_progress` Erroneous JSON error https://github.com/Koenkk/zigbee2mqtt/issues/19597 ([2540fbd](https://github.com/Koenkk/zigbee2mqtt/commit/2540fbd771d01ee18cbb72c67cb0a24b44131912))
* Fix invalid JSON error in Home Assistant update entity ([#19659](https://github.com/Koenkk/zigbee2mqtt/issues/19659)) ([da04d22](https://github.com/Koenkk/zigbee2mqtt/commit/da04d223b446000df5cc59ccb38115eb3e5eac96))
* Fix unable to configure again after configure fails ([#19908](https://github.com/Koenkk/zigbee2mqtt/issues/19908)) ([a904e7a](https://github.com/Koenkk/zigbee2mqtt/commit/a904e7a396e34bbeef2e624702d55e9d0522b242))
* **ignore:** Fix color_temp_percent test ([01d32cb](https://github.com/Koenkk/zigbee2mqtt/commit/01d32cb2301f6db11f61bca113a2db8d86c7acc1))
* **ignore:** Fixes quote type for update JSON attribute discovery ([#19668](https://github.com/Koenkk/zigbee2mqtt/issues/19668)) ([baae082](https://github.com/Koenkk/zigbee2mqtt/commit/baae0822583fb29e079c57746b047cb602f017a7))
* **ignore:** remove console.log in test ([8cf41a1](https://github.com/Koenkk/zigbee2mqtt/commit/8cf41a137aa8275e61a244b0096796466b10648d))
* **ignore:** remove unused variable ([#19584](https://github.com/Koenkk/zigbee2mqtt/issues/19584)) ([be48d54](https://github.com/Koenkk/zigbee2mqtt/commit/be48d545cc03c95b0a6302b67cc04b4e7d187065))
* **ignore:** update dependencies ([#19570](https://github.com/Koenkk/zigbee2mqtt/issues/19570)) ([fc073e8](https://github.com/Koenkk/zigbee2mqtt/commit/fc073e8743c0ba9c05d0a952f6bf3ae6fa804f68))
* **ignore:** update dependencies ([#19679](https://github.com/Koenkk/zigbee2mqtt/issues/19679)) ([c8848be](https://github.com/Koenkk/zigbee2mqtt/commit/c8848be981c709ebb52bfb9c7347ab3a88cce82e))
* **ignore:** update zigbee-herdsman to 0.22.0 ([#19547](https://github.com/Koenkk/zigbee2mqtt/issues/19547)) ([02a5a1b](https://github.com/Koenkk/zigbee2mqtt/commit/02a5a1b14f4907e7d170ef3e3e4f93b176c4bbc5))
* **ignore:** update zigbee-herdsman to 0.22.1 ([#19602](https://github.com/Koenkk/zigbee2mqtt/issues/19602)) ([2d5bb24](https://github.com/Koenkk/zigbee2mqtt/commit/2d5bb2462eb547bc75df1bace2f01b6b15e6d171))
* **ignore:** update zigbee-herdsman to 0.23.0 ([#19700](https://github.com/Koenkk/zigbee2mqtt/issues/19700)) ([a152bde](https://github.com/Koenkk/zigbee2mqtt/commit/a152bded93877cfab3839b9b22e7d22ce43fb263))
* **ignore:** update zigbee-herdsman to 0.24.0 ([#19926](https://github.com/Koenkk/zigbee2mqtt/issues/19926)) ([e5dc271](https://github.com/Koenkk/zigbee2mqtt/commit/e5dc271a783aeec0c28e106f0f259a083d737d7c))
* **ignore:** update zigbee-herdsman to 0.25.0 ([#19933](https://github.com/Koenkk/zigbee2mqtt/issues/19933)) ([2dabc1e](https://github.com/Koenkk/zigbee2mqtt/commit/2dabc1e61b897fdb041a42bda7adc6acac6bb2b3))
* **ignore:** update zigbee-herdsman-converters to 15.107.0 ([#19548](https://github.com/Koenkk/zigbee2mqtt/issues/19548)) ([366e29d](https://github.com/Koenkk/zigbee2mqtt/commit/366e29d4d9126eaeca2476cc0fa56cf7faf70764))
* **ignore:** update zigbee-herdsman-converters to 15.108.0 ([#19589](https://github.com/Koenkk/zigbee2mqtt/issues/19589)) ([1fd1686](https://github.com/Koenkk/zigbee2mqtt/commit/1fd1686ee63cbd2b41d9d0a13669f9c665eb36da))
* **ignore:** update zigbee-herdsman-converters to 15.109.0 ([#19601](https://github.com/Koenkk/zigbee2mqtt/issues/19601)) ([b71aa0a](https://github.com/Koenkk/zigbee2mqtt/commit/b71aa0a3fd9a8e6a7fcc5e7bdb4a2f2b37cd690a))
* **ignore:** update zigbee-herdsman-converters to 15.110.0 ([#19619](https://github.com/Koenkk/zigbee2mqtt/issues/19619)) ([5889cdd](https://github.com/Koenkk/zigbee2mqtt/commit/5889cdd9abe6b41899a4a7422b696bde8bbb0390))
* **ignore:** update zigbee-herdsman-converters to 15.111.0 ([#19630](https://github.com/Koenkk/zigbee2mqtt/issues/19630)) ([354ada5](https://github.com/Koenkk/zigbee2mqtt/commit/354ada5c4c33d88677ce7f8b072b682dde6f19aa))
* **ignore:** update zigbee-herdsman-converters to 15.112.0 ([#19643](https://github.com/Koenkk/zigbee2mqtt/issues/19643)) ([d26ea1a](https://github.com/Koenkk/zigbee2mqtt/commit/d26ea1a4112f9e142ac72e2add82784012c28c51))
* **ignore:** update zigbee-herdsman-converters to 15.113.0 ([#19663](https://github.com/Koenkk/zigbee2mqtt/issues/19663)) ([c8dcd71](https://github.com/Koenkk/zigbee2mqtt/commit/c8dcd716ab271bdbe9d259943fb77d6d6accbc06))
* **ignore:** update zigbee-herdsman-converters to 15.114.0 ([#19692](https://github.com/Koenkk/zigbee2mqtt/issues/19692)) ([6587812](https://github.com/Koenkk/zigbee2mqtt/commit/6587812b725d28dc200eb42f6b0714ed1ed76e9f))
* **ignore:** update zigbee-herdsman-converters to 15.115.0 ([#19701](https://github.com/Koenkk/zigbee2mqtt/issues/19701)) ([157dff1](https://github.com/Koenkk/zigbee2mqtt/commit/157dff14d3ac32c70f13f5f7be0a85e2763bf2a6))
* **ignore:** update zigbee-herdsman-converters to 15.116.0 ([#19714](https://github.com/Koenkk/zigbee2mqtt/issues/19714)) ([4815ac7](https://github.com/Koenkk/zigbee2mqtt/commit/4815ac711003632ac21977b120dea7444ebeda3e))
* **ignore:** update zigbee-herdsman-converters to 15.117.0 ([#19727](https://github.com/Koenkk/zigbee2mqtt/issues/19727)) ([746066c](https://github.com/Koenkk/zigbee2mqtt/commit/746066c9205a7ab77393d1934aacb7f17209a1e0))
* **ignore:** update zigbee-herdsman-converters to 15.119.0 ([#19740](https://github.com/Koenkk/zigbee2mqtt/issues/19740)) ([ad4bed8](https://github.com/Koenkk/zigbee2mqtt/commit/ad4bed89215e1727f0966708f510b8c933ac1a32))
* **ignore:** update zigbee-herdsman-converters to 15.120.0 ([#19761](https://github.com/Koenkk/zigbee2mqtt/issues/19761)) ([fd19c86](https://github.com/Koenkk/zigbee2mqtt/commit/fd19c86cb19513dadae9a44ee8b50d287cc1860e))
* **ignore:** update zigbee-herdsman-converters to 15.121.0 ([#19777](https://github.com/Koenkk/zigbee2mqtt/issues/19777)) ([d4e3aa9](https://github.com/Koenkk/zigbee2mqtt/commit/d4e3aa9d976b67cb1519ca78c9b8de5e70247ad9))
* **ignore:** update zigbee-herdsman-converters to 15.123.1 ([#19809](https://github.com/Koenkk/zigbee2mqtt/issues/19809)) ([2d08baf](https://github.com/Koenkk/zigbee2mqtt/commit/2d08baf6204bde6f2ec90dba4a6a77963b14310c))
* **ignore:** update zigbee-herdsman-converters to 15.124.0 ([#19836](https://github.com/Koenkk/zigbee2mqtt/issues/19836)) ([ef4d9e1](https://github.com/Koenkk/zigbee2mqtt/commit/ef4d9e1e558561c1625d1a0d41ddc718d40b5c61))
* **ignore:** update zigbee-herdsman-converters to 15.125.0 ([#19854](https://github.com/Koenkk/zigbee2mqtt/issues/19854)) ([ef00a64](https://github.com/Koenkk/zigbee2mqtt/commit/ef00a64bf87adf38346461f5fa15757052400b2a))
* **ignore:** update zigbee-herdsman-converters to 15.125.1 ([#19867](https://github.com/Koenkk/zigbee2mqtt/issues/19867)) ([51a9341](https://github.com/Koenkk/zigbee2mqtt/commit/51a93418fa2de62e6691ef23a65725d28d9c8b42))
* **ignore:** update zigbee-herdsman-converters to 15.126.0 ([#19878](https://github.com/Koenkk/zigbee2mqtt/issues/19878)) ([b17487e](https://github.com/Koenkk/zigbee2mqtt/commit/b17487e6bb8d04bca0aaa5b0ad2338dc9eef46aa))
* **ignore:** update zigbee-herdsman-converters to 15.127.0 ([#19894](https://github.com/Koenkk/zigbee2mqtt/issues/19894)) ([8a6d90d](https://github.com/Koenkk/zigbee2mqtt/commit/8a6d90d70e9ebcb2eeeacf385f4c3d47adeebc88))
* **ignore:** update zigbee-herdsman-converters to 15.128.0 ([#19906](https://github.com/Koenkk/zigbee2mqtt/issues/19906)) ([4e128e2](https://github.com/Koenkk/zigbee2mqtt/commit/4e128e26fee314f2bdcce014132f85d5167ce0bf))
* **ignore:** update zigbee-herdsman-converters to 15.129.0 ([#19934](https://github.com/Koenkk/zigbee2mqtt/issues/19934)) ([12521ad](https://github.com/Koenkk/zigbee2mqtt/commit/12521add3968cc9ed5394cf128bf2917f75597a5))
* **ignore:** update zigbee-herdsman-converters to 15.130.0 ([#19942](https://github.com/Koenkk/zigbee2mqtt/issues/19942)) ([f976d4e](https://github.com/Koenkk/zigbee2mqtt/commit/f976d4efb48440ee7899490d31f14d820d71087d))
* **ignore:** update zigbee-herdsman-converters to 15.130.1 ([#19945](https://github.com/Koenkk/zigbee2mqtt/issues/19945)) ([3bbf89c](https://github.com/Koenkk/zigbee2mqtt/commit/3bbf89cba038c6bdfab08c3e2860e561b2845a43))
* **ignore:** update zigbee2mqtt-frontend to 0.6.143 ([#19642](https://github.com/Koenkk/zigbee2mqtt/issues/19642)) ([9d5d617](https://github.com/Koenkk/zigbee2mqtt/commit/9d5d61754d2808c83eee48dfc6a0e0c4c740002a))
* **ignore:** update zigbee2mqtt-frontend to 0.6.144 ([#19776](https://github.com/Koenkk/zigbee2mqtt/issues/19776)) ([91aed7e](https://github.com/Koenkk/zigbee2mqtt/commit/91aed7e98e65d1c1c1469e3bfaab74233f0002bf))
* **ignore:** update zigbee2mqtt-frontend to 0.6.145 ([#19778](https://github.com/Koenkk/zigbee2mqtt/issues/19778)) ([ed20e2a](https://github.com/Koenkk/zigbee2mqtt/commit/ed20e2a1bc0a474157880c2c54f7c2d656658901))
* **ignore:** update zigbee2mqtt-frontend to 0.6.146 ([#19784](https://github.com/Koenkk/zigbee2mqtt/issues/19784)) ([c87ac9c](https://github.com/Koenkk/zigbee2mqtt/commit/c87ac9cc2b1d360ff0962deed973545a9846fcd6))
* **ignore:** update zigbee2mqtt-frontend to 0.6.147 ([#19801](https://github.com/Koenkk/zigbee2mqtt/issues/19801)) ([61b08c9](https://github.com/Koenkk/zigbee2mqtt/commit/61b08c94bfd3dd58efdb22632476f410fac56d13))
* Make frontend listen on both IPv4 and IPv6 by default ([#19660](https://github.com/Koenkk/zigbee2mqtt/issues/19660)) ([45ac44d](https://github.com/Koenkk/zigbee2mqtt/commit/45ac44dd064a3f8aca87a25e7a0b2daafe53c5d3))
* Map climate `idle` to `idle` instead of `off` in Home Assistant ([#19545](https://github.com/Koenkk/zigbee2mqtt/issues/19545)) ([64b26e4](https://github.com/Koenkk/zigbee2mqtt/commit/64b26e47da3d765bfde8ccac8f9a1e304b28c697))
* Set entity category `config` for Home Assistant `temperature_display_mode` sensor ([#19631](https://github.com/Koenkk/zigbee2mqtt/issues/19631)) ([86ae0ed](https://github.com/Koenkk/zigbee2mqtt/commit/86ae0ed90fb1d94f5cb09545355968affa5654ca))
* **typo:** correct misspell ([#19581](https://github.com/Koenkk/zigbee2mqtt/issues/19581)) ([13443a4](https://github.com/Koenkk/zigbee2mqtt/commit/13443a42ce7239a7308efb829c8ff007e59ca45d))
## [1.33.2](https://github.com/Koenkk/zigbee2mqtt/compare/1.33.1...1.33.2) (2023-11-01)
-1
View File
@@ -6,6 +6,5 @@ module.exports = {
assumptions: {setPublicClassFields: true},
plugins: [
['@babel/plugin-proposal-decorators', {'legacy': true}],
['@babel/plugin-proposal-class-properties'],
],
};
+23
View File
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
+8
View File
@@ -0,0 +1,8 @@
# Changelog
## [1.37.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.37.0...1.37.1) (2024-05-09)
### Bug Fixes
* Add Helm chart ([#21852](https://github.com/Koenkk/zigbee2mqtt/issues/21852)) ([b2e8b3e](https://github.com/Koenkk/zigbee2mqtt/commit/b2e8b3e00c152540109e7b9101784f3b03261b40))
+17
View File
@@ -0,0 +1,17 @@
apiVersion: v2
appVersion: 1.37.1
description: Bridges events and allows you to control your Zigbee devices via MQTT
name: zigbee2mqtt
version: 1.37.1
kubeVersion: ">=1.26.0-0"
keywords:
- zigbee
- mqtt
- home-assistant
home: https://github.com/Koenkk/zigbee2mqtt
icon: https://www.zigbee2mqtt.io/logo.png
sources:
- https://github.com/Koenkk/zigbee2mqtt
maintainers:
- name: Koen Kanters
email: XXXX
+93
View File
@@ -0,0 +1,93 @@
# zigbee2mqtt
![Version: 1.37.1](https://img.shields.io/badge/Version-1.37.1-informational?style=flat-square) ![AppVersion: 1.37.1](https://img.shields.io/badge/AppVersion-1.37.1-informational?style=flat-square)
Bridges events and allows you to control your Zigbee devices via MQTT
**Homepage:** <https://github.com/Koenkk/zigbee2mqtt>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| Koen Kanters | <XXXX> | |
## Source Code
* <https://github.com/Koenkk/zigbee2mqtt>
## Requirements
Kubernetes: `>=1.26.0-0`
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| customLabels | object | `{}` | |
| fullnameOverride | string | `nil` | override the name of the objects generated |
| image.imagePullSecrets | object | `{}` | Container additional secrets to pull image |
| image.pullPolicy | string | `"IfNotPresent"` | Container pull policy |
| image.repository | string | `"koenkk/zigbee2mqtt"` | Image repository for the `zigbee2mqtt` container. |
| image.tag | string | `"1.37.1"` | Version for the `zigbee2mqtt` container. |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | When enabled a new Ingress will be created |
| ingress.hosts[0] | string | `"yourdomain.com"` | |
| ingress.ingressClassName | string | `"contour"` | |
| ingress.labels | object | `{}` | |
| ingress.path | string | `"/"` | |
| ingress.pathType | string | `"Prefix"` | |
| ingress.tls[0].hosts[0] | string | `"yourdomain.com"` | |
| ingress.tls[0].secretName | string | `"some-tls-secret"` | |
| nameOverride | string | `nil` | override the release name |
| service.annotations | object | `{}` | annotations for the service created |
| service.port | int | `8080` | port in which the service will be listening |
| service.type | string | `"LoadBalancer"` | type of Service to be created |
| statefulset.dnsPolicy | string | `"ClusterFirst"` | pod dns policy |
| statefulset.nodeSelector | object | `{}` | Select specific kube node, this will allow enforcing zigbee2mqtt running only on the node with the USB adapter connected |
| statefulset.resources | object | `{"limits":{"cpu":"200m","memory":"600Mi"},"requests":{"cpu":"200m","memory":"600Mi"}}` | CPU/Memory configuration for the pods |
| statefulset.storage.enabled | bool | `false` | |
| statefulset.storage.existingVolume | string | `""` | |
| statefulset.storage.matchExpressions | object | `{}` | |
| statefulset.storage.matchLabels | object | `{}` | |
| statefulset.storage.size | string | `"1Gi"` | |
| statefulset.storage.storageClassName | string | `"freenas-nfs-csi"` | the name for the storage class to be used in the persistent volume claim |
| statefulset.tolerations | object | `{}` | Node taint tolerations for the pods |
| zigbee2mqtt.advanced.adapter_concurrent | string | `nil` | Optional: configure adapter concurrency (e.g. 2 for CC2531 or 16 for CC26X2R1) (default: null, uses recommended value) |
| zigbee2mqtt.advanced.adapter_delay | int | `0` | Optional: Set the adapter delay, only used for Conbee/Raspbee adapters (default 0). In case you are having issues try `200`. For more information see https://github.com/Koenkk/zigbee2mqtt/issues/4884 |
| zigbee2mqtt.advanced.cache_state | bool | `true` | Has to be true when integrating via Home Assistant (default: true) |
| zigbee2mqtt.advanced.cache_state_persistent | bool | `true` | Optional: persist cached state, only used when cache_state: true (default: true) |
| zigbee2mqtt.advanced.cache_state_send_on_startup | bool | `true` | Optional: send cached state on startup, only used when cache_state_persistent: true (default: true) |
| zigbee2mqtt.advanced.channel | int | `11` | Optional: ZigBee channel, changing requires re-pairing of all devices. (Note: use a ZLL channel: 11, 15, 20, or 25 to avoid Problems) (default: 11) |
| zigbee2mqtt.advanced.elapsed | bool | `false` | Optional: Add an elapsed attribute to MQTT messages, contains milliseconds since the previous msg (default: false) |
| zigbee2mqtt.advanced.last_seen | string | `"disable"` | Optional: Add a last_seen attribute to MQTT messages, contains date/time of last Zigbee message possible values are: disable (default), ISO_8601, ISO_8601_local, epoch (default: disable) |
| zigbee2mqtt.advanced.legacy_api | bool | `false` | Optional: disables the legacy api (default: shown below) |
| zigbee2mqtt.advanced.log_level | string | `"info"` | |
| zigbee2mqtt.advanced.log_output | list | `["console"]` | Optional: network encryption key GENERATE will make Zigbee2MQTT generate a new network key on next startup Note: changing requires repairing of all devices (default: shown below) network_key: null |
| zigbee2mqtt.advanced.report | bool | `true` | Optional: Enables report feature, this feature is DEPRECATED since reporting is now setup by default when binding devices. Docs can still be found here: https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/information/report.md |
| zigbee2mqtt.advanced.timestamp_format | string | `"YYYY-MM-DD HH:mm:ss"` | |
| zigbee2mqtt.advanced.transmit_power | int | `5` | Optional: Transmit power setting in dBm (default: 5). This will set the transmit power for devices that bring an inbuilt amplifier. It can't go over the maximum of the respective hardware and might be limited by firmware (for example to migrate heat, or by using an unsupported firmware). For the CC2652R(B) this is 5 dBm, CC2652P/CC1352P-2 20 dBm. |
| zigbee2mqtt.availability.active.timeout | int | `10` | Time after which an active device will be marked as offline in minutes (default = 10 minutes) |
| zigbee2mqtt.availability.passive.timeout | int | `1500` | Time after which a passive device will be marked as offline in minutes (default = 1500 minutes aka 25 hours) |
| zigbee2mqtt.external_converters | list | `[]` | |
| zigbee2mqtt.frontend.auth_token | string | `nil` | Optional, enables authentication, disabled by default, cleartext (no hashing required) |
| zigbee2mqtt.frontend.host | string | `"0.0.0.0"` | Optional, empty by default to listen on both IPv4 and IPv6. Opens a unix socket when given a path instead of an address (e.g. '/run/zigbee2mqtt/zigbee2mqtt.sock') Don't set this if you use Docker or the Home Assistant add-on unless you're sure the chosen IP is available inside the container |
| zigbee2mqtt.frontend.port | int | `8080` | Mandatory, default 8080 |
| zigbee2mqtt.frontend.url | string | `nil` | Optional, url on which the frontend can be reached, currently only used for the Home Assistant device configuration page |
| zigbee2mqtt.homeassistant.discovery_topic | string | `"homeassistant"` | |
| zigbee2mqtt.homeassistant.enabled | bool | `true` | |
| zigbee2mqtt.homeassistant.legacy_entity_attributes | bool | `true` | |
| zigbee2mqtt.homeassistant.legacy_triggers | bool | `false` | |
| zigbee2mqtt.homeassistant.status_topic | string | `"hass/status"` | |
| zigbee2mqtt.mqtt.server | string | `"mqtt://localhost:1883"` | Required: MQTT server URL (use mqtts:// for SSL/TLS connection) |
| zigbee2mqtt.ota | object | `{"disable_automatic_update_check":false,"ikea_ota_use_test_url":false,"update_check_interval":1440}` | Optional: OTA update settings See https://www.zigbee2mqtt.io/guide/usage/ota_updates.html for more info |
| zigbee2mqtt.ota.disable_automatic_update_check | bool | `false` | Disable automatic update checks |
| zigbee2mqtt.ota.ikea_ota_use_test_url | bool | `false` | Optional: use IKEA TRADFRI OTA test server, see OTA updates documentation (default: false) |
| zigbee2mqtt.ota.update_check_interval | int | `1440` | Minimum time between OTA update checks |
| zigbee2mqtt.permit_join | bool | `false` | Optional: allow new devices to join. |
| zigbee2mqtt.serial.baudrate | int | `115200` | Optional: Baud rate speed for serial port, this can be anything firmware support but default is 115200 for Z-Stack and EZSP, 38400 for Deconz, however note that some EZSP firmware need 57600. |
| zigbee2mqtt.serial.disable_led | bool | `false` | Optional: disable LED of the adapter if supported (default: false) |
| zigbee2mqtt.serial.port | string | `"/dev/ttyACM0"` | Required: location of the adapter (e.g. CC2531). USB adapters - use format "port: /dev/ttyACM0" To autodetect the USB port, set 'port: null'. Ethernet adapters - use format "port: tcp://192.168.1.12:6638" |
| zigbee2mqtt.serial.rtscts | bool | `false` | Optional: RTS / CTS Hardware Flow Control for serial port (default: false) |
| zigbee2mqtt.timezone | string | `"UTC"` | |
+37
View File
@@ -0,0 +1,37 @@
{{/* vim: set filetype=mustache: */}}
{{/* Expand the name of the chart.*/}}
{{- define "zigbee2mqtt.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "zigbee2mqtt.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/* labels for helm resources */}}
{{- define "zigbee2mqtt.labels" -}}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ template "zigbee2mqtt.name" . }}"
app.kubernetes.io/version: "{{ .Chart.AppVersion }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 2 -}}
{{- end }}
{{- end }}
@@ -0,0 +1,39 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
configuration.yaml: |
# Define the files which contains the configs. As k8s config maps
# Are read only by design, we need to extract dynamic config to external files
devices: devices.yaml
groups: groups.yaml
{{- if .Values.zigbee2mqtt.homeassistant }}
homeassistant:
{{- .Values.zigbee2mqtt.homeassistant | toYaml | nindent 6}}
{{- end }}
ota:
{{- .Values.zigbee2mqtt.ota | toYaml | nindent 6}}
permit_join: {{ .Values.zigbee2mqtt.permit_join }}
{{- if .Values.zigbee2mqtt.availability }}
availability:
{{- .Values.zigbee2mqtt.availability | toYaml | nindent 6}}
{{- end }}
{{- if gt (len .Values.zigbee2mqtt.external_converters) 0 }}
external_converters: {{- .Values.zigbee2mqtt.external_converters }}
{{- end }}
mqtt:
{{- .Values.zigbee2mqtt.mqtt | toYaml | nindent 6}}
serial:
{{- .Values.zigbee2mqtt.serial | toYaml | nindent 6}}
frontend:
{{- .Values.zigbee2mqtt.frontend | toYaml | nindent 6}}
advanced:
{{- .Values.zigbee2mqtt.advanced | toYaml | nindent 6}}
+56
View File
@@ -0,0 +1,56 @@
{{- if .Values.ingress.enabled -}}
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $ingressPathType := .Values.ingress.pathType -}}
{{- $fullName := include "zigbee2mqtt.fullname" . }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- with .Values.ingress.tls }}
tls:
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ tpl . $ | quote }}
http:
paths:
- path: {{ $ingressPath }}
pathType: {{ $ingressPathType }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- end }}
{{- else }}
- http:
paths:
- backend:
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- with $ingressPath }}
path: {{ . }}
{{- end }}
pathType: {{ $ingressPathType }}
{{- end -}}
{{- end }}
+20
View File
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ include "zigbee2mqtt.fullname" . }}
ports:
- name: http
port: {{ .Values.service.port }}
targetPort: web
protocol: TCP
@@ -0,0 +1,102 @@
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "zigbee2mqtt.fullname" . }}
template:
metadata:
labels:
{{- include "zigbee2mqtt.labels" . | nindent 8 }}
app: {{ include "zigbee2mqtt.fullname" . }}
spec:
{{- if .Values.image.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.imagePullSecrets | indent 8 }}
{{- end }}
dnsPolicy: {{ .Values.statefulset.dnsPolicy }}
{{- with .Values.statefulset.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
nodeSelector:
{{- with .Values.statefulset.nodeSelector }}
{{ toYaml . | indent 8 }}
{{- end }}
securityContext:
seccompProfile:
type: RuntimeDefault
{{- with .Values.statefulset.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: zigbee2mqtt
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: {{ .Values.zigbee2mqtt.timezone }}
ports:
- containerPort: {{ .Values.zigbee2mqtt.frontend.port }}
name: web
protocol: TCP
livenessProbe:
failureThreshold: 5
httpGet:
path: /
port: web
initialDelaySeconds: 60
timeoutSeconds: 10
periodSeconds: 30
volumeMounts:
- mountPath: /app/data/configuration.yaml
name: config-volume
subPath: configuration.yaml
- mountPath: /app/data/
name: data-volume
resources: {{- toYaml .Values.statefulset.resources | nindent 12 }}
volumes:
- name: config-volume
configMap:
name: {{ include "zigbee2mqtt.fullname" . }}
{{- if not .Values.statefulset.storage.enabled }}
- name: data-volume
emptyDir: { }
{{- end }}
{{- if .Values.statefulset.storage.enabled }}
volumeClaimTemplates:
- metadata:
name: data-volume
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.statefulset.storage.storageClassName }}
{{- if .Values.statefulset.storage.existingVolume }}
volumeName: {{ .Values.statefulset.storage.existingVolume }}
{{- end }}
{{- if or .Values.statefulset.storage.matchLabels (.Values.statefulset.storage.matchExpressions) }}
selector:
{{- if .Values.statefulset.storage.matchLabels }}
matchLabels:
{{ toYaml .Values.statefulset.storage.matchLabels | indent 8 }}
{{- end -}}
{{- if .Values.statefulset.storage.matchExpressions }}
matchExpressions:
{{ toYaml .Values.statefulset.storage.matchExpressions | indent 8 }}
{{- end -}}
{{- end }}
resources:
requests:
storage: {{ .Values.statefulset.storage.size }}
{{- end }}
+201
View File
@@ -0,0 +1,201 @@
# -- override the release name
nameOverride: null
# -- override the name of the objects generated
fullnameOverride: null
customLabels: {}
image:
# -- Image repository for the `zigbee2mqtt` container.
repository: koenkk/zigbee2mqtt
# -- Version for the `zigbee2mqtt` container.
tag: "1.37.1"
# -- Container pull policy
pullPolicy: IfNotPresent
# -- Container additional secrets to pull image
imagePullSecrets: {}
service:
# -- annotations for the service created
annotations: {}
# -- type of Service to be created
type: LoadBalancer
# -- port in which the service will be listening
port: 8080
statefulset:
storage:
enabled: false
size: 1Gi
# -- the name for the storage class to be used in the persistent volume claim
storageClassName: freenas-nfs-csi
existingVolume: ""
## Persistent Volume selectors
## https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector
matchLabels: {}
matchExpressions: {}
# -- pod dns policy
dnsPolicy: ClusterFirst
# -- CPU/Memory configuration for the pods
resources:
requests:
memory: 600Mi
cpu: 200m
limits:
memory: 600Mi
cpu: 200m
# -- Node taint tolerations for the pods
tolerations: {}
# -- Select specific kube node, this will allow enforcing zigbee2mqtt running
# only on the node with the USB adapter connected
nodeSelector: {}
zigbee2mqtt:
homeassistant:
enabled: true
discovery_topic: 'homeassistant'
status_topic: 'hass/status'
legacy_entity_attributes: true
legacy_triggers: false
# -- Optional: allow new devices to join.
permit_join: false
availability:
active:
# -- Time after which an active device will be marked as offline in
# minutes (default = 10 minutes)
timeout: 10
passive:
# -- Time after which a passive device will be marked as offline in
# minutes (default = 1500 minutes aka 25 hours)
timeout: 1500
timezone: UTC
external_converters: []
mqtt:
# -- Required: MQTT server URL (use mqtts:// for SSL/TLS connection)
server: "mqtt://localhost:1883"
# -- Optional: MQTT base topic for Zigbee2MQTT MQTT messages (default: zigbee2mqtt)
# base_topic: zigbee2mqtt
# -- Optional: absolute path to SSL/TLS certificate of CA used to sign server and client certificates (default: nothing)
# ca: '/etc/ssl/mqtt-ca.crt'
# -- Optional: absolute paths to SSL/TLS key and certificate for client-authentication (default: nothing)
# key: '/etc/ssl/mqtt-client.key'
# cert: '/etc/ssl/mqtt-client.crt'
# -- Optional: MQTT server authentication user (default: nothing)
# user: my_user
# -- Optional: MQTT server authentication password (default: nothing)
# password: my_password
# -- Optional: MQTT client ID (default: nothing)
# client_id: 'MY_CLIENT_ID'
# -- Optional: disable self-signed SSL certificates (default: true)
# reject_unauthorized: true
# -- Optional: Include device information to mqtt messages (default: false)
# include_device_information: true
# -- Optional: MQTT keepalive in seconds (default: 60)
# keepalive: 60
# -- Optional: MQTT protocol version (default: 4), set this to 5 if you
# use the 'retention' device specific configuration
# version: 4
# -- Optional: Disable retain for all send messages. ONLY enable if you MQTT broker doesn't
# support retained message (e.g. AWS IoT core, Azure IoT Hub, Google Cloud IoT core, IBM Watson IoT Platform).
# Enabling will break the Home Assistant integration. (default: false)
# force_disable_retain: false
serial:
# -- Required: location of the adapter (e.g. CC2531).
# USB adapters - use format "port: /dev/ttyACM0"
# To autodetect the USB port, set 'port: null'.
# Ethernet adapters - use format "port: tcp://192.168.1.12:6638"
port: "/dev/ttyACM0"
# -- Optional: disable LED of the adapter if supported (default: false)
disable_led: false
# -- Optional: adapter type, not needed unless you are experiencing problems (default: shown below, options: zstack, deconz, ezsp)
# adapter: null
# -- Optional: Baud rate speed for serial port, this can be anything firmware support but default is 115200 for Z-Stack and EZSP, 38400 for Deconz, however note that some EZSP firmware need 57600.
baudrate: 115200
# -- Optional: RTS / CTS Hardware Flow Control for serial port (default: false)
rtscts: false
# -- Optional: OTA update settings
# See https://www.zigbee2mqtt.io/guide/usage/ota_updates.html for more info
ota:
# -- Optional: use IKEA TRADFRI OTA test server, see OTA updates documentation (default: false)
ikea_ota_use_test_url: false
# -- Minimum time between OTA update checks
update_check_interval: 1440
# -- Disable automatic update checks
disable_automatic_update_check: false
frontend:
# -- Mandatory, default 8080
port: 8080
# -- Optional, empty by default to listen on both IPv4 and IPv6. Opens a unix socket when given a path instead of an address (e.g. '/run/zigbee2mqtt/zigbee2mqtt.sock')
# Don't set this if you use Docker or the Home Assistant add-on unless you're sure the chosen IP is available inside the container
host: 0.0.0.0
# -- Optional, enables authentication, disabled by default, cleartext (no hashing required)
auth_token: null
# -- Optional, url on which the frontend can be reached, currently only used for the Home Assistant device configuration page
url: null
advanced:
# -- Optional: ZigBee pan ID (default: shown below)
# Setting pan_id: GENERATE will make Zigbee2MQTT generate a new panID on next startup
# pan_id: null
# Optional: Zigbee extended pan ID, GENERATE will make Zigbee2MQTT generate a new extended panID on next startup (default: shown below)
# ext_pan_id: null
# -- Optional: ZigBee channel, changing requires re-pairing of all devices. (Note: use a ZLL channel: 11, 15, 20, or 25 to avoid Problems)
# (default: 11)
channel: 11
# -- Optional: network encryption key
# GENERATE will make Zigbee2MQTT generate a new network key on next startup
# Note: changing requires repairing of all devices (default: shown below)
# network_key: null
log_output:
- console
log_level: info
timestamp_format: 'YYYY-MM-DD HH:mm:ss'
# -- Optional: state caching, MQTT message payload will contain all attributes, not only changed ones.
# -- Has to be true when integrating via Home Assistant (default: true)
cache_state: true
# -- Optional: persist cached state, only used when cache_state: true (default: true)
cache_state_persistent: true
# -- Optional: send cached state on startup, only used when cache_state_persistent: true (default: true)
cache_state_send_on_startup: true
# -- Optional: Add a last_seen attribute to MQTT messages, contains date/time of last Zigbee message
# possible values are: disable (default), ISO_8601, ISO_8601_local, epoch (default: disable)
last_seen: 'disable'
# -- Optional: Add an elapsed attribute to MQTT messages, contains milliseconds since the previous msg (default: false)
elapsed: false
# -- Optional: Enables report feature, this feature is DEPRECATED since reporting is now setup by default
# when binding devices. Docs can still be found here: https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/information/report.md
report: true
# -- Optional: disables the legacy api (default: shown below)
legacy_api: false
# -- Optional: MQTT output type: json, attribute or attribute_and_json (default: shown below)
# Examples when 'state' of a device is published
# json: topic: 'zigbee2mqtt/my_bulb' payload '{"state": "ON"}'
# attribute: topic 'zigbee2mqtt/my_bulb/state' payload 'ON"
# attribute_and_json:
# -- Optional: configure adapter concurrency (e.g. 2 for CC2531 or 16 for CC26X2R1) (default: null, uses recommended value)
adapter_concurrent: null
# -- Optional: Transmit power setting in dBm (default: 5).
# This will set the transmit power for devices that bring an inbuilt amplifier.
# It can't go over the maximum of the respective hardware and might be limited
# by firmware (for example to migrate heat, or by using an unsupported firmware).
# For the CC2652R(B) this is 5 dBm, CC2652P/CC1352P-2 20 dBm.
transmit_power: 5
# -- Optional: Set the adapter delay, only used for Conbee/Raspbee adapters (default 0).
# In case you are having issues try `200`.
# For more information see https://github.com/Koenkk/zigbee2mqtt/issues/4884
adapter_delay: 0
ingress:
# -- When enabled a new Ingress will be created
enabled: false
# The ingress class name for the ingress
ingressClassName: contour
# Additional labels for the ingres
labels: {}
# URL in which the ingress will be accepting requests for zigbee2mqtt
path: /
# Ingress implementation specific (potentially) for most use cases Prefix should be ok
pathType: Prefix
# Additional annotations for the ingress. ExternalDNS, and CertManager are tipically integrated here
annotations: {}
# configuration for tls service (ig any)
tls:
- secretName: some-tls-secret
hosts:
- yourdomain.com
# list of hosts that should be allowed for the zigbee2mqtt service
hosts:
- yourdomain.com
Executable → Regular
+120 -1
View File
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 25 KiB

+28 -10
View File
@@ -8,6 +8,8 @@ import utils from './util/utils';
import stringify from 'json-stable-stringify-without-jsonify';
import assert from 'assert';
import bind from 'bind-decorator';
import {setLogger as zhcSetLogger} from 'zigbee-herdsman-converters';
import {setLogger as zhSetLogger} from 'zigbee-herdsman';
// Extensions
import ExtensionFrontend from './extension/frontend';
@@ -39,6 +41,14 @@ const AllExtensions = [
type ExtensionArgs = [Zigbee, MQTT, State, PublishEntityState, EventBus,
(enable: boolean, name: string) => Promise<void>, () => void, (extension: Extension) => Promise<void>];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let sdNotify: any = null;
try {
sdNotify = process.env.NOTIFY_SOCKET ? require('sd-notify') : null;
} catch {
// sd-notify is optional
}
export class Controller {
private eventBus: EventBus;
private zigbee: Zigbee;
@@ -51,10 +61,9 @@ export class Controller {
constructor(restartCallback: () => void, exitCallback: (code: number, restart: boolean) => void) {
logger.init();
this.eventBus = new EventBus( /* istanbul ignore next */ (error) => {
logger.error(`Error: ${error.message}`);
logger.debug(error.stack);
});
zhSetLogger(logger);
zhcSetLogger(logger);
this.eventBus = new EventBus();
this.zigbee = new Zigbee(this.eventBus);
this.mqtt = new MQTT(this.eventBus);
this.state = new State(this.eventBus, this.zigbee);
@@ -90,7 +99,6 @@ export class Controller {
async start(): Promise<void> {
this.state.start();
logger.logOutput();
const info = await utils.getZigbee2MQTTVersion();
logger.info(`Starting Zigbee2MQTT version ${info.version} (commit #${info.commitHash})`);
@@ -121,7 +129,7 @@ export class Controller {
const devices = this.zigbee.devices(false);
logger.info(`Currently ${devices.length} devices are joined:`);
for (const device of devices) {
const model = device.definition ?
const model = device.isSupported ?
`${device.definition.model} - ${device.definition.vendor} ${device.definition.description}` :
'Not supported';
logger.info(`${device.name} (${device.ieeeAddr}): ${model} (${device.zh.type})`);
@@ -130,9 +138,9 @@ export class Controller {
// Enable zigbee join
try {
if (settings.get().permit_join) {
logger.warn('`permit_join` set to `true` in configuration.yaml.');
logger.warn('Allowing new devices to join.');
logger.warn('Set `permit_join` to `false` once you joined all devices.');
logger.warning('`permit_join` set to `true` in configuration.yaml.');
logger.warning('Allowing new devices to join.');
logger.warning('Set `permit_join` to `false` once you joined all devices.');
}
await this.zigbee.permitJoin(settings.get().permit_join);
@@ -165,6 +173,12 @@ export class Controller {
(data) => utils.publishLastSeen(data, settings.get(), false, this.publishEntityState));
logger.info(`Zigbee2MQTT started!`);
const watchdogInterval = sdNotify?.watchdogInterval() || 0;
if (watchdogInterval > 0) {
sdNotify.startWatchdogMode(Math.floor(watchdogInterval / 2));
}
sdNotify?.ready();
}
@bind async enableDisableExtension(enable: boolean, name: string): Promise<void> {
@@ -189,6 +203,8 @@ export class Controller {
}
async stop(restart = false): Promise<void> {
sdNotify?.stopping();
// Call extensions
await this.callExtensions('stop', this.extensions);
this.eventBus.removeListeners(this);
@@ -205,6 +221,8 @@ export class Controller {
logger.error('Failed to stop Zigbee2MQTT');
await this.exit(1, restart);
}
sdNotify?.stopWatchdogMode();
}
async exit(code: number, restart = false): Promise<void> {
@@ -241,7 +259,7 @@ export class Controller {
if (entity.isDevice() && settings.get().mqtt.include_device_information) {
message.device = {
friendlyName: entity.name, model: entity.definition ? entity.definition.model : 'unknown',
friendlyName: entity.name, model: entity.definition?.model,
ieeeAddr: entity.ieeeAddr, networkAddress: entity.zh.networkAddress, type: entity.zh.type,
manufacturerID: entity.zh.manufacturerID,
powerSource: entity.zh.powerSource, applicationVersion: entity.zh.applicationVersion,
+23 -9
View File
@@ -1,5 +1,5 @@
import events from 'events';
events.captureRejections = true;
import logger from './util/logger';
// eslint-disable-next-line
type ListenerKey = object;
@@ -8,9 +8,8 @@ export default class EventBus {
private callbacksByExtension: { [s: string]: { event: string, callback: (...args: unknown[]) => void }[] } = {};
private emitter = new events.EventEmitter();
constructor(onError: (error: Error) => void) {
constructor() {
this.emitter.setMaxListeners(100);
this.emitter.on('error', onError);
}
public emitAdapterDisconnected(): void {
@@ -91,6 +90,13 @@ export default class EventBus {
this.on('entityOptionsChanged', callback, key);
}
public emitExposesChanged(data: eventdata.ExposesChanged): void {
this.emitter.emit('exposesChanged', data);
}
public onExposesChanged(key: ListenerKey, callback: (data: eventdata.ExposesChanged) => void): void {
this.on('exposesChanged', callback, key);
}
public emitDeviceLeave(data: eventdata.DeviceLeave): void {
this.emitter.emit('deviceLeave', data);
}
@@ -140,10 +146,10 @@ export default class EventBus {
this.on('devicesChanged', callback, key);
}
public emitScenesChanged(): void {
this.emitter.emit('scenesChanged');
public emitScenesChanged(data: eventdata.ScenesChanged): void {
this.emitter.emit('scenesChanged', data);
}
public onScenesChanged(key: ListenerKey, callback: () => void): void {
public onScenesChanged(key: ListenerKey, callback: (data: eventdata.ScenesChanged) => void): void {
this.on('scenesChanged', callback, key);
}
@@ -161,10 +167,18 @@ export default class EventBus {
this.on('stateChange', callback, key);
}
private on(event: string, callback: (...args: unknown[]) => void, key: ListenerKey): void {
private on(event: string, callback: (...args: unknown[]) => (Promise<void> | void), key: ListenerKey): void {
if (!this.callbacksByExtension[key.constructor.name]) this.callbacksByExtension[key.constructor.name] = [];
this.callbacksByExtension[key.constructor.name].push({event, callback});
this.emitter.on(event, callback);
const wrappedCallback = async (...args: unknown[]): Promise<void> => {
try {
await callback(...args);
} catch (error) {
logger.error(`EventBus error '${key.constructor.name}/${event}': ${error.message}`);
logger.debug(error.stack);
}
};
this.callbacksByExtension[key.constructor.name].push({event, callback: wrappedCallback});
this.emitter.on(event, wrappedCallback);
}
public removeListeners(key: ListenerKey): void {
+22 -4
View File
@@ -4,6 +4,7 @@ import utils from '../util/utils';
import * as settings from '../util/settings';
import debounce from 'debounce';
import bind from 'bind-decorator';
import * as zhc from 'zigbee-herdsman-converters';
const retrieveOnReconnect = [
{keys: ['state']},
@@ -17,6 +18,7 @@ export default class Availability extends Extension {
private retrieveStateDebouncers: {[s: string]: () => void} = {};
private pingQueue: Device[] = [];
private pingQueueExecuting = false;
private stopped = false;
private getTimeout(device: Device): number {
if (typeof device.options.availability === 'object' && device.options.availability?.timeout != null) {
@@ -85,13 +87,18 @@ export default class Availability extends Extension {
logger.debug(`Successfully pinged '${device.name}' (attempt ${i + 1}/${attempts})`);
break;
} catch (error) {
logger.warn(`Failed to ping '${device.name}' (attempt ${i + 1}/${attempts}, ${error.message})`);
logger.warning(`Failed to ping '${device.name}' (attempt ${i + 1}/${attempts}, ${error.message})`);
// Try again in 3 seconds.
const lastAttempt = i - 1 === attempts;
!lastAttempt && await utils.sleep(3);
}
}
if (this.stopped) {
// Exit here to avoid triggering any follow-up activity (e.g., re-queuing another ping attempt).
return;
}
this.publishAvailability(device, !pingedSuccessfully);
this.resetTimer(device);
this.removeFromPingQueue(device);
@@ -103,6 +110,10 @@ export default class Availability extends Extension {
}
override async start(): Promise<void> {
if (this.stopped) {
throw new Error('This extension cannot be restarted.');
}
this.eventBus.onEntityRenamed(this, (data) => {
if (utils.isAvailabilityEnabledForEntity(data.entity, settings.get())) {
this.mqtt.publish(`${data.from}/availability`, null, {retain: true, qos: 1});
@@ -183,8 +194,10 @@ export default class Availability extends Extension {
}
override async stop(): Promise<void> {
this.stopped = true;
this.pingQueue = [];
Object.values(this.timers).forEach((t) => clearTimeout(t));
super.stop();
await super.stop();
}
private retrieveState(device: Device): void {
@@ -199,8 +212,13 @@ export default class Availability extends Extension {
for (const item of retrieveOnReconnect) {
if (item.condition && this.state.get(device) && !item.condition(this.state.get(device))) continue;
const converter = device.definition.toZigbee.find((c) => c.key.find((k) => item.keys.includes(k)));
await converter?.convertGet?.(device.endpoint(), item.keys[0],
{message: this.state.get(device), mapped: device.definition})
const options: KeyValue = device.options;
const state = this.state.get(device);
const meta: zhc.Tz.Meta = {
message: this.state.get(device), mapped: device.definition, endpoint_name: null,
options, state, device: device.zh,
};
await converter?.convertGet?.(device.endpoint(), item.keys[0], meta)
.catch((e) => {
logger.error(`Failed to read state of '${device.name}' after reconnect (${e.message})`);
});
+30 -27
View File
@@ -4,7 +4,7 @@ import utils from '../util/utils';
import Extension from './extension';
import stringify from 'json-stable-stringify-without-jsonify';
import debounce from 'debounce';
import * as zigbeeHerdsman from 'zigbee-herdsman/dist';
import {Zcl} from 'zigbee-herdsman';
import bind from 'bind-decorator';
import Device from '../model/device';
import Group from '../model/group';
@@ -97,12 +97,12 @@ const pollOnMessage: PollOnMessage = [
read: {cluster: 'genLevelCtrl', attributes: ['currentLevel']},
// When the bound devices/members of group have the following manufacturerIDs
manufacturerIDs: [
zigbeeHerdsman.Zcl.ManufacturerCode.Philips,
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK,
zigbeeHerdsman.Zcl.ManufacturerCode.BUSCH_JAEGER,
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
Zcl.ManufacturerCode.ATMEL,
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
Zcl.ManufacturerCode.TELINK_MICRO,
Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
],
manufacturerNames: [
'GLEDOPTO',
@@ -133,12 +133,12 @@ const pollOnMessage: PollOnMessage = [
},
read: {cluster: 'genOnOff', attributes: ['onOff']},
manufacturerIDs: [
zigbeeHerdsman.Zcl.ManufacturerCode.Philips,
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK,
zigbeeHerdsman.Zcl.ManufacturerCode.BUSCH_JAEGER,
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
Zcl.ManufacturerCode.ATMEL,
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
Zcl.ManufacturerCode.TELINK_MICRO,
Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
],
manufacturerNames: [
'GLEDOPTO',
@@ -165,11 +165,11 @@ const pollOnMessage: PollOnMessage = [
},
},
manufacturerIDs: [
zigbeeHerdsman.Zcl.ManufacturerCode.Philips,
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK,
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
Zcl.ManufacturerCode.ATMEL,
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
Zcl.ManufacturerCode.TELINK_MICRO,
// Note: ManufacturerCode.BUSCH_JAEGER is left out intentionally here as their devices don't support colors
],
manufacturerNames: [
@@ -222,25 +222,28 @@ export default class Bind extends Extension {
const message = utils.parseJSON(data.message, data.message);
let error = null;
const parsedSource = utils.parseEntityID(sourceKey);
const parsedTarget = utils.parseEntityID(targetKey);
const source = this.zigbee.resolveEntity(parsedSource.ID);
const target = targetKey === 'default_bind_group' ?
defaultBindGroup : this.zigbee.resolveEntity(parsedTarget.ID);
const parsedSource = this.zigbee.resolveEntityAndEndpoint(sourceKey);
const parsedTarget = this.zigbee.resolveEntityAndEndpoint(targetKey);
const source = parsedSource.entity;
const target = targetKey === 'default_bind_group' ? defaultBindGroup : parsedTarget.entity;
const responseData: KeyValue = {from: sourceKey, to: targetKey};
if (!source || !(source instanceof Device)) {
error = `Source device '${sourceKey}' does not exist`;
} else if (parsedSource.endpointID && !parsedSource.endpoint) {
error = `Source device '${parsedSource.ID}' does not have endpoint '${parsedSource.endpointID}'`;
} else if (!target) {
error = `Target device or group '${targetKey}' does not exist`;
} else if (target instanceof Device && parsedTarget.endpointID && !parsedTarget.endpoint) {
error = `Target device '${parsedTarget.ID}' does not have endpoint '${parsedTarget.endpointID}'`;
} else {
const successfulClusters: string[] = [];
const failedClusters = [];
const attemptedClusters = [];
const bindSource: zh.Endpoint = source.endpoint(parsedSource.endpoint);
const bindSource: zh.Endpoint = parsedSource.endpoint;
let bindTarget: number | zh.Group | zh.Endpoint = null;
if (target instanceof Device) bindTarget = target.endpoint(parsedTarget.endpoint);
if (target instanceof Device) bindTarget = parsedTarget.endpoint;
else if (target instanceof Group) bindTarget = target.zh;
else bindTarget = Number(target.ID);
@@ -391,7 +394,7 @@ export default class Bind extends Extension {
await endpoint.configureReporting(bind.cluster.name, items);
logger.info(`Successfully setup reporting for '${entity}' cluster '${bind.cluster.name}'`);
} catch (error) {
logger.warn(`Failed to setup reporting for '${entity}' cluster '${bind.cluster.name}'`);
logger.warning(`Failed to setup reporting for '${entity}' cluster '${bind.cluster.name}'`);
}
}
}
@@ -433,7 +436,7 @@ export default class Bind extends Extension {
await endpoint.configureReporting(cluster, items);
logger.info(`Successfully disabled reporting for '${entity}' cluster '${cluster}'`);
} catch (error) {
logger.warn(`Failed to disable reporting for '${entity}' cluster '${cluster}'`);
logger.warning(`Failed to disable reporting for '${entity}' cluster '${cluster}'`);
}
}
+79 -40
View File
@@ -12,13 +12,14 @@ import Group from '../model/group';
import data from '../util/data';
import JSZip from 'jszip';
import fs from 'fs';
import * as zhc from 'zigbee-herdsman-converters';
import winston from 'winston';
const requestRegex = new RegExp(`${settings.get().mqtt.base_topic}/bridge/request/(.*)`);
type Scene = {id: number, name: string};
type DefinitionPayload = {
model: string, vendor: string, description: string, exposes: zhc.DefinitionExpose[], supports_ota:
boolean, icon: string, options: zhc.DefinitionExpose[],
model: string, vendor: string, description: string, exposes: zhc.Expose[], supports_ota:
boolean, icon: string, options: zhc.Expose[],
};
export default class Bridge extends Extension {
@@ -28,6 +29,8 @@ export default class Bridge extends Extension {
private coordinatorVersion: zh.CoordinatorVersion;
private restartRequired = false;
private lastJoinedDeviceIeeeAddr: string;
private lastBridgeLoggingPayload: string;
private logTransport: winston.transport;
private requestLookup: {[key: string]: (message: KeyValue | string) => Promise<MQTTResponse>};
override async start(): Promise<void> {
@@ -35,6 +38,7 @@ export default class Bridge extends Extension {
'device/options': this.deviceOptions,
'device/configure_reporting': this.deviceConfigureReporting,
'device/remove': this.deviceRemove,
'device/generate_external_definition': this.deviceGenerateExternalDefinition,
'device/rename': this.deviceRename,
'group/add': this.groupAdd,
'group/options': this.groupOptions,
@@ -57,16 +61,41 @@ export default class Bridge extends Extension {
'config/log_level': this.configLogLevel,
};
const mqtt = this.mqtt;
class EventTransport extends Transport {
log(info: {message: string, level: string}, callback: () => void): void {
const payload = stringify({message: info.message, level: info.level});
mqtt.publish(`bridge/logging`, payload, {}, settings.get().mqtt.base_topic, true);
callback();
const debugToMQTTFrontend = settings.get().advanced.log_debug_to_mqtt_frontend;
const baseTopic = settings.get().mqtt.base_topic;
const bridgeLogging = (message: string, level: string, namespace: string): void => {
const payload = stringify({message, level, namespace});
if (payload !== this.lastBridgeLoggingPayload) {
this.lastBridgeLoggingPayload = payload;
this.mqtt.publish(`bridge/logging`, payload, {}, baseTopic, true);
}
};
if (debugToMQTTFrontend) {
class DebugEventTransport extends Transport {
log(info: {message: string, level: string, namespace: string}, next: () => void): void {
bridgeLogging(info.message, info.level, info.namespace);
next();
}
}
this.logTransport = new DebugEventTransport();
} else {
class EventTransport extends Transport {
log(info: {message: string, level: string, namespace: string}, next: () => void): void {
if (info.level !== 'debug') {
bridgeLogging(info.message, info.level, info.namespace);
}
next();
}
}
this.logTransport = new EventTransport();
}
logger.addTransport(new EventTransport());
logger.addTransport(this.logTransport);
this.zigbee2mqttVersion = await utils.getZigbee2MQTTVersion();
this.zigbeeHerdsmanVersion = await utils.getDependencyVersion('zigbee-herdsman');
@@ -100,7 +129,7 @@ export default class Bridge extends Extension {
const payload: KeyValue =
{friendly_name: data.device.name, status: data.status, ieee_address: data.device.ieeeAddr};
if (data.status === 'successful') {
payload.supported = !!data.device.definition;
payload.supported = data.device.isSupported;
payload.definition = this.getDefinitionPayload(data.device);
}
publishEvent('device_interview', payload);
@@ -117,6 +146,11 @@ export default class Bridge extends Extension {
this.eventBus.onMQTTMessage(this, this.onMQTTMessage);
}
override async stop(): Promise<void> {
super.stop();
logger.removeTransport(this.logTransport);
}
@bind async onMQTTMessage(data: eventdata.MQTTMessage): Promise<void> {
const match = data.topic.match(requestRegex);
const key = match?.[1]?.toLowerCase();
@@ -157,18 +191,22 @@ export default class Bridge extends Extension {
if (restartRequired) this.restartRequired = true;
// Apply some settings on-the-fly.
if (newSettings.hasOwnProperty('permit_join')) {
if (newSettings.permit_join != undefined) {
await this.zigbee.permitJoin(newSettings.permit_join);
}
if (newSettings.hasOwnProperty('homeassistant')) {
if (newSettings.homeassistant != undefined) {
await this.enableDisableExtension(newSettings.homeassistant, 'HomeAssistant');
}
if (newSettings.hasOwnProperty('advanced') && newSettings.advanced.hasOwnProperty('log_level')) {
if (newSettings.advanced?.log_level != undefined) {
logger.setLevel(newSettings.advanced.log_level);
}
if (newSettings.advanced?.log_debug_namespace_ignore != undefined) {
logger.setDebugNamespaceIgnore(newSettings.advanced.log_debug_namespace_ignore);
}
logger.info('Successfully changed options');
this.publishInfo();
return utils.getResponse(message, {restart_required: this.restartRequired}, null);
@@ -429,8 +467,13 @@ export default class Bridge extends Extension {
throw new Error(`Invalid payload`);
}
const parsedID = utils.parseEntityID(message.id);
const endpoint = (this.getEntity('device', parsedID.ID) as Device).endpoint(parsedID.endpoint);
const device = this.zigbee.resolveEntityAndEndpoint(message.id);
if (!device.entity) throw new Error(`Device '${message.id}' does not exist`);
const endpoint = device.endpoint;
if (device.endpointID && !endpoint) {
throw new Error(`Device '${device.ID}' does not have endpoint '${device.endpointID}'`);
}
const coordinatorEndpoint = this.zigbee.firstCoordinatorEndpoint();
await endpoint.bind(message.cluster, coordinatorEndpoint);
@@ -451,6 +494,19 @@ export default class Bridge extends Extension {
}, null);
}
@bind async deviceGenerateExternalDefinition(message: string | KeyValue): Promise<MQTTResponse> {
if (typeof message !== 'object' || !message.hasOwnProperty('id')) {
throw new Error(`Invalid payload`);
}
const device = this.zigbee.resolveEntityAndEndpoint(message.id).entity as Device;
if (!device) throw new Error(`Device '${message.id}' does not exist`);
const source = await zhc.generateExternalDefinitionSource(device.zh);
return utils.getResponse(message, {id: message.id, source}, null);
}
async renameEntity(entityType: 'group' | 'device', message: string | KeyValue): Promise<MQTTResponse> {
const deviceAndHasLast = entityType === 'device' && typeof message === 'object' && message.last === true;
if (typeof message !== 'object' || (!message.hasOwnProperty('from') && !deviceAndHasLast) ||
@@ -523,7 +579,7 @@ export default class Bridge extends Extension {
}
if (force) {
await entity.zh.removeFromDatabase();
entity.zh.removeFromDatabase();
} else {
await entity.zh.removeFromNetwork();
}
@@ -605,25 +661,6 @@ export default class Bridge extends Extension {
'bridge/info', stringify(payload), {retain: true, qos: 0}, settings.get().mqtt.base_topic, true);
}
private getScenes(entity: zh.Endpoint | zh.Group): Scene[] {
const scenes: {[id: number]: Scene} = {};
const endpoints = utils.isEndpoint(entity) ? [entity] : entity.members;
const groupID = utils.isEndpoint(entity) ? 0 : entity.groupID;
for (const endpoint of endpoints) {
for (const [key, data] of Object.entries(endpoint.meta?.scenes || {})) {
const split = key.split('_');
const sceneID = parseInt(split[0], 10);
const sceneGroupID = parseInt(split[1], 10);
if (sceneGroupID === groupID) {
scenes[sceneID] = {id: sceneID, name: (data as KeyValue).name || `Scene ${sceneID}`};
}
}
}
return Object.values(scenes);
}
async publishDevices(): Promise<void> {
interface Data {
bindings: {cluster: string, target: {type: string, endpoint?: number, ieee_address?: string, id?: number}}[]
@@ -636,7 +673,7 @@ export default class Bridge extends Extension {
const endpoints: {[s: number]: Data} = {};
for (const endpoint of device.zh.endpoints) {
const data: Data = {
scenes: this.getScenes(endpoint),
scenes: utils.getScenes(endpoint),
bindings: [],
configured_reportings: [],
clusters: {
@@ -669,7 +706,7 @@ export default class Bridge extends Extension {
ieee_address: device.ieeeAddr,
type: device.zh.type,
network_address: device.zh.networkAddress,
supported: !!device.definition,
supported: device.isSupported,
friendly_name: device.name,
disabled: !!device.options.disabled,
description: device.options.description,
@@ -695,7 +732,7 @@ export default class Bridge extends Extension {
id: g.ID,
friendly_name: g.ID === 901 ? 'default_bind_group' : g.name,
description: g.options.description,
scenes: this.getScenes(g.zh),
scenes: utils.getScenes(g.zh),
members: g.zh.members.map((e) => {
return {ieee_address: e.getDevice().ieeeAddr, endpoint: e.ID};
}),
@@ -707,7 +744,9 @@ export default class Bridge extends Extension {
getDefinitionPayload(device: Device): DefinitionPayload {
if (!device.definition) return null;
let icon = device.options.icon ? device.options.icon : device.definition.icon;
// @ts-expect-error icon is valid for external definitions
const definitionIcon = device.definition.icon;
let icon = device.options.icon ?? definitionIcon;
if (icon) {
icon = icon.replace('${zigbeeModel}', utils.sanitizeImageParameter(device.zh.modelID));
icon = icon.replace('${model}', utils.sanitizeImageParameter(device.definition.model));
+12 -9
View File
@@ -2,7 +2,7 @@ import * as settings from '../util/settings';
import utils from '../util/utils';
import logger from '../util/logger';
import stringify from 'json-stable-stringify-without-jsonify';
import zhc from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
import Extension from './extension';
import bind from 'bind-decorator';
import Device from '../model/device';
@@ -35,7 +35,7 @@ export default class Configure extends Extension {
}
if (!device.definition || !device.definition.configure) {
logger.warn(`Skipping configure of '${device.name}', device does not require this.`);
logger.warning(`Skipping configure of '${device.name}', device does not require this.`);
return;
}
@@ -65,7 +65,12 @@ export default class Configure extends Extension {
override async start(): Promise<void> {
setImmediate(async () => {
for (const device of this.zigbee.devices(false)) {
// Only configure routers on startup, end devices are likely sleeping and
// will reconfigure once they send a message
for (const device of this.zigbee.devices(false).filter((d) => d.zh.type === 'Router')) {
// Sleep 10 seconds between configuring on startup to not DDoS the coordinator
// when many devices have to be configured.
await utils.sleep(10);
await this.configure(device, 'started');
}
});
@@ -91,8 +96,7 @@ export default class Configure extends Extension {
return;
}
if (device.zh.meta?.hasOwnProperty('configured') &&
device.zh.meta.configured === zhc.getConfigureKey(device.definition)) {
if (device.zh.meta?.hasOwnProperty('configured')) {
return;
}
@@ -114,8 +118,7 @@ export default class Configure extends Extension {
logger.info(`Configuring '${device.name}'`);
try {
await device.definition.configure(device.zh, this.zigbee.firstCoordinatorEndpoint(), logger,
device.options);
await device.definition.configure(device.zh, this.zigbee.firstCoordinatorEndpoint(), device.definition);
logger.info(`Successfully configured '${device.name}'`);
device.zh.meta.configured = zhc.getConfigureKey(device.definition);
device.zh.save();
@@ -129,8 +132,8 @@ export default class Configure extends Extension {
if (throwError) {
throw error;
}
} finally {
this.configuring.delete(device.ieeeAddr);
}
this.configuring.delete(device.ieeeAddr);
}
}
+20 -6
View File
@@ -1,7 +1,8 @@
import zhc from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
import * as settings from '../util/settings';
import utils from '../util/utils';
import {loadExternalConverter} from '../util/utils';
import Extension from './extension';
import logger from '../util/logger';
export default class ExternalConverters extends Extension {
constructor(zigbee: Zigbee, mqtt: MQTT, state: State, publishEntityState: PublishEntityState,
@@ -9,10 +10,23 @@ export default class ExternalConverters extends Extension {
restartCallback: () => void, addExtension: (extension: Extension) => Promise<void>) {
super(zigbee, mqtt, state, publishEntityState, eventBus, enableDisableExtension, restartCallback, addExtension);
for (const definition of utils.getExternalConvertersDefinitions(settings.get())) {
const toAdd = {...definition};
delete toAdd['homeassistant'];
zhc.addDeviceDefinition(toAdd);
for (const file of settings.get().external_converters) {
try {
for (const definition of loadExternalConverter(file)) {
const toAdd = {...definition};
delete toAdd['homeassistant'];
zhc.addDefinition(toAdd);
}
} catch (error) {
logger.error(`Failed to load external converter file '${file}' (${error.message})`);
logger.error(
`Probably there is a syntax error in the file or the external converter is not ` +
`compatible with the current Zigbee2MQTT version`);
logger.error(
`Note that external converters are not meant for long term usage, it's meant for local ` +
`testing after which a pull request should be created to add out-of-the-box support for the device`,
);
}
}
}
}
+4 -1
View File
@@ -74,7 +74,10 @@ export default class Frontend extends Extension {
this.wss = new WebSocket.Server({noServer: true});
this.wss.on('connection', this.onWebSocketConnection);
if (this.host.startsWith('/')) {
if (!this.host) {
this.server.listen(this.port);
logger.info(`Started frontend on port ${this.port}`);
} else if (this.host.startsWith('/')) {
this.server.listen(this.host);
logger.info(`Started frontend on socket ${this.host}`);
} else {
+24 -11
View File
@@ -7,13 +7,14 @@ import bind from 'bind-decorator';
import Extension from './extension';
import Device from '../model/device';
import Group from '../model/group';
import * as zhc from 'zigbee-herdsman-converters';
const topicRegex =
new RegExp(`^${settings.get().mqtt.base_topic}/bridge/request/group/members/(remove|add|remove_all)$`);
const legacyTopicRegex = new RegExp(`^${settings.get().mqtt.base_topic}/bridge/group/(.+)/(remove|add|remove_all)$`);
const legacyTopicRegexRemoveAll = new RegExp(`^${settings.get().mqtt.base_topic}/bridge/group/remove_all$`);
const stateProperties: {[s: string]: (value: string, exposes: zhc.DefinitionExpose[]) => boolean} = {
const stateProperties: {[s: string]: (value: string, exposes: zhc.Expose[]) => boolean} = {
'state': () => true,
'brightness': (value, exposes) =>
!!exposes.find((e) => e.type === 'light' && e.features.find((f) => f.name === 'brightness')),
@@ -67,10 +68,13 @@ export default class Groups extends Extension {
const groupID = settingGroup.ID;
const zigbeeGroup = zigbeeGroups.find((g) => g.ID === groupID) || this.zigbee.createGroup(groupID);
const settingsEndpoint = settingGroup.devices.map((d) => {
const parsed = utils.parseEntityID(d);
const entity = this.zigbee.resolveEntity(parsed.ID) as Device;
const parsed = this.zigbee.resolveEntityAndEndpoint(d);
const entity = parsed.entity as Device;
if (!entity) logger.error(`Cannot find '${d}' of group '${settingGroup.friendly_name}'`);
return {'endpoint': entity?.endpoint(parsed.endpoint), 'name': entity?.name};
if (parsed.endpointID && !parsed.endpoint) {
logger.error(`Cannot find endpoint '${parsed.endpointID}' of device '${parsed.ID}'`);
}
return {'endpoint': parsed.endpoint, 'name': entity?.name};
}).filter((e) => e.endpoint != null);
// In settings but not in zigbee
@@ -108,8 +112,9 @@ export default class Groups extends Extension {
const payload: KeyValue = {};
let endpointName: string = null;
const endpointNames: string[] = data.entity instanceof Device ? data.entity.getEndpointNames() : [];
for (let [prop, value] of Object.entries(data.update)) {
const endpointNameMatch = utils.endpointNames.find((n) => prop.endsWith(`_${n}`));
const endpointNameMatch = endpointNames.find((n) => prop.endsWith(`_${n}`));
if (endpointNameMatch) {
prop = prop.substring(0, prop.length - endpointNameMatch.length - 1);
endpointName = endpointNameMatch;
@@ -236,8 +241,8 @@ export default class Groups extends Extension {
type = 'remove_all';
}
const parsedEntity = utils.parseEntityID(data.message);
resolvedEntityDevice = this.zigbee.resolveEntity(parsedEntity.ID) as Device;
const parsedEntity = this.zigbee.resolveEntityAndEndpoint(data.message);
resolvedEntityDevice = parsedEntity.entity as Device;
if (!resolvedEntityDevice || !(resolvedEntityDevice instanceof Device)) {
logger.error(`Device '${data.message}' does not exist`);
@@ -254,7 +259,12 @@ export default class Groups extends Extension {
return null;
}
resolvedEntityEndpoint = resolvedEntityDevice.endpoint(parsedEntity.endpoint);
resolvedEntityEndpoint = parsedEntity.endpoint;
if (parsedEntity.endpointID && !resolvedEntityEndpoint) {
logger.error(`Device '${parsedEntity.ID}' does not have endpoint '${parsedEntity.endpointID}'`);
return null;
}
} else if (topicRegexMatch) {
type = topicRegexMatch[1] as 'remove' | 'add' | 'remove_all';
const message = JSON.parse(data.message);
@@ -269,13 +279,16 @@ export default class Groups extends Extension {
}
}
const parsed = utils.parseEntityID(message.device);
resolvedEntityDevice = this.zigbee.resolveEntity(parsed.ID) as Device;
const parsed = this.zigbee.resolveEntityAndEndpoint(message.device);
resolvedEntityDevice = parsed?.entity as Device;
if (!error && (!resolvedEntityDevice || !(resolvedEntityDevice instanceof Device))) {
error = `Device '${message.device}' does not exist`;
}
if (!error) {
resolvedEntityEndpoint = resolvedEntityDevice.endpoint(parsed.endpoint);
resolvedEntityEndpoint = parsed.endpoint;
if (parsed.endpointID && !resolvedEntityEndpoint) {
error = `Device '${parsed.ID}' does not have endpoint '${parsed.endpointID}'`;
}
}
}
+449 -79
View File
@@ -1,10 +1,11 @@
import * as settings from '../util/settings';
import logger from '../util/logger';
import utils from '../util/utils';
import utils, {isNumericExposeFeature, isBinaryExposeFeature, isEnumExposeFeature} from '../util/utils';
import stringify from 'json-stable-stringify-without-jsonify';
import assert from 'assert';
import Extension from './extension';
import bind from 'bind-decorator';
import * as zhc from 'zigbee-herdsman-converters';
interface MockProperty {property: string, value: KeyValue | string}
@@ -52,7 +53,7 @@ const legacyMapping = [
},
];
const featurePropertyWithoutEndpoint = (feature: zhc.DefinitionExposeFeature): string => {
const featurePropertyWithoutEndpoint = (feature: zhc.Feature): string => {
if (feature.endpoint) {
return feature.property.slice(0, -1 + -1 * feature.endpoint.length);
} else {
@@ -60,6 +61,47 @@ const featurePropertyWithoutEndpoint = (feature: zhc.DefinitionExposeFeature): s
}
};
/**
* This class handles the bridge entity configuration for Home Assistant Discovery.
*/
class Bridge {
private coordinatorIeeeAddress: string;
private coordinatorType: string;
private coordinatorFirmwareVersion: string;
private discoveryEntries: DiscoveryEntry[];
readonly options: {
ID?: string,
homeassistant?: KeyValue,
};
/* eslint-disable brace-style */
get ID(): string {return this.coordinatorIeeeAddress;}
get name(): string {return 'bridge';}
get hardwareVersion(): string {return this.coordinatorType;}
get firmwareVersion(): string {return this.coordinatorFirmwareVersion;}
get configs(): DiscoveryEntry[] {return this.discoveryEntries;}
constructor(ieeeAdress: string, version: zh.CoordinatorVersion, discovery: DiscoveryEntry[]) {
this.coordinatorIeeeAddress = ieeeAdress;
this.coordinatorType = version.type;
/* istanbul ignore next */
this.coordinatorFirmwareVersion = version.meta.revision ? `${version.meta.revision}` : '';
this.discoveryEntries = discovery;
this.options = {
ID: `bridge_${ieeeAdress}`,
homeassistant: {
name: `Zigbee2MQTT Bridge`,
},
};
}
isDevice(): this is Device {return false;}
isGroup(): this is Group {return false;}
/* eslint-enable brace-style */
}
/**
* This extensions handles integration with HomeAssistant
*/
@@ -72,6 +114,8 @@ export default class HomeAssistant extends Extension {
private entityAttributes = settings.get().homeassistant.legacy_entity_attributes;
private zigbee2MQTTVersion: string;
private discoveryOrigin: {name: string, sw: string, url: string};
private bridge: Bridge;
private bridgeIdentifier: string;
constructor(zigbee: Zigbee, mqtt: MQTT, state: State, publishEntityState: PublishEntityState,
eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>,
@@ -84,12 +128,13 @@ export default class HomeAssistant extends Extension {
override async start(): Promise<void> {
if (!settings.get().advanced.cache_state) {
logger.warn('In order for Home Assistant integration to work properly set `cache_state: true');
logger.warning('In order for Home Assistant integration to work properly set `cache_state: true');
}
this.zigbee2MQTTVersion = (await utils.getZigbee2MQTTVersion(false)).version;
this.discoveryOrigin = {name: 'Zigbee2MQTT', sw: this.zigbee2MQTTVersion, url: 'https://www.zigbee2mqtt.io'};
this.bridge = this.getBridgeEntity(await this.zigbee.getCoordinatorVersion());
this.bridgeIdentifier = this.getDevicePayload(this.bridge).identifiers[0];
this.eventBus.onDeviceRemoved(this, this.onDeviceRemoved);
this.eventBus.onMQTTMessage(this, this.onMQTTMessage);
this.eventBus.onEntityRenamed(this, this.onEntityRenamed);
@@ -99,14 +144,16 @@ export default class HomeAssistant extends Extension {
this.eventBus.onDeviceJoined(this, this.onZigbeeEvent);
this.eventBus.onDeviceInterview(this, this.onZigbeeEvent);
this.eventBus.onDeviceMessage(this, this.onZigbeeEvent);
this.eventBus.onScenesChanged(this, this.onScenesChanged);
this.eventBus.onEntityOptionsChanged(this, (data) => this.discover(data.entity, true));
this.eventBus.onExposesChanged(this, (data) => this.discover(data.device, true));
this.mqtt.subscribe(this.statusTopic);
this.mqtt.subscribe(defaultStatusTopic);
this.mqtt.subscribe(`${this.discoveryTopic}/#`);
// MQTT discovery of all paired devices on startup.
for (const entity of [...this.zigbee.devices(false), ...this.zigbee.groups()]) {
for (const entity of [this.bridge, ...this.zigbee.devices(false), ...this.zigbee.groups()]) {
this.discover(entity, true);
}
@@ -114,8 +161,8 @@ export default class HomeAssistant extends Extension {
this.eventBus.emitPublishAvailability();
}
private exposeToConfig(exposes: zhc.DefinitionExpose[], entityType: 'device' | 'group',
allExposes: zhc.DefinitionExpose[], definition?: zhc.Definition): DiscoveryEntry[] {
private exposeToConfig(exposes: zhc.Expose[], entityType: 'device' | 'group',
allExposes: zhc.Expose[], definition?: zhc.Definition): DiscoveryEntry[] {
// For groups an array of exposes (of the same type) is passed, this is to determine e.g. what features
// to use for a bulb (e.g. color_xy/color_temp)
assert(entityType === 'group' || exposes.length === 1, 'Multiple exposes for device not allowed');
@@ -125,7 +172,7 @@ export default class HomeAssistant extends Extension {
const discoveryEntries: DiscoveryEntry[] = [];
const endpoint = entityType === 'device' ? exposes[0].endpoint : undefined;
const getProperty = (feature: zhc.DefinitionExposeFeature): string => entityType === 'group' ?
const getProperty = (feature: zhc.Feature): string => entityType === 'group' ?
featurePropertyWithoutEndpoint(feature) : feature.property;
/* istanbul ignore else */
@@ -163,13 +210,12 @@ export default class HomeAssistant extends Extension {
].filter((c) => c);
if (colorModes.length) {
discoveryEntry.discovery_payload.color_mode = true;
discoveryEntry.discovery_payload.supported_color_modes = colorModes;
}
if (hasColorTemp) {
const colorTemps = exposes.map((expose) => expose.features.find((e) => e.name === 'color_temp'))
.filter((e) => e);
.filter((e) => e).filter(isNumericExposeFeature);
const max = Math.min(...colorTemps.map((e) => e.value_max));
const min = Math.max(...colorTemps.map((e) => e.value_min));
discoveryEntry.discovery_payload.max_mireds = max;
@@ -177,7 +223,7 @@ export default class HomeAssistant extends Extension {
}
const effects = utils.arrayUnique(utils.flatten(
allExposes.filter((e) => e.type === 'enum' && e.name === 'effect').map((e) => e.values)));
allExposes.filter(isEnumExposeFeature).filter((e) => e.name === 'effect').map((e) => e.values)));
if (effects.length) {
discoveryEntry.discovery_payload.effect = true;
discoveryEntry.discovery_payload.effect_list = effects;
@@ -185,7 +231,7 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'switch') {
const state = firstExpose.features.find((f) => f.name === 'state');
const state = firstExpose.features.filter(isBinaryExposeFeature).find((f) => f.name === 'state');
const property = getProperty(state);
const discoveryEntry: DiscoveryEntry = {
type: 'switch',
@@ -217,7 +263,8 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'climate') {
const setpointProperties = ['occupied_heating_setpoint', 'current_heating_setpoint'];
const setpoint = firstExpose.features.find((f) => setpointProperties.includes(f.name));
const setpoint = firstExpose.features.filter(isNumericExposeFeature)
.find((f) => setpointProperties.includes(f.name));
assert(setpoint, 'No setpoint found');
const temperature = firstExpose.features.find((f) => f.name === 'local_temperature');
assert(temperature, 'No temperature found');
@@ -242,7 +289,7 @@ export default class HomeAssistant extends Extension {
},
};
const mode = firstExpose.features.find((f) => f.name === 'system_mode');
const mode = firstExpose.features.filter(isEnumExposeFeature).find((f) => f.name === 'system_mode');
if (mode) {
if (mode.values.includes('sleep')) {
// 'sleep' is not supported by Home Assistant, but is valid according to ZCL
@@ -261,7 +308,7 @@ export default class HomeAssistant extends Extension {
discoveryEntry.mockProperties.push({property: state.property, value: null});
discoveryEntry.discovery_payload.action_topic = true;
discoveryEntry.discovery_payload.action_template = `{% set values = ` +
`{None:None,'idle':'off','heat':'heating','cool':'cooling','fan_only':'fan'}` +
`{None:None,'idle':'idle','heat':'heating','cool':'cooling','fan_only':'fan'}` +
` %}{{ values[value_json.${state.property}] }}`;
}
@@ -282,7 +329,8 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.temperature_state_topic = true;
}
const fanMode = firstExpose.features.find((f) => f.name === 'fan_mode');
const fanMode = firstExpose.features.filter(isEnumExposeFeature)
.find((f) => f.name === 'fan_mode');
if (fanMode) {
discoveryEntry.discovery_payload.fan_modes = fanMode.values;
discoveryEntry.discovery_payload.fan_mode_command_topic = true;
@@ -291,7 +339,8 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.fan_mode_state_topic = true;
}
const swingMode = firstExpose.features.find((f) => f.name === 'swing_mode');
const swingMode = firstExpose.features.filter(isEnumExposeFeature)
.find((f) => f.name === 'swing_mode');
if (swingMode) {
discoveryEntry.discovery_payload.swing_modes = swingMode.values;
discoveryEntry.discovery_payload.swing_mode_command_topic = true;
@@ -300,7 +349,7 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.swing_mode_state_topic = true;
}
const preset = firstExpose.features.find((f) => f.name === 'preset');
const preset = firstExpose.features.filter(isEnumExposeFeature).find((f) => f.name === 'preset');
if (preset) {
discoveryEntry.discovery_payload.preset_modes = preset.values;
discoveryEntry.discovery_payload.preset_mode_command_topic = 'preset';
@@ -309,7 +358,8 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.preset_mode_state_topic = true;
}
const tempCalibration = firstExpose.features.find((f) => f.name === 'local_temperature_calibration');
const tempCalibration = firstExpose.features.filter(isNumericExposeFeature)
.find((f) => f.name === 'local_temperature_calibration');
if (tempCalibration) {
const discoveryEntry: DiscoveryEntry = {
type: 'number',
@@ -336,7 +386,8 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
}
const piHeatingDemand = firstExpose.features.find((f) => f.name === 'pi_heating_demand');
const piHeatingDemand = firstExpose.features.filter(isNumericExposeFeature)
.find((f) => f.name === 'pi_heating_demand');
if (piHeatingDemand) {
const discoveryEntry: DiscoveryEntry = {
type: 'sensor',
@@ -357,7 +408,7 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'lock') {
assert(!endpoint, `Endpoint not supported for lock type`);
const state = firstExpose.features.find((f) => f.name === 'state');
const state = firstExpose.features.filter(isBinaryExposeFeature).find((f) => f.name === 'state');
assert(state, 'No state found');
const discoveryEntry: DiscoveryEntry = {
type: 'lock',
@@ -403,8 +454,8 @@ export default class HomeAssistant extends Extension {
?.features.find((f) => f.name === 'position');
const tilt = exposes.find((expose) => expose.features.find((e) => e.name === 'tilt'))
?.features.find((f) => f.name === 'tilt');
const motorState = allExposes?.find((e) => e.type === 'enum' &&
['motor_state', 'moving'].includes(e.name) && e.access === ACCESS_STATE);
const motorState = allExposes?.filter(isEnumExposeFeature)
.find((e) => ['motor_state', 'moving'].includes(e.name) && e.access === ACCESS_STATE);
const running = allExposes?.find((e) => e.type === 'binary' && e.name === 'running');
const discoveryEntry: DiscoveryEntry = {
@@ -435,9 +486,9 @@ export default class HomeAssistant extends Extension {
const closingLookup = ['closing', 'close', 'backward', 'back', 'reverse', 'down', 'declining'];
const stoppedLookup = ['stopped', 'stop', 'pause', 'paused'];
const openingState = motorState.values.find((s) => openingLookup.includes(s.toLowerCase()));
const closingState = motorState.values.find((s) => closingLookup.includes(s.toLowerCase()));
const stoppedState = motorState.values.find((s) => stoppedLookup.includes(s.toLowerCase()));
const openingState = motorState.values.find((s) => openingLookup.includes(s.toString().toLowerCase()));
const closingState = motorState.values.find((s) => closingLookup.includes(s.toString().toLowerCase()));
const stoppedState = motorState.values.find((s) => stoppedLookup.includes(s.toString().toLowerCase()));
if (openingState && closingState && stoppedState) {
discoveryEntry.discovery_payload.state_opening = openingState;
@@ -495,7 +546,7 @@ export default class HomeAssistant extends Extension {
},
};
const speed = firstExpose.features.find((e) => e.name === 'mode');
const speed = firstExpose.features.filter(isEnumExposeFeature).find((e) => e.name === 'mode');
if (speed) {
// A fan entity in Home Assistant 2021.3 and above may have a speed,
// controlled by a percentage from 1 to 100, and/or non-speed presets.
@@ -523,7 +574,7 @@ export default class HomeAssistant extends Extension {
}
const allowed = [...speeds, ...presets];
speed.values.forEach((s) => assert(allowed.includes(s)));
speed.values.forEach((s) => assert(allowed.includes(s.toString())));
const percentValues = speeds.map((s, i) => `'${s}':${i}`).join(', ');
const percentCommands = speeds.map((s, i) => `${i}:'${s}'`).join(', ');
const presetList = presets.map((s) => `'${s}'`).join(', ');
@@ -546,16 +597,23 @@ export default class HomeAssistant extends Extension {
}
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'binary') {
} else if (isBinaryExposeFeature(firstExpose)) {
const lookup: {[s: string]: KeyValue}= {
activity_led_indicator: {icon: 'mdi:led-on'},
auto_off: {icon: 'mdi:flash-auto'},
battery_low: {entity_category: 'diagnostic', device_class: 'battery'},
button_lock: {entity_category: 'config', icon: 'mdi:lock'},
calibration: {entity_category: 'config', icon: 'mdi:progress-wrench'},
capabilities_configurable_curve: {entity_category: 'diagnostic', icon: 'mdi:tune'},
capabilities_forward_phase_control: {entity_category: 'diagnostic', icon: 'mdi:tune'},
capabilities_overload_detection: {entity_category: 'diagnostic', icon: 'mdi:tune'},
capabilities_reactance_discriminator: {entity_category: 'diagnostic', icon: 'mdi:tune'},
capabilities_reverse_phase_control: {entity_category: 'diagnostic', icon: 'mdi:tune'},
carbon_monoxide: {device_class: 'carbon_monoxide'},
card: {entity_category: 'config', icon: 'mdi:clipboard-check'},
child_lock: {entity_category: 'config', icon: 'mdi:account-lock'},
color_sync: {entity_category: 'config', icon: 'mdi:sync-circle'},
consumer_connected: {entity_category: 'diagnostic', device_class: 'connectivity'},
consumer_connected: {device_class: 'plug'},
contact: {device_class: 'door'},
garage_door_contact: {device_class: 'garage_door', payload_on: false, payload_off: true},
eco_mode: {entity_category: 'config', icon: 'mdi:leaf'},
@@ -571,18 +629,32 @@ export default class HomeAssistant extends Extension {
motor_reversal: {entity_category: 'config', icon: 'mdi:arrow-left-right'},
moving: {device_class: 'moving'},
no_position_support: {entity_category: 'config', icon: 'mdi:minus-circle-outline'},
noise_detected: {device_class: 'sound'},
occupancy: {device_class: 'motion'},
power_outage_memory: {entity_category: 'config', icon: 'mdi:memory'},
presence: {device_class: 'presence'},
setup: {device_class: 'running'},
smoke: {device_class: 'smoke'},
sos: {device_class: 'safety'},
schedule: {icon: 'mdi:calendar'},
status_capacitive_load: {entity_category: 'diagnostic', icon: 'mdi:tune'},
status_forward_phase_control: {entity_category: 'diagnostic', icon: 'mdi:tune'},
status_inductive_load: {entity_category: 'diagnostic', icon: 'mdi:tune'},
status_overload: {entity_category: 'diagnostic', icon: 'mdi:tune'},
status_reverse_phase_control: {entity_category: 'diagnostic', icon: 'mdi:tune'},
tamper: {device_class: 'tamper'},
temperature_scale: {entity_category: 'config', icon: 'mdi:temperature-celsius'},
test: {entity_category: 'diagnostic', icon: 'mdi:test-tube'},
th_heater: {icon: 'mdi:heat-wave'},
trigger_indicator: {icon: 'mdi:led-on'},
valve_alarm: {device_class: 'problem'},
valve_detection: {icon: 'mdi:pipe-valve'},
valve_state: {device_class: 'opening'},
vibration: {device_class: 'vibration'},
water_leak: {device_class: 'moisture'},
window: {device_class: 'window'},
window_detection: {icon: 'mdi:window-open-variant'},
window_open: {device_class: 'window'},
};
/**
@@ -612,9 +684,6 @@ export default class HomeAssistant extends Extension {
},
};
// Let Home Assistant generate entity name when device_class is present
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
discoveryEntries.push(discoveryEntry);
} else {
const discoveryEntry: DiscoveryEntry = {
@@ -630,15 +699,13 @@ export default class HomeAssistant extends Extension {
},
};
// Let Home Assistant generate entity name when device_class is present
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
discoveryEntries.push(discoveryEntry);
}
} else if (firstExpose.type === 'numeric') {
} else if (isNumericExposeFeature(firstExpose)) {
const lookup: {[s: string]: KeyValue} = {
ac_frequency: {device_class: 'frequency', enabled_by_default: false, entity_category: 'diagnostic',
state_class: 'measurement'},
action_duration: {icon: 'mdi:timer', device_class: 'duration'},
alarm_humidity_max: {device_class: 'humidity', entity_category: 'config', icon: 'mdi:water-plus'},
alarm_humidity_min: {device_class: 'humidity', entity_category: 'config', icon: 'mdi:water-minus'},
alarm_temperature_max: {device_class: 'temperature', entity_category: 'config',
@@ -651,6 +718,10 @@ export default class HomeAssistant extends Extension {
auto_relock_time: {entity_category: 'config', icon: 'mdi:timer'},
away_preset_days: {entity_category: 'config', icon: 'mdi:timer'},
away_preset_temperature: {entity_category: 'config', icon: 'mdi:thermometer'},
ballast_maximum_level: {entity_category: 'config'},
ballast_minimum_level: {entity_category: 'config'},
ballast_physical_maximum_level: {entity_category: 'diagnostic'},
ballast_physical_minimum_level: {entity_category: 'diagnostic'},
battery: {device_class: 'battery', entity_category: 'diagnostic', state_class: 'measurement'},
battery2: {device_class: 'battery', entity_category: 'diagnostic', state_class: 'measurement'},
battery_voltage: {device_class: 'voltage', entity_category: 'diagnostic', state_class: 'measurement',
@@ -685,6 +756,7 @@ export default class HomeAssistant extends Extension {
state_class: 'measurement',
},
deadzone_temperature: {entity_category: 'config', icon: 'mdi:thermometer'},
detection_interval: {icon: 'mdi:timer'},
device_temperature: {
device_class: 'temperature', entity_category: 'diagnostic', state_class: 'measurement',
},
@@ -692,6 +764,7 @@ export default class HomeAssistant extends Extension {
eco2: {device_class: 'carbon_dioxide', state_class: 'measurement'},
eco_temperature: {entity_category: 'config', icon: 'mdi:thermometer'},
energy: {device_class: 'energy', state_class: 'total_increasing'},
external_temperature_input: {icon: 'mdi:thermometer'},
formaldehyd: {state_class: 'measurement'},
gas_density: {icon: 'mdi:google-circles-communities', state_class: 'measurement'},
hcho: {icon: 'mdi:air-filter', state_class: 'measurement'},
@@ -713,8 +786,15 @@ export default class HomeAssistant extends Extension {
max_temperature_limit: {entity_category: 'config', icon: 'mdi:thermometer-high'},
min_temperature_limit: {entity_category: 'config', icon: 'mdi:thermometer-low'},
min_temperature: {entity_category: 'config', icon: 'mdi:thermometer-low'},
minimum_on_level: {entity_category: 'config'},
measurement_poll_interval: {entity_category: 'config', icon: 'mdi:clock-out'},
noise: {device_class: 'sound_pressure', state_class: 'measurement'},
noise_detect_level: {icon: 'mdi:volume-equal'},
noise_timeout: {icon: 'mdi:timer'},
occupancy_level: {icon: 'mdi:motion-sensor'},
occupancy_sensitivity: {icon: 'mdi:motion-sensor'},
occupancy_timeout: {entity_category: 'config', icon: 'mdi:timer'},
overload_protection: {icon: 'mdi:flash'},
pm10: {device_class: 'pm10', state_class: 'measurement'},
pm25: {device_class: 'pm25', state_class: 'measurement'},
people: {state_class: 'measurement', icon: 'mdi:account-multiple'},
@@ -722,6 +802,7 @@ export default class HomeAssistant extends Extension {
power: {device_class: 'power', entity_category: 'diagnostic', state_class: 'measurement'},
power_factor: {device_class: 'power_factor', enabled_by_default: false,
entity_category: 'diagnostic', state_class: 'measurement'},
power_outage_count: {icon: 'mdi:counter', enabled_by_default: false},
precision: {entity_category: 'config', icon: 'mdi:decimal-comma-increase'},
pressure: {device_class: 'atmospheric_pressure', state_class: 'measurement'},
presence_timeout: {entity_category: 'config', icon: 'mdi:timer'},
@@ -738,7 +819,9 @@ export default class HomeAssistant extends Extension {
temperature_calibration: {entity_category: 'config', icon: 'mdi:wrench-clock'},
temperature_max: {entity_category: 'config', icon: 'mdi:thermometer-plus'},
temperature_min: {entity_category: 'config', icon: 'mdi:thermometer-minus'},
temperature_offset: {icon: 'mdi:thermometer-lines'},
transition: {entity_category: 'config', icon: 'mdi:transition'},
trigger_count: {icon: 'mdi:counter', enabled_by_default: false},
voc: {device_class: 'volatile_organic_compounds', state_class: 'measurement'},
voc_index: {state_class: 'measurement'},
vibration_timeout: {entity_category: 'config', icon: 'mdi:timer'},
@@ -805,8 +888,11 @@ export default class HomeAssistant extends Extension {
delete discoveryEntry.discovery_payload.device_class;
}
// Let Home Assistant generate entity name when device_class is present
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
// entity_category config is not allowed for sensors
// https://github.com/Koenkk/zigbee2mqtt/issues/20252
if (discoveryEntry.discovery_payload.entity_category === 'config') {
discoveryEntry.discovery_payload.entity_category = 'diagnostic';
}
discoveryEntries.push(discoveryEntry);
@@ -838,27 +924,26 @@ export default class HomeAssistant extends Extension {
delete discoveryEntry.discovery_payload.device_class;
}
// Let Home Assistant generate entity name when device_class is present
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
if (firstExpose.value_min != null) discoveryEntry.discovery_payload.min = firstExpose.value_min;
if (firstExpose.value_max != null) discoveryEntry.discovery_payload.max = firstExpose.value_max;
discoveryEntries.push(discoveryEntry);
}
} else if (firstExpose.type === 'enum') {
} else if (isEnumExposeFeature(firstExpose)) {
const lookup: {[s: string]: KeyValue} = {
action: {icon: 'mdi:gesture-double-tap'},
alarm_humidity: {entity_category: 'config', icon: 'mdi:water-percent-alert'},
alarm_temperature: {entity_category: 'config', icon: 'mdi:thermometer-alert'},
backlight_auto_dim: {entity_category: 'config', icon: 'mdi:brightness-auto'},
backlight_mode: {entity_category: 'config', icon: 'mdi:lightbulb'},
calibrate: {icon: 'mdi:tune'},
color_power_on_behavior: {entity_category: 'config', icon: 'mdi:palette'},
control_mode: {entity_category: 'config', icon: 'mdi:tune'},
device_mode: {entity_category: 'config', icon: 'mdi:tune'},
effect: {enabled_by_default: false, icon: 'mdi:palette'},
force: {entity_category: 'config', icon: 'mdi:valve'},
keep_time: {entity_category: 'config', icon: 'mdi:av-timer'},
identify: {device_class: 'identify'},
keypad_lockout: {entity_category: 'config', icon: 'mdi:lock'},
load_detection_mode: {entity_category: 'config', icon: 'mdi:tune'},
load_dimmable: {entity_category: 'config', icon: 'mdi:chart-bell-curve'},
@@ -866,19 +951,24 @@ export default class HomeAssistant extends Extension {
melody: {entity_category: 'config', icon: 'mdi:music-note'},
mode_phase_control: {entity_category: 'config', icon: 'mdi:tune'},
mode: {entity_category: 'config', icon: 'mdi:tune'},
mode_switch: {icon: 'mdi:tune'},
motion_sensitivity: {entity_category: 'config', icon: 'mdi:tune'},
operation_mode: {entity_category: 'config', icon: 'mdi:tune'},
power_on_behavior: {entity_category: 'config', icon: 'mdi:power-settings'},
power_outage_memory: {entity_category: 'config', icon: 'mdi:power-settings'},
power_supply_mode: {entity_category: 'config', icon: 'mdi:power-settings'},
power_type: {entity_category: 'config', icon: 'mdi:lightning-bolt-circle'},
restart: {device_class: 'restart'},
sensitivity: {entity_category: 'config', icon: 'mdi:tune'},
sensor: {icon: 'mdi:tune'},
sensors_type: {entity_category: 'config', icon: 'mdi:tune'},
sound_volume: {entity_category: 'config', icon: 'mdi:volume-high'},
status: {icon: 'mdi:state-machine'},
switch_type: {entity_category: 'config', icon: 'mdi:tune'},
temperature_display_mode: {entity_category: 'config', icon: 'mdi:thermometer'},
temperature_sensor_select: {entity_category: 'config', icon: 'mdi:home-thermometer'},
thermostat_unit: {entity_category: 'config', icon: 'mdi:thermometer'},
update: {device_class: 'update'},
volume: {entity_category: 'config', icon: 'mdi: volume-high'},
week: {entity_category: 'config', icon: 'mdi:calendar-clock'},
};
@@ -918,6 +1008,29 @@ export default class HomeAssistant extends Extension {
command_topic: true,
command_topic_postfix: firstExpose.property,
options: firstExpose.values.map((v) => v.toString()),
enabled_by_default: firstExpose.values.length !== 1, // hide if button is exposed
...lookup[firstExpose.name],
},
});
}
/**
* If enum has only item and only supports SET then expose as button entity.
* Note: select entity is hidden by default to avoid breaking changes
* for selects already existing in HA (legacy).
*/
if (firstExpose.access & ACCESS_SET && firstExpose.values.length === 1) {
discoveryEntries.push({
type: 'button',
object_id: firstExpose.property,
mockProperties: [],
discovery_payload: {
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
state_topic: false,
command_topic_prefix: endpoint,
command_topic: true,
command_topic_postfix: firstExpose.property,
payload_press: firstExpose.values[0].toString(),
...lookup[firstExpose.name],
},
});
@@ -927,9 +1040,12 @@ export default class HomeAssistant extends Extension {
const settableText = firstExpose.type === 'text' && firstExpose.access & ACCESS_SET;
const lookup: {[s: string]: KeyValue} = {
action: {icon: 'mdi:gesture-double-tap'},
color_options: {icon: 'mdi:palette'},
level_config: {entity_category: 'diagnostic'},
programming_mode: {icon: 'mdi:calendar-clock'},
program: {value_template: `{{ value_json.${firstExpose.property}|default('',true) ` +
program: {value_template: `{{ value_json.${firstExpose.property}|default('',True) ` +
`| truncate(254, True, '', 0) }}`},
schedule_settings: {icon: 'mdi:calendar-clock'},
};
if (firstExpose.access & ACCESS_STATE) {
const discoveryEntry: DiscoveryEntry = {
@@ -965,15 +1081,30 @@ export default class HomeAssistant extends Extension {
throw new Error(`Unsupported exposes type: '${firstExpose.type}'`);
}
// Exposes with category 'config' or 'diagnostic' are always added to the respective category.
// This takes precedence over definitions in this file.
if (firstExpose.category === 'config') {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'config');
} else if (firstExpose.category === 'diagnostic') {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'diagnostic');
}
discoveryEntries.forEach((d) => {
// If a sensor has entity category `config`, then change
// it to `diagnostic`. Sensors have no input, so can't be configured.
// https://github.com/Koenkk/zigbee2mqtt/pull/19474
if (d.type === 'sensor' && d.discovery_payload.entity_category === 'config') {
if (['binary_sensor', 'sensor'].includes(d.type) && d.discovery_payload.entity_category === 'config') {
d.discovery_payload.entity_category = 'diagnostic';
}
});
discoveryEntries.forEach((d) => {
// Let Home Assistant generate entity name when device_class is present
if (d.discovery_payload.device_class) {
delete d.discovery_payload.name;
}
});
return discoveryEntries;
}
@@ -1080,8 +1211,9 @@ export default class HomeAssistant extends Extension {
}
}
private getConfigs(entity: Device | Group): DiscoveryEntry[] {
private getConfigs(entity: Device | Group | Bridge): DiscoveryEntry[] {
const isDevice = entity.isDevice();
const isGroup = entity.isGroup();
/* istanbul ignore next */
if (!entity || (isDevice && !entity.definition)) return [];
@@ -1104,9 +1236,9 @@ export default class HomeAssistant extends Extension {
// @ts-ignore
configs.push(entity.definition.homeassistant);
}
} else { // group
const exposesByType: {[s: string]: zhc.DefinitionExpose[]} = {};
const allExposes: zhc.DefinitionExpose[] = [];
} else if (isGroup) { // group
const exposesByType: {[s: string]: zhc.Expose[]} = {};
const allExposes: zhc.Expose[] = [];
entity.zh.members.map((e) => this.zigbee.resolveEntity(e.getDevice()) as Device)
.filter((d) => d.definition).forEach((device) => {
@@ -1128,6 +1260,9 @@ export default class HomeAssistant extends Extension {
configs = [].concat(...Object.values(exposesByType)
.map((exposes) => this.exposeToConfig(exposes, 'group', allExposes)));
} else {
// Discover bridge config.
configs.push(...entity.configs);
}
if (isDevice && settings.get().advanced.last_seen !== 'disable') {
@@ -1152,7 +1287,7 @@ export default class HomeAssistant extends Extension {
configs.push(config);
}
if (isDevice && entity.definition.hasOwnProperty('ota')) {
if (isDevice && entity.definition.ota) {
const updateStateSensor: DiscoveryEntry = {
type: 'sensor',
object_id: 'update_state',
@@ -1198,12 +1333,34 @@ export default class HomeAssistant extends Extension {
value_template: `{{ value_json['update']['installed_version'] }}`,
latest_version_template: `{{ value_json['update']['latest_version'] }}`,
json_attributes_topic: `${settings.get().mqtt.base_topic}/${entity.name}`, // state topic
json_attributes_template: `{"in_progress": "{{ value_json['update']['state'] == 'updating' }}"}`,
json_attributes_template:
`{"in_progress": {{ iif(value_json['update']['state'] == 'updating', 'true', 'false') }} }`,
},
};
configs.push(updateSensor);
}
// Discover scenes.
const endpointsOrGroups = isDevice ? entity.zh.endpoints : isGroup ? [entity.zh] : [];
endpointsOrGroups.forEach((endpointOrGroup) => {
utils.getScenes(endpointOrGroup).forEach((scene) => {
const sceneEntry: DiscoveryEntry = {
type: 'scene',
object_id: `scene_${scene.id}`,
mockProperties: [],
discovery_payload: {
name: `${scene.name}`,
state_topic: false,
command_topic: true,
payload_on: `{ "scene_recall": ${scene.id} }`,
object_id_postfix: `_${scene.name.replace(/\s+/g, '_').toLowerCase()}`,
},
};
configs.push(sceneEntry);
});
});
if (isDevice && entity.options.hasOwnProperty('legacy') && !entity.options.legacy) {
configs = configs.filter((c) => c !== sensorClick);
}
@@ -1230,21 +1387,26 @@ export default class HomeAssistant extends Extension {
return configs;
}
private getDiscoverKey(entity: Device | Group): string | number {
return entity.isDevice() ? entity.ieeeAddr : entity.ID;
private getDiscoverKey(entity: Device | Group | Bridge): string | number {
return entity.ID;
}
private discover(entity: Device | Group, force=false): void {
private discover(entity: Device | Group | Bridge, force=false): void {
// Check if already discovered and check if there are configs.
const discoverKey = this.getDiscoverKey(entity);
const discover = force || !this.discovered[discoverKey];
if (entity.isGroup()) {
if (!discover || entity.zh.members.length === 0) return;
} else if (!discover || !entity.definition || entity.zh.interviewing ||
(entity.options.hasOwnProperty('homeassistant') && !entity.options.homeassistant)) {
// Handle type differences.
const isDevice = entity.isDevice();
const isGroup = entity.isGroup();
if (isGroup && (!discover || entity.zh.members.length === 0)) {
return;
} else if (isDevice && (!discover || !entity.definition || entity.zh.interviewing ||
(entity.options.hasOwnProperty('homeassistant') && !entity.options.homeassistant))) {
return;
}
const lastDiscovered = this.discovered[discoverKey];
this.discovered[discoverKey] = {topics: new Set(), mockProperties: new Set(), objectIDs: new Set()};
this.getConfigs(entity).forEach((config) => {
@@ -1273,7 +1435,7 @@ export default class HomeAssistant extends Extension {
payload.tilt_status_topic = stateTopic;
}
if (this.entityAttributes) {
if (this.entityAttributes && (isDevice || isGroup) ) {
payload.json_attributes_topic = stateTopic;
}
@@ -1287,6 +1449,11 @@ export default class HomeAssistant extends Extension {
payload.object_id += `_${config.object_id}`;
}
// Allow customization of the `payload.object_id` without touching the other uses of `config.object_id`
// (e.g. for setting the `payload.unique_id` and as an internal key).
payload.object_id = `${payload.object_id}${payload.object_id_postfix ?? ''}`;
delete payload.object_id_postfix;
// Set unique_id
payload.unique_id = `${entity.options.ID}_${config.object_id}_${settings.get().mqtt.base_topic}`;
@@ -1294,20 +1461,27 @@ export default class HomeAssistant extends Extension {
payload.device = devicePayload;
payload.origin = this.discoveryOrigin;
// Availability payload
payload.availability = [{topic: `${settings.get().mqtt.base_topic}/bridge/state`}];
// Availability payload (can be disabled by setting `payload.availability = false`).
if (! payload.hasOwnProperty('availability') || payload.availability) {
payload.availability = [{topic: `${settings.get().mqtt.base_topic}/bridge/state`}];
/* istanbul ignore next */
if (utils.isAvailabilityEnabledForEntity(entity, settings.get())) {
payload.availability_mode = 'all';
payload.availability.push({topic: `${baseTopic}/availability`});
}
if (isDevice||isGroup) {
if (utils.isAvailabilityEnabledForEntity(entity, settings.get())) {
payload.availability_mode = 'all';
payload.availability.push({topic: `${baseTopic}/availability`});
}
} else { // Bridge availability is different.
payload.availability_mode = 'all';
}
if (entity.isDevice() && entity.options.disabled) {
// Mark disabled device always as unavailable
payload.availability.forEach((a: KeyValue) => a.value_template = '{{ "offline" }}');
} else if (!settings.get().advanced.legacy_availability_payload) {
payload.availability.forEach((a: KeyValue) => a.value_template = '{{ value_json.state }}');
if (isDevice && entity.options.disabled) {
// Mark disabled device always as unavailable
payload.availability.forEach((a: KeyValue) => a.value_template = '{{ "offline" }}');
} else if (!settings.get().advanced.legacy_availability_payload) {
payload.availability.forEach((a: KeyValue) => a.value_template = '{{ value_json.state }}');
}
} else {
delete payload.availability;
}
const commandTopicPrefix = payload.command_topic_prefix ? `${payload.command_topic_prefix}/` : '';
@@ -1443,6 +1617,11 @@ export default class HomeAssistant extends Extension {
config.mockProperties?.forEach((mockProperty) =>
this.discovered[discoverKey].mockProperties.add(mockProperty));
});
lastDiscovered?.topics?.forEach((topic) => {
if (!this.discovered[discoverKey].topics.has(topic)) {
this.mqtt.publish(topic, null, {retain: true, qos: 1}, this.discoveryTopic, false, false);
}
});
}
@bind private onMQTTMessage(data: eventdata.MQTTMessage): void {
@@ -1469,7 +1648,7 @@ export default class HomeAssistant extends Extension {
// Group discovery topic uses "ENCODEDBASETOPIC_GROUPID", device use ieeeAddr
const ID = discoveryMatch[2].includes('_') ? discoveryMatch[2].split('_')[1] : discoveryMatch[2];
const entity = this.zigbee.resolveEntity(ID);
const entity = ID === this.bridge.ID ? this.bridge : this.zigbee.resolveEntity(ID);
let clear = !entity || entity.isDevice() && !entity.definition;
// Only save when topic matches otherwise config is not updated when renamed by editing configuration.yaml
@@ -1518,7 +1697,28 @@ export default class HomeAssistant extends Extension {
this.discover(data.device);
}
private getDevicePayload(entity: Device | Group): KeyValue {
@bind async onScenesChanged(data: eventdata.ScenesChanged): Promise<void> {
// Re-trigger MQTT discovery of changed devices and groups, similar to bridge.ts
// First, clear existing scene discovery topics
logger.debug(`Clearing Home Assistant scene discovery topics for '${data.entity.name}'`);
this.discovered[this.getDiscoverKey(data.entity)]?.topics.forEach((topic) => {
if (topic.startsWith('scene')) {
this.mqtt.publish(topic, null, {retain: true, qos: 1}, this.discoveryTopic, false, false);
}
});
// Make sure Home Assistant deletes the old entity first otherwise another one (_2) is created
// https://github.com/Koenkk/zigbee2mqtt/issues/12610
logger.debug(`Finished clearing scene discovery topics, waiting for Home Assistant.`);
await utils.sleep(2);
// Re-discover entity (including any new scenes).
logger.debug(`Re-discovering entities with their scenes.`);
this.discover(data.entity, true);
}
private getDevicePayload(entity: Device | Group | Bridge): KeyValue {
const identifierPostfix = entity.isGroup() ?
`zigbee2mqtt_${this.getEncodedBaseTopic()}` : 'zigbee2mqtt';
@@ -1534,22 +1734,37 @@ export default class HomeAssistant extends Extension {
sw_version: `Zigbee2MQTT ${this.zigbee2MQTTVersion}`,
};
const url = settings.get().frontend?.url ?? '';
if (entity.isDevice()) {
payload.model = `${entity.definition.description} (${entity.definition.model})`;
payload.manufacturer = entity.definition.vendor;
payload.sw_version = entity.zh.softwareBuildID;
payload.configuration_url = `${url}/#/device/${entity.ieeeAddr}/info`;
} else if (entity.isGroup()) {
payload.model = 'Group';
payload.manufacturer = 'Zigbee2MQTT';
payload.configuration_url = `${url}/#/group/${entity.ID}`;
} else {
payload.model = 'Bridge';
payload.manufacturer = 'Zigbee2MQTT';
payload.hw_version = `${entity.hardwareVersion} ${entity.firmwareVersion}`;
payload.sw_version = this.zigbee2MQTTVersion;
payload.configuration_url = `${url}/#/settings`;
}
if (settings.get().frontend?.url) {
const url = settings.get().frontend?.url;
payload.configuration_url = entity.isDevice() ? `${url}/#/device/${entity.ieeeAddr}/info` :
`${url}/#/group/${entity.ID}`;
if (!url) {
delete payload.configuration_url;
}
// Link devices & groups to bridge.
if (entity !== this.bridge) {
payload.via_device = this.bridgeIdentifier;
}
return payload;
}
override adjustMessageBeforePublish(entity: Device | Group, message: KeyValue): void {
override adjustMessageBeforePublish(entity: Device | Group | Bridge, message: KeyValue): void {
const discoverKey = this.getDiscoverKey(entity);
this.discovered[discoverKey]?.mockProperties?.forEach((mockProperty) => {
if (!message.hasOwnProperty(mockProperty.property)) {
@@ -1576,7 +1791,7 @@ export default class HomeAssistant extends Extension {
return settings.get().mqtt.base_topic.split('').map((s) => s.charCodeAt(0).toString()).join('');
}
private getDiscoveryTopic(config: DiscoveryEntry, entity: Device | Group): string {
private getDiscoveryTopic(config: DiscoveryEntry, entity: Device | Group | Bridge): string {
const key = entity.isDevice() ? entity.ieeeAddr : `${this.getEncodedBaseTopic()}_${entity.ID}`;
return `${config.type}/${key}/${config.object_id}/config`;
}
@@ -1625,4 +1840,159 @@ export default class HomeAssistant extends Extension {
_clearDiscoveredTrigger(): void {
this.discoveredTriggers = {};
}
private getBridgeEntity(coordinatorVersion: zh.CoordinatorVersion): Bridge {
const coordinatorIeeeAddress = this.zigbee.firstCoordinatorEndpoint().deviceIeeeAddress;
const discovery: DiscoveryEntry[] = [];
const bridge = new Bridge(coordinatorIeeeAddress, coordinatorVersion, discovery);
const baseTopic = `${settings.get().mqtt.base_topic}/${bridge.name}`;
const legacyAvailability = settings.get().advanced.legacy_availability_payload;
discovery.push(
// Binary sensors.
{
type: 'binary_sensor',
object_id: 'connection_state',
mockProperties: [],
discovery_payload: {
name: 'Connection state',
device_class: 'connectivity',
entity_category: 'diagnostic',
state_topic: true,
state_topic_postfix: 'state',
value_template: !legacyAvailability ? '{{ value_json.state }}' : '{{ value }}',
payload_on: 'online',
payload_off: 'offline',
availability: false,
},
},
{
type: 'binary_sensor',
object_id: 'restart_required',
mockProperties: [],
discovery_payload: {
name: 'Restart required',
device_class: 'problem',
entity_category: 'diagnostic',
enabled_by_default: false,
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ value_json.restart_required }}',
payload_on: true,
payload_off: false,
},
},
// Buttons.
{
type: 'button',
object_id: 'restart',
mockProperties: [],
discovery_payload: {
name: 'Restart',
device_class: 'restart',
state_topic: false,
command_topic: `${baseTopic}/request/restart`,
payload_press: '',
},
},
// Selects.
{
type: 'select',
object_id: 'log_level',
mockProperties: [],
discovery_payload: {
name: 'Log level',
entity_category: 'config',
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ value_json.log_level | lower }}',
command_topic: `${baseTopic}/request/options`,
command_template:
'{"options": {"advanced": {"log_level": "{{ value }}" } } }',
options: ['info', 'warn', 'error', 'debug'],
},
},
// Sensors:
{
type: 'sensor',
object_id: 'version',
mockProperties: [],
discovery_payload: {
name: 'Version',
icon: 'mdi:zigbee',
entity_category: 'diagnostic',
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ value_json.version }}',
},
},
{
type: 'sensor',
object_id: 'coordinator_version',
mockProperties: [],
discovery_payload: {
name: 'Coordinator version',
icon: 'mdi:chip',
entity_category: 'diagnostic',
enabled_by_default: false,
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ value_json.coordinator.meta.revision }}',
},
},
{
type: 'sensor',
object_id: 'network_map',
mockProperties: [],
discovery_payload: {
name: 'Network map',
entity_category: 'diagnostic',
enabled_by_default: false,
state_topic: true,
state_topic_postfix: 'response/networkmap',
value_template: '{{ now().strftime(\'%Y-%m-%d %H:%M:%S\') }}',
json_attributes_topic: `${baseTopic}/response/networkmap`,
json_attributes_template: '{{ value_json.data.value | tojson }}',
},
},
{
type: 'sensor',
object_id: 'permit_join_timeout',
mockProperties: [],
discovery_payload: {
name: 'Permit join timeout',
device_class: 'duration',
unit_of_measurement: 's',
entity_category: 'diagnostic',
state_topic: true,
state_topic_postfix: 'info',
value_template:
'{{ iif(value_json.permit_join_timeout is defined, value_json.permit_join_timeout, None) }}',
},
},
// Switches.
{
type: 'switch',
object_id: 'permit_join',
mockProperties: [],
discovery_payload: {
name: 'Permit join',
icon: 'mdi:human-greeting-proximity',
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ value_json.permit_join | lower }}',
command_topic: `${baseTopic}/request/permit_join`,
payload_on: 'true',
payload_off: 'false',
},
},
);
return bridge;
}
}
+5 -6
View File
@@ -1,6 +1,5 @@
import * as settings from '../../util/settings';
import logger from '../../util/logger';
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import utils from '../../util/utils';
import assert from 'assert';
import Extension from '../extension';
@@ -90,7 +89,7 @@ export default class BridgeLegacy extends Extension {
@bind async reset(): Promise<void> {
try {
await this.zigbee.reset('soft');
logger.info('Soft resetted ZNP');
logger.info('Soft reset ZNP');
} catch (error) {
logger.error('Soft reset failed');
}
@@ -140,7 +139,7 @@ export default class BridgeLegacy extends Extension {
};
if (device.zh.type !== 'Coordinator') {
const definition = zigbeeHerdsmanConverters.findByDevice(device.zh);
const definition = device.definition;
payload.model = definition ? definition.model : device.zh.modelID;
payload.vendor = definition ? definition.vendor : '-';
payload.description = definition ? definition.description : '-';
@@ -321,7 +320,7 @@ export default class BridgeLegacy extends Extension {
try {
logger.info(`${lookup[action][1]} '${entity.name}'`);
if (action === 'force_remove') {
await entity.zh.removeFromDatabase();
entity.zh.removeFromDatabase();
} else {
await entity.zh.removeFromNetwork();
}
@@ -385,7 +384,7 @@ export default class BridgeLegacy extends Extension {
);
} else if (type === 'deviceInterview') {
if (data.status === 'successful') {
if (resolvedEntity.definition) {
if (resolvedEntity.isSupported) {
const {vendor, description, model} = resolvedEntity.definition;
const log = {friendly_name: resolvedEntity.name, model, vendor, description, supported: true};
this.mqtt.publish(
@@ -446,7 +445,7 @@ export default class BridgeLegacy extends Extension {
stringify({type: `touchlink`, message: 'reset_success', meta: {status: 'success'}}),
);
} else {
logger.warn('Failed to factory reset device through Touchlink');
logger.warning('Failed to factory reset device through Touchlink');
this.mqtt.publish(
'bridge/log',
stringify({type: `touchlink`, message: 'reset_failed', meta: {status: 'failed'}}),
+10 -5
View File
@@ -1,7 +1,6 @@
/* istanbul ignore file */
import * as settings from '../../util/settings';
import logger from '../../util/logger';
import utils from '../../util/utils';
import Extension from '../extension';
import bind from 'bind-decorator';
import Device from '../../model/device';
@@ -19,19 +18,25 @@ export default class DeviceGroupMembership extends Extension {
return null;
}
const parsed = utils.parseEntityID(match[1]);
const device = this.zigbee.resolveEntity(parsed.ID) as Device;
const parsed = this.zigbee.resolveEntityAndEndpoint(match[1]);
const device = parsed?.entity as Device;
if (!device || !(device instanceof Device)) {
logger.error(`Device '${match[1]}' does not exist`);
return;
}
const endpoint = device.endpoint(parsed.endpoint);
const endpoint = parsed.endpoint;
if (parsed.endpointID && !endpoint) {
logger.error(`Device '${parsed.ID}' does not have endpoint '${parsed.endpointID}'`);
return;
}
const response = await endpoint.command(
`genGroups`, 'getMembership', {groupcount: 0, grouplist: []}, {},
);
if (!response) {
logger.warn(`Couldn't get group membership of ${device.ieeeAddr}`);
logger.warning(`Couldn't get group membership of ${device.ieeeAddr}`);
return;
}
+7 -7
View File
@@ -1,4 +1,4 @@
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
import logger from '../../util/logger';
import * as settings from '../../util/settings';
import Extension from '../extension';
@@ -7,14 +7,14 @@ const defaultConfiguration = {
minimumReportInterval: 3, maximumReportInterval: 300, reportableChange: 1,
};
const ZNLDP12LM = zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'ZNLDP12LM');
const ZNLDP12LM = zhc.definitions.find((d) => d.model === 'ZNLDP12LM');
const devicesNotSupportingReporting = [
zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'CC2530.ROUTER'),
zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'BASICZBR3'),
zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'ZM-CSW032-D'),
zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'TS0001'),
zigbeeHerdsmanConverters.definitions.find((d) => d.model === 'TS0115'),
zhc.definitions.find((d) => d.model === 'CC2530.ROUTER'),
zhc.definitions.find((d) => d.model === 'BASICZBR3'),
zhc.definitions.find((d) => d.model === 'ZM-CSW032-D'),
zhc.definitions.find((d) => d.model === 'TS0001'),
zhc.definitions.find((d) => d.model === 'TS0115'),
];
const reportKey = 1;
+4 -4
View File
@@ -39,16 +39,16 @@ export default class SoftReset extends Extension {
}
private async handleTimeout(): Promise<void> {
logger.warn('Soft reset timeout triggered');
logger.warning('Soft reset timeout triggered');
try {
await this.zigbee.reset('soft');
logger.warn('Soft resetted ZNP due to timeout');
logger.warning('Soft reset ZNP due to timeout');
} catch (error) {
logger.warn('Soft reset failed, trying stop/start');
logger.warning('Soft reset failed, trying stop/start');
await this.zigbee.stop();
logger.warn('Zigbee stopped');
logger.warning('Zigbee stopped');
try {
await this.zigbee.start();
+3 -14
View File
@@ -99,12 +99,7 @@ export default class NetworkMap extends Extension {
// Add the device model
if (node.type !== 'Coordinator') {
if (node.definition) {
labels.push(`${node.definition.vendor} ${node.definition.description} (${node.definition.model})`);
} else {
// This model is not supported by zigbee-herdsman-converters, add zigbee model information
labels.push(`${node.manufacturerName} ${node.modelID}`);
}
labels.push(`${node.definition?.vendor} ${node.definition?.description} (${node.definition?.model})`);
}
// Add the device last_seen timestamp
@@ -177,12 +172,7 @@ export default class NetworkMap extends Extension {
if (node.type !== 'Coordinator') {
text.push(`---`);
const definition = (this.zigbee.resolveEntity(node.ieeeAddr) as Device).definition;
if (definition) {
text.push(`${definition.vendor} ${definition.description} (${definition.model})`);
} else {
// This model is not supported by zigbee-herdsman-converters, add zigbee model information
text.push(`${node.manufacturerName} ${node.modelID}`);
}
text.push(`${definition?.vendor} ${definition?.description} (${definition?.model})`);
}
// Add the device last_seen timestamp
@@ -269,8 +259,7 @@ export default class NetworkMap extends Extension {
vendor: device.definition.vendor,
description: device.definition.description,
supports: Array.from(new Set((device.exposes()).map((e) => {
return e.hasOwnProperty('name') ? e.name :
`${e.type} (${e.features.map((f) => f.name).join(', ')})`;
return e.name ?? `${e.type} (${e.features.map((f) => f.name).join(', ')})`;
}))).join(', '),
} : null;
+5 -4
View File
@@ -1,4 +1,4 @@
import zhc from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
import Extension from './extension';
/**
@@ -39,12 +39,13 @@ export default class OnEvent extends Extension {
}
}
private async callOnEvent(device: Device, type: string, data: KeyValue): Promise<void> {
private async callOnEvent(device: Device, type: zhc.OnEventType, data: KeyValue): Promise<void> {
const state = this.state.get(device);
zhc.onEvent(type, data, device.zh, device.options, state);
zhc.onEvent(type, data, device.zh);
if (device.definition?.onEvent) {
await device.definition.onEvent(type, data, device.zh, device.options, state);
const options: KeyValue = device.options;
await device.definition.onEvent(type, data, device.zh, options, state);
}
}
}
+17 -12
View File
@@ -2,14 +2,13 @@ import * as settings from '../util/settings';
import logger from '../util/logger';
import stringify from 'json-stable-stringify-without-jsonify';
import utils from '../util/utils';
import * as tradfriOTA from 'zigbee-herdsman-converters/lib/ota/tradfri';
import * as zigbeeOTA from 'zigbee-herdsman-converters/lib/ota/zigbeeOTA';
import Extension from './extension';
import bind from 'bind-decorator';
import Device from '../model/device';
import dataDir from '../util/data';
import * as URI from 'uri-js';
import path from 'path';
import * as zhc from 'zigbee-herdsman-converters';
function isValidUrl(url: string): boolean {
let parsed;
@@ -45,7 +44,7 @@ export default class OTAUpdate extends Extension {
this.eventBus.onMQTTMessage(this, this.onMQTTMessage);
this.eventBus.onDeviceMessage(this, this.onZigbeeEvent);
if (settings.get().ota.ikea_ota_use_test_url) {
tradfriOTA.useTestURL();
zhc.ota.tradfri.useTestURL();
}
// Let zigbeeOTA module know if the override index file is provided
@@ -56,16 +55,20 @@ export default class OTAUpdate extends Extension {
overrideOTAIndex = dataDir.joinPath(overrideOTAIndex);
}
zigbeeOTA.useIndexOverride(overrideOTAIndex);
zhc.ota.zigbeeOTA.useIndexOverride(overrideOTAIndex);
}
// In order to support local firmware files we need to let zigbeeOTA know where the data directory is
zigbeeOTA.setDataDir(dataDir.getPath());
zhc.ota.setDataDir(dataDir.getPath());
// In case Zigbee2MQTT is restared during an update, progress and remaining values are still in state.
// remove them.
for (const device of this.zigbee.devices(false)) {
this.removeProgressAndRemainingFromState(device);
// Reset update state, e.g. when Z2M restarted during update.
if (this.state.get(device).update?.state === 'updating') {
this.state.get(device).update.state = 'available';
}
}
}
@@ -80,7 +83,7 @@ export default class OTAUpdate extends Extension {
logger.debug(`Device '${data.device.name}' requested OTA`);
const automaticOTACheckDisabled = settings.get().ota.disable_automatic_update_check;
let supportsOTA = data.device.definition.hasOwnProperty('ota');
let supportsOTA = !!data.device.definition.ota;
if (supportsOTA && !automaticOTACheckDisabled) {
// When a device does a next image request, it will usually do it a few times after each other
// with only 10 - 60 seconds inbetween. It doesn't make sense to check for a new update
@@ -93,7 +96,9 @@ export default class OTAUpdate extends Extension {
this.lastChecked[data.device.ieeeAddr] = Date.now();
let availableResult: zhc.OtaUpdateAvailableResult = null;
try {
availableResult = await data.device.definition.ota.isUpdateAvailable(data.device.zh, logger, data.data);
// @ts-expect-error typing guaranteed by data.type
const dataData: zhc.ota.ImageInfo = data.data;
availableResult = await data.device.definition.ota.isUpdateAvailable(data.device.zh, dataData);
} catch (e) {
supportsOTA = false;
logger.debug(`Failed to check if update available for '${data.device.name}' (${e.message})`);
@@ -124,11 +129,11 @@ export default class OTAUpdate extends Extension {
logger.debug(`Responded to OTA request of '${data.device.name}' with 'NO_IMAGE_AVAILABLE'`);
}
private async readSoftwareBuildIDAndDateCode(device: Device, sendWhen: 'active' | 'immediate'):
private async readSoftwareBuildIDAndDateCode(device: Device, sendPolicy?: 'immediate'):
Promise<{softwareBuildID: string, dateCode: string}> {
try {
const endpoint = device.zh.endpoints.find((e) => e.supportsInputCluster('genBasic'));
const result = await endpoint.read('genBasic', ['dateCode', 'swBuildId'], {sendWhen});
const result = await endpoint.read('genBasic', ['dateCode', 'swBuildId'], {sendPolicy});
return {softwareBuildID: result.swBuildId, dateCode: result.dateCode};
} catch (e) {
return null;
@@ -201,7 +206,7 @@ export default class OTAUpdate extends Extension {
}
try {
const availableResult = await device.definition.ota.isUpdateAvailable(device.zh, logger);
const availableResult = await device.definition.ota.isUpdateAvailable(device.zh, null);
const msg = `${availableResult.available ? 'Update' : 'No update'} available for '${device.name}'`;
logger.info(msg);
@@ -265,14 +270,14 @@ export default class OTAUpdate extends Extension {
};
const from_ = await this.readSoftwareBuildIDAndDateCode(device, 'immediate');
const fileVersion = await device.definition.ota.updateToLatest(device.zh, logger, onProgress);
const fileVersion = await device.definition.ota.updateToLatest(device.zh, onProgress);
logger.info(`Finished update of '${device.name}'`);
this.eventBus.emitReconfigure({device});
this.removeProgressAndRemainingFromState(device);
const payload = this.getEntityPublishPayload(device,
{available: false, currentFileVersion: fileVersion, otaFileVersion: fileVersion});
this.publishEntityState(device, payload);
const to = await this.readSoftwareBuildIDAndDateCode(device, 'active');
const to = await this.readSoftwareBuildIDAndDateCode(device);
const [fromS, toS] = [stringify(from_), stringify(to)];
logger.info(`Device '${device.name}' was updated from '${fromS}' to '${toS}'`);
responseData.from = from_ ? utils.toSnakeCase(from_) : null;
+53 -42
View File
@@ -1,6 +1,6 @@
import * as settings from '../util/settings';
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
import * as philips from 'zigbee-herdsman-converters/lib/philips';
import logger from '../util/logger';
import utils from '../util/utils';
@@ -10,26 +10,25 @@ import Group from '../model/group';
import Device from '../model/device';
import bind from 'bind-decorator';
const topicRegex = new RegExp(`^(.+?)(?:/(${utils.endpointNames.join('|')}|\\d+))?/(get|set)(?:/(.+))?`);
const propertyEndpointRegex = new RegExp(`^(.*?)_(${utils.endpointNames.join('|')})$`);
const topicGetSetRegex = new RegExp(`^(.+?)/(get|set)(?:/(.+))?`);
const stateValues = ['on', 'off', 'toggle', 'open', 'close', 'stop', 'lock', 'unlock'];
const sceneConverterKeys = ['scene_store', 'scene_add', 'scene_remove', 'scene_remove_all', 'scene_rename'];
// Legacy: don't provide default converters anymore, this is required by older z2m installs not saving group members
const defaultGroupConverters = [
zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness,
zigbeeHerdsmanConverters.toZigbeeConverters.light_color_colortemp,
zhc.toZigbee.light_onoff_brightness,
zhc.toZigbee.light_color_colortemp,
philips.tz.effect, // Support Hue effects for groups
zigbeeHerdsmanConverters.toZigbeeConverters.ignore_transition,
zigbeeHerdsmanConverters.toZigbeeConverters.cover_position_tilt,
zigbeeHerdsmanConverters.toZigbeeConverters.thermostat_occupied_heating_setpoint,
zigbeeHerdsmanConverters.toZigbeeConverters.tint_scene,
zigbeeHerdsmanConverters.toZigbeeConverters.light_brightness_move,
zigbeeHerdsmanConverters.toZigbeeConverters.light_brightness_step,
zigbeeHerdsmanConverters.toZigbeeConverters.light_colortemp_step,
zigbeeHerdsmanConverters.toZigbeeConverters.light_colortemp_move,
zigbeeHerdsmanConverters.toZigbeeConverters.light_hue_saturation_move,
zigbeeHerdsmanConverters.toZigbeeConverters.light_hue_saturation_step,
zhc.toZigbee.ignore_transition,
zhc.toZigbee.cover_position_tilt,
zhc.toZigbee.thermostat_occupied_heating_setpoint,
zhc.toZigbee.tint_scene,
zhc.toZigbee.light_brightness_move,
zhc.toZigbee.light_brightness_step,
zhc.toZigbee.light_colortemp_step,
zhc.toZigbee.light_colortemp_move,
zhc.toZigbee.light_hue_saturation_move,
zhc.toZigbee.light_hue_saturation_step,
];
interface ParsedTopic {ID: string, endpoint: string, attribute: string, type: 'get' | 'set'}
@@ -40,18 +39,30 @@ export default class Publish extends Extension {
}
parseTopic(topic: string): ParsedTopic | null {
const match = topic.match(topicRegex);
if (!match) {
return null;
}
// The function supports the following topic formats (below are for 'set'. 'get' will look the same):
// - <base_topic>/device_name/set (endpoint and attribute is defined in the payload)
// - <base_topic>/device_name/set/attribute (default endpoint used)
// - <base_topic>/device_name/endpoint/set (attribute is defined in the payload)
// - <base_topic>/device_name/endpoint/set/attribute (payload is the value)
const ID = match[1].replace(`${settings.get().mqtt.base_topic}/`, '');
// If we didn't replace base_topic we received something we don't care about
if (ID === match[1] || ID.match(/bridge/)) {
return null;
}
// The first step is to get rid of base topic part
topic = topic.replace(`${settings.get().mqtt.base_topic}/`, '');
return {ID: ID, endpoint: match[2], type: match[3] as 'get' | 'set', attribute: match[4]};
// Also bridge requests are something we don't care about
if (topic.match(/bridge/)) return null;
// Make the rough split on get/set keyword.
// Before the get/set is the device name and optional endpoint name.
// After it there will be an optional attribute name.
const match = topic.match(topicGetSetRegex);
if (!match) return null;
const deviceNameAndEndpoint = match[1];
const attribute = match[3];
// Now parse the device/group name, and endpoint name
const entity = this.zigbee.resolveEntityAndEndpoint(deviceNameAndEndpoint);
return {ID: entity.ID, endpoint: entity.endpointID, type: match[2] as 'get' | 'set', attribute: attribute};
}
parseMessage(parsedTopic: ParsedTopic, data: eventdata.MQTTMessage): KeyValue | null {
@@ -81,8 +92,8 @@ export default class Publish extends Extension {
}
}
legacyRetrieveState(re: Device | Group, converter: zhc.ToZigbeeConverter, result: zhc.ToZigbeeConverterResult,
target: zh.Endpoint | zh.Group, key: string, meta: zhc.ToZigbeeConverterGetMeta): void {
legacyRetrieveState(re: Device | Group, converter: zhc.Tz.Converter, result: zhc.Tz.ConvertSetResult,
target: zh.Endpoint | zh.Group, key: string, meta: zhc.Tz.Meta): void {
// It's possible for devices to get out of sync when writing an attribute that's not reportable.
// So here we re-read the value after a specified timeout, this timeout could for example be the
// transition time of a color change or for forcing a state read for devices that don't
@@ -140,18 +151,14 @@ export default class Publish extends Extension {
const membersState = re instanceof Group ?
Object.fromEntries(re.zh.members.map((e) => [e.getDevice().ieeeAddr,
this.state.get(this.zigbee.resolveEntity(e.getDevice().ieeeAddr))])) : null;
let converters: zhc.ToZigbeeConverter[];
let converters: zhc.Tz.Converter[];
{
if (Array.isArray(definition)) {
const c = new Set(definition.map((d) => d.toZigbee).flat());
// @ts-expect-error
if (c.size == 0) converters = defaultGroupConverters;
else converters = Array.from(c);
} else if (definition) {
converters = definition.toZigbee;
} else {
converters = [zigbeeHerdsmanConverters.toZigbeeConverters.read,
zigbeeHerdsmanConverters.toZigbeeConverters.write];
converters = definition.toZigbee;
}
}
@@ -177,7 +184,7 @@ export default class Publish extends Extension {
entries.sort((a) => (['state', 'brightness', 'brightness_percent'].includes(a[0]) ? sorter : sorter * -1));
// For each attribute call the corresponding converter
const usedConverters: {[s: number]: zhc.ToZigbeeConverter[]} = {};
const usedConverters: {[s: number]: zhc.Tz.Converter[]} = {};
const toPublish: {[s: number | string]: KeyValue} = {};
const toPublishEntity: {[s: number | string]: Device | Group} = {};
const addToToPublish = (entity: Device | Group, payload: KeyValue): void => {
@@ -189,6 +196,9 @@ export default class Publish extends Extension {
toPublish[ID] = {...toPublish[ID], ...payload};
};
const endpointNames = re instanceof Device ? re.getEndpointNames() : [];
const propertyEndpointRegex = new RegExp(`^(.*?)_(${endpointNames.join('|')})$`);
for (let [key, value] of entries) {
let endpointName = parsedTopic.endpoint;
let localTarget = target;
@@ -200,15 +210,13 @@ export default class Publish extends Extension {
endpointName = propertyEndpointMatch[2];
key = propertyEndpointMatch[1];
localTarget = re.endpoint(endpointName);
if (localTarget == null) {
logger.error(`Device '${re.name}' has no endpoint '${endpointName}'`);
continue;
}
endpointOrGroupID = localTarget.ID;
}
if (!usedConverters.hasOwnProperty(endpointOrGroupID)) usedConverters[endpointOrGroupID] = [];
const converter = converters.find((c) => c.key.includes(key));
/* istanbul ignore next */
const converter = converters.find((c) =>
c.key.includes(key) && (!c.endpoint || c.endpoint == endpointName));
if (parsedTopic.type === 'set' && usedConverters[endpointOrGroupID].includes(converter)) {
// Use a converter for set only once
@@ -228,8 +236,11 @@ export default class Publish extends Extension {
}
// Converter didn't return a result, skip
const meta = {endpoint_name: endpointName, options: entitySettings, message: {...message}, logger, device,
state: entityState, membersState, mapped: definition};
const entitySettingsKeyValue: KeyValue = entitySettings;
const meta = {
endpoint_name: endpointName, options: entitySettingsKeyValue,
message: {...message}, logger, device, state: entityState, membersState, mapped: definition,
};
// Strip endpoint name from meta.message properties.
if (endpointName) {
@@ -297,7 +308,7 @@ export default class Publish extends Extension {
const scenesChanged = Object.values(usedConverters)
.some((cl) => cl.some((c) => c.key.some((k) => sceneConverterKeys.includes(k))));
if (scenesChanged) {
this.eventBus.emitScenesChanged();
this.eventBus.emitScenesChanged({entity: re});
}
}
}
+16 -13
View File
@@ -5,6 +5,7 @@ import Extension from './extension';
import stringify from 'json-stable-stringify-without-jsonify';
import bind from 'bind-decorator';
import utils from '../util/utils';
import * as zhc from 'zigbee-herdsman-converters';
type DebounceFunction = (() => void) & { clear(): void; } & { flush(): void; };
@@ -77,17 +78,8 @@ export default class Receive extends Extension {
}
shouldProcess(data: eventdata.DeviceMessage): boolean {
if (!data.device.definition) {
if (data.device.zh.interviewing) {
logger.debug(`Skipping message, definition is undefined and still interviewing`);
} else {
logger.warn(
`Received message from unsupported device with Zigbee model '${data.device.zh.modelID}' ` +
`and manufacturer name '${data.device.zh.manufacturerName}'`);
// eslint-disable-next-line max-len
logger.warn(`Please see: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html`);
}
if (!data.device.definition || data.device.zh.interviewing) {
logger.debug(`Skipping message, still interviewing`);
return false;
}
@@ -125,6 +117,9 @@ export default class Receive extends Extension {
// - If NO payload is returned do nothing. This is for non-standard behaviour
// for e.g. click switches where we need to count number of clicks and detect long presses.
const publish = (payload: KeyValue): void => {
const options: KeyValue = data.device.options;
zhc.postProcessConvertedFromZigbeeMessage(data.device.definition, payload, options);
if (settings.get().advanced.elapsed) {
const now = Date.now();
if (this.elapsed[data.device.ieeeAddr]) {
@@ -143,12 +138,20 @@ export default class Receive extends Extension {
}
};
const meta = {device: data.device.zh, logger, state: this.state.get(data.device)};
const deviceExposesChanged = (): void => {
this.eventBus.emitDevicesChanged();
this.eventBus.emitExposesChanged({device: data.device});
};
const meta = {device: data.device.zh, logger, state: this.state.get(data.device),
deviceExposesChanged: deviceExposesChanged};
let payload: KeyValue = {};
for (const converter of converters) {
try {
const convertData = {...data, device: data.device.zh};
const options: KeyValue = data.device.options;
const converted = await converter.convert(
data.device.definition, data, publish, data.device.options, meta);
data.device.definition, convertData, publish, options, meta);
if (converted) {
payload = {...payload, ...converted};
}
+26 -15
View File
@@ -1,10 +1,10 @@
/* eslint-disable brace-style */
import * as settings from '../util/settings';
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
export default class Device {
public zh: zh.Device;
private _definition: zhc.Definition;
public definition: zhc.Definition;
private _definitionModelID: string;
get ieeeAddr(): string {return this.zh.ieeeAddr;}
@@ -13,29 +13,31 @@ export default class Device {
get name(): string {
return this.zh.type === 'Coordinator' ? 'Coordinator' : this.options?.friendly_name || this.ieeeAddr;
}
get definition(): zhc.Definition {
// Some devices can change modelID, reconsider the definition in that case.
// https://github.com/Koenkk/zigbee-herdsman-converters/issues/3016
if (!this.zh.interviewing && (!this._definition || this._definitionModelID !== this.zh.modelID)) {
this._definition = zigbeeHerdsmanConverters.findByDevice(this.zh);
this._definitionModelID = this.zh.modelID;
}
return this._definition;
get isSupported(): boolean {
return this.zh.type === 'Coordinator' || (this.definition && !this.definition.generated);
}
constructor(device: zh.Device) {
this.zh = device;
}
exposes(): zhc.DefinitionExpose[] {
exposes(): zhc.Expose[] {
/* istanbul ignore if */
if (typeof this.definition.exposes == 'function') {
return this.definition.exposes(this.zh, this.options);
const options: KeyValue = this.options;
return this.definition.exposes(this.zh, options);
} else {
return this.definition.exposes;
}
}
async resolveDefinition(): Promise<void> {
if (!this.zh.interviewing && (!this.definition || this._definitionModelID !== this.zh.modelID)) {
this.definition = await zhc.findByDevice(this.zh, true);
this._definitionModelID = this.zh.modelID;
}
}
ensureInSettings(): void {
if (this.zh.type !== 'Coordinator' && !settings.getDevice(this.zh.ieeeAddr)) {
settings.addDevice(this.zh.ieeeAddr);
@@ -63,12 +65,21 @@ export default class Device {
}
endpointName(endpoint: zh.Endpoint): string {
let name = null;
let epName = null;
if (this.definition?.endpoint) {
name = Object.entries(this.definition?.endpoint(this.zh)).find((e) => e[1] == endpoint.ID)[0];
const mapping = this.definition?.endpoint(this.zh);
for (const [name, id] of Object.entries(mapping)) {
if (id == endpoint.ID) {
epName = name;
}
}
}
/* istanbul ignore next */
return name === 'default' ? null : name;
return epName === 'default' ? null : epName;
}
getEndpointNames(): string[] {
return Object.keys(this.definition?.endpoint?.(this.zh) ?? {}).filter((name) => name !== 'default');
}
isIkeaTradfri(): boolean {return this.zh.manufacturerID === 4476;}
+2 -3
View File
@@ -1,6 +1,6 @@
/* eslint-disable brace-style */
import * as settings from '../util/settings';
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import * as zhc from 'zigbee-herdsman-converters';
export default class Group {
public zh: zh.Group;
@@ -24,8 +24,7 @@ export default class Group {
}
membersDefinitions(): zhc.Definition[] {
return this.zh.members.map((m) =>
zigbeeHerdsmanConverters.findByDevice(m.getDevice())).filter((d) => d) as zhc.Definition[];
return this.membersDevices().map((d) => d.definition).filter((d) => d);
}
isDevice(): this is Device {return false;}
+3 -2
View File
@@ -127,7 +127,7 @@ export default class MQTT {
{retain: true, qos: 0});
this.eventBus.removeListeners(this);
logger.info('Disconnecting from MQTT server');
this.client.end();
this.client?.end();
}
subscribe(topic: string): void {
@@ -173,6 +173,7 @@ export default class MQTT {
this.eventBus.emitMQTTMessagePublished({topic, payload, options: {...defaultOptions, ...options}});
if (!this.isConnected()) {
/* istanbul ignore else */
if (!skipLog) {
logger.error(`Not connected to MQTT server!`);
logger.error(`Cannot send message: topic: '${topic}', payload: '${payload}`);
@@ -181,7 +182,7 @@ export default class MQTT {
}
if (!skipLog) {
logger.info(`MQTT publish: topic '${topic}', payload '${payload}'`);
logger.debug(`MQTT publish: topic '${topic}', payload '${payload}'`);
}
const actualOptions: mqtt.IClientPublishOptions = {...defaultOptions, ...options};
+10 -69
View File
@@ -21,6 +21,8 @@ import type {
FrameControl as ZHFrameControl,
} from 'zigbee-herdsman/dist/zcl';
import type * as zhc from 'zigbee-herdsman-converters';
import type * as ZHEvents from 'zigbee-herdsman/dist/controller/events';
import type TypeEventBus from 'lib/eventBus';
@@ -44,8 +46,11 @@ declare global {
type Extension = TypeExtension;
// Types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type ExternalDefinition = zhc.Definition & {homeassistant: any};
interface MQTTResponse {data: KeyValue, status: 'error' | 'ok', error?: string, transaction?: string}
interface MQTTOptions {qos?: QoS, retain?: boolean, properties?: {messageExpiryInterval: number}}
type Scene = {id: number, name: string};
type StateChangeReason = 'publishDebounce' | 'groupOptimistic' | 'lastSeenChanged' | 'publishCached';
type PublishEntityState = (entity: Device | Group, payload: KeyValue,
stateChangeReason?: StateChangeReason) => Promise<void>;
@@ -70,73 +75,6 @@ declare global {
}
}
// zigbee-herdsman-converters
namespace zhc {
interface Logger {
info: (message: string) => void;
warn: (message: string) => void;
error: (message: string) => void;
debug: (message: string) => void;
}
interface ToZigbeeConverterGetMeta {message?: KeyValue, mapped?: Definition | Definition[]}
interface ToZigbeeConverterResult {state: KeyValue,
membersState: {[s: string]: KeyValue}, readAfterWriteTime?: number}
interface ToZigbeeConverter {
key: string[],
convertGet?: (entity: zh.Endpoint | zh.Group, key: string, meta: ToZigbeeConverterGetMeta) => Promise<void>
convertSet?: (entity: zh.Endpoint | zh.Group, key: string, value: KeyValue | string | number,
meta: {state: KeyValue}) => Promise<ToZigbeeConverterResult>
}
interface FromZigbeeConverter {
cluster: string,
type: string[] | string,
convert: (model: Definition, msg: KeyValue, publish: (payload: KeyValue) => void, options: KeyValue,
meta: {state: KeyValue, logger: Logger, device: zh.Device}) => Promise<KeyValue>,
}
interface DefinitionExposeFeature {name: string, label: string, endpoint?: string,
property: string, value_max?: number, value_min?: number, unit?: string,
value_off?: string, value_on?: string, value_step?: number, values: string[], access: number}
interface DefinitionExpose {
type: string, name?: string, label?: string, features?: DefinitionExposeFeature[],
endpoint?: string, values?: string[], value_off?: string, value_on?: string, value_step?: number,
access: number, property: string, unit?: string,
value_min?: number, value_max?: number}
interface OtaUpdateAvailableResult {available: boolean, currentFileVersion: number, otaFileVersion: number}
interface Definition {
model: string,
zigbeeModel: string[],
endpoint?: (device: zh.Device) => {[s: string]: number}
toZigbee: ToZigbeeConverter[]
fromZigbee: FromZigbeeConverter[]
icon?: string
description: string
options: zhc.DefinitionExpose[],
vendor: string
exposes: DefinitionExpose[] | ((device: zh.Device, options: KeyValue) => DefinitionExpose[])
configure?: (device: zh.Device, coordinatorEndpoint: zh.Endpoint, logger: Logger,
options?: DeviceOptions) => Promise<void>;
onEvent?: (type: string, data: KeyValue, device: zh.Device,
settings: KeyValue, state: KeyValue) => Promise<void>;
ota?: {
isUpdateAvailable: (device: zh.Device, logger: Logger, data?: KeyValue)
=> Promise<OtaUpdateAvailableResult>;
updateToLatest: (device: zh.Device, logger: Logger,
onProgress: (progress: number, remaining: number) => void) => Promise<number>;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type ExternalDefinition = Definition & {homeassistant: any};
}
namespace eventdata {
type EntityRenamed = { entity: Device | Group, homeAssisantRename: boolean, from: string, to: string };
type DeviceRemoved = { ieeeAddr: string, name: string };
@@ -152,6 +90,7 @@ declare global {
type DeviceInterview = { device: Device, status: 'started' | 'successful' | 'failed' };
type DeviceJoined = { device: Device };
type EntityOptionsChanged = { entity: Device | Group, from: KeyValue, to: KeyValue };
type ExposesChanged = { device: Device };
type Reconfigure = { device: Device };
type DeviceLeave = { ieeeAddr: string, name: string };
type GroupMembersChanged = {group: Group, action: 'remove' | 'add' | 'remove_all',
@@ -168,6 +107,7 @@ declare global {
data: KeyValue | Array<string | number>;
meta: {zclTransactionSequenceNumber?: number; manufacturerCode?: number; frameControl?: ZHFrameControl;};
};
type ScenesChanged = { entity: Device | Group };
}
// Settings
@@ -203,7 +143,7 @@ declare global {
serial: {
disable_led: boolean,
port?: string,
adapter?: 'deconz' | 'zstack' | 'ezsp' | 'zigate',
adapter?: 'deconz' | 'zstack' | 'ezsp' | 'zigate' | 'ember',
baudrate?: number,
rtscts?: boolean,
},
@@ -256,6 +196,8 @@ declare global {
log_file: string,
log_level: 'debug' | 'info' | 'error' | 'warn',
log_syslog: KeyValue,
log_debug_to_mqtt_frontend: boolean,
log_debug_namespace_ignore: string,
pan_id: number | 'GENERATE',
ext_pan_id: number[] | 'GENERATE',
channel: number,
@@ -316,4 +258,3 @@ declare global {
qos?: 0 | 1 | 2,
}
}
-9
View File
@@ -1,9 +0,0 @@
declare module 'zigbee-herdsman-converters' {
export function findByDevice(device: zh.Device): zhc.Definition;
export function getConfigureKey(definition: zhc.Definition): string | number;
export const toZigbeeConverters: {[s: string]: zhc.ToZigbeeConverter};
export const definitions: zhc.Definition[];
export function addDeviceDefinition(definition: zhc.Definition): Promise<void>;
export function onEvent(type: string, data: KeyValue, device: zh.Device, settings: KeyValue,
state: KeyValue): Promise<void>;
}
+203 -199
View File
@@ -7,219 +7,223 @@ import fx from 'mkdir-recursive';
import {rimrafSync} from 'rimraf';
import assert from 'assert';
const colorizer = winston.format.colorize();
const LOG_LEVELS = ['error', 'warning', 'info', 'debug'] as const;
type LogLevel = typeof LOG_LEVELS[number];
type Z2MLogLevel = 'warn' | 'debug' | 'info' | 'error';
type WinstonLogLevel = 'warning' | 'debug' | 'info' | 'error';
class Logger {
private level: LogLevel;
private output: string[];
private directory: string;
private logger: winston.Logger;
private fileTransport: winston.transports.FileTransportInstance;
private debugNamespaceIgnoreRegex?: RegExp;
const z2mToWinstonLevel = (level: Z2MLogLevel): WinstonLogLevel => level === 'warn' ? 'warning' : level;
const winstonToZ2mLevel = (level: WinstonLogLevel): Z2MLogLevel => level === 'warning' ? 'warn' : level;
public init(): void {
// What transports to enable
this.output = settings.get().advanced.log_output;
// Directory to log to
const timestamp = moment(Date.now()).format('YYYY-MM-DD.HH-mm-ss');
this.directory = settings.get().advanced.log_directory.replace('%TIMESTAMP%', timestamp);
const logFilename = settings.get().advanced.log_file.replace('%TIMESTAMP%', timestamp);
// Determine the log level.
const settingLevel = settings.get().advanced.log_level;
// workaround for syslog<>npm level conflict
this.level = settingLevel === 'warn' ? 'warning' : settingLevel;
const levelWithCompensatedLength: {[s: string]: string} = {
'info': 'info ',
'error': 'error',
'warn': 'warn ',
'debug': 'debug',
};
assert(
LOG_LEVELS.includes(this.level),
`'${this.level}' is not valid log_level, use one of '${LOG_LEVELS.join(', ')}'`,
);
let logger: winston.Logger;
let fileTransport : winston.transport;
let output: string[];
let directory: string;
let logFilename: string;
let transportsToUse: winston.transport[];
const timestampFormat = (): string => moment().format(settings.get().advanced.timestamp_format);
function init(): void {
// What transports to enable
output = settings.get().advanced.log_output;
// Directory to log to
const timestamp = moment(Date.now()).format('YYYY-MM-DD.HH-mm-ss');
directory = settings.get().advanced.log_directory.replace('%TIMESTAMP%', timestamp);
logFilename = settings.get().advanced.log_file.replace('%TIMESTAMP%', timestamp);
// Make sure that log directory exists when not logging to stdout only
if (output.includes('file')) {
fx.mkdirSync(directory);
if (settings.get().advanced.log_symlink_current) {
const current = settings.get().advanced.log_directory.replace('%TIMESTAMP%', 'current');
const actual = './' + timestamp;
/* istanbul ignore next */
if (fs.existsSync(current)) {
fs.unlinkSync(current);
}
fs.symlinkSync(actual, current);
}
}
// Determine the log level.
const z2mLevel = settings.get().advanced.log_level;
const validLevels = ['info', 'error', 'warn', 'debug'];
assert(validLevels.includes(z2mLevel),
`'${z2mLevel}' is not valid log_level, use one of '${validLevels.join(', ')}'`);
const level = z2mToWinstonLevel(z2mLevel);
const timestampFormat = (): string => moment().format(settings.get().advanced.timestamp_format);
// Setup default console logger
transportsToUse = [
new winston.transports.Console({
level,
silent: !output.includes('console'),
this.logger = winston.createLogger({
level: this.level,
format: winston.format.combine(
winston.format.errors({stack: true}),
winston.format.timestamp({format: timestampFormat}),
winston.format.printf(/* istanbul ignore next */(info) => {
const {timestamp, level, message} = info;
const l = winstonToZ2mLevel(level as WinstonLogLevel);
),
levels: winston.config.syslog.levels,
});
const plainPrefix = `Zigbee2MQTT:${levelWithCompensatedLength[l]}`;
let prefix = plainPrefix;
if (process.stdout.isTTY) {
prefix = colorizer.colorize(l, plainPrefix);
}
return `${prefix} ${timestamp.split('.')[0]}: ${message}`;
const consoleSilenced = !this.output.includes('console');
// Print to user what logging is active
let logging = `Logging to console${consoleSilenced ? ' (silenced)' : ''}`;
// Setup default console logger
this.logger.add(new winston.transports.Console({
silent: consoleSilenced,
// winston.config.syslog.levels sets 'warning' as 'red'
format: winston.format.combine(
winston.format.colorize({colors: {debug: 'blue', info: 'green', warning: 'yellow', error: 'red'}}),
winston.format.printf(/* istanbul ignore next */(info) => {
return `[${info.timestamp}] ${info.level}: \t${info.namespace}: ${info.message}`;
}),
),
}),
];
}));
// Add file logger when enabled
// NOTE: the initiation of the logger, even when not added as transport tries to create the logging directory
const transportFileOptions: KeyValue = {
filename: path.join(directory, logFilename),
json: false,
level,
format: winston.format.combine(
winston.format.timestamp({format: timestampFormat}),
winston.format.printf(/* istanbul ignore next */(info) => {
const {timestamp, level, message} = info;
const l = winstonToZ2mLevel(level as WinstonLogLevel);
return `${levelWithCompensatedLength[l]} ${timestamp.split('.')[0]}: ${message}`;
}),
),
};
if (this.output.includes('file')) {
logging += `, file (filename: ${logFilename})`;
if (settings.get().advanced.log_rotation) {
transportFileOptions.tailable = true;
transportFileOptions.maxFiles = 3; // Keep last 3 files
transportFileOptions.maxsize = 10000000; // 10MB
}
// Make sure that log directory exists when not logging to stdout only
fx.mkdirSync(this.directory);
if (output.includes('file')) {
fileTransport = new winston.transports.File(transportFileOptions);
transportsToUse.push(fileTransport);
}
/* istanbul ignore next */
if (output.includes('syslog')) {
// eslint-disable-next-line
require('winston-syslog').Syslog;
const options: KeyValue = {
app_name: 'Zigbee2MQTT',
format: winston.format.printf(/* istanbul ignore next */(info) => {
return `${info.message}`;
}),
...settings.get().advanced.log_syslog,
};
if (options.hasOwnProperty('type')) options.type = options.type.toString();
// @ts-ignore
transportsToUse.push(new winston.transports.Syslog(options));
}
logger = winston.createLogger({transports: transportsToUse, levels: winston.config.syslog.levels});
}
// Cleanup any old log directory.
function cleanup(): void {
if (settings.get().advanced.log_directory.includes('%TIMESTAMP%')) {
const rootDirectory = path.join(directory, '..');
let directories = fs.readdirSync(rootDirectory).map((d) => {
d = path.join(rootDirectory, d);
return {path: d, birth: fs.statSync(d).mtime};
});
directories.sort((a: KeyValue, b: KeyValue) => b.birth - a.birth);
directories = directories.slice(10, directories.length);
directories.forEach((dir) => {
logger.debug(`Removing old log directory '${dir.path}'`);
rimrafSync(dir.path);
});
}
}
// Print to user what logging is enabled
function logOutput(): void {
if (output.includes('file')) {
if (output.includes('console')) {
logger.info(`Logging to console and directory: '${directory}' filename: ${logFilename}`);
} else {
logger.info(`Logging to directory: '${directory}' filename: ${logFilename}`);
}
cleanup();
} else if (output.includes('console')) {
logger.info(`Logging to console only'`);
}
}
function addTransport(transport: winston.transport): void {
transport.level = transportsToUse[0].level;
logger.add(transport);
}
function getLevel(): Z2MLogLevel {
return winstonToZ2mLevel(transportsToUse[0].level as WinstonLogLevel);
}
function setLevel(level: Z2MLogLevel): void {
logger.transports.forEach((transport) => transport.level = z2mToWinstonLevel(level as Z2MLogLevel));
}
function warn(message: string): void {
// winston.config.syslog.levels doesn't have warn, but is required for syslog.
logger.warning(message);
}
function warning(message: string): void {
logger.warning(message);
}
function info(message: string): void {
logger.info(message);
}
function debug(message: string): void {
logger.debug(message);
}
function error(message: string): void {
logger.error(message);
}
// Workaround for https://github.com/winstonjs/winston/issues/1629.
// https://github.com/Koenkk/zigbee2mqtt/pull/10905
/* istanbul ignore next */
async function end(): Promise<void> {
logger.end();
await new Promise<void>((resolve) => {
if (!fileTransport) {
process.nextTick(resolve);
} else {
// @ts-ignore
if (fileTransport._dest) {
// @ts-ignore
fileTransport._dest.on('finish', resolve);
} else {
// @ts-ignore
fileTransport.on('open', () => fileTransport._dest.on('finish', resolve));
if (settings.get().advanced.log_symlink_current) {
const current = settings.get().advanced.log_directory.replace('%TIMESTAMP%', 'current');
const actual = './' + timestamp;
/* istanbul ignore next */
if (fs.existsSync(current)) {
fs.unlinkSync(current);
}
fs.symlinkSync(actual, current);
}
// Add file logger when enabled
// eslint-disable-next-line max-len
// NOTE: the initiation of the logger even when not added as transport tries to create the logging directory
const transportFileOptions: KeyValue = {
filename: path.join(this.directory, logFilename),
json: false,
format: winston.format.printf(/* istanbul ignore next */(info) => {
return `[${info.timestamp}] ${info.level}: \t${info.namespace}: ${info.message}`;
}),
};
if (settings.get().advanced.log_rotation) {
transportFileOptions.tailable = true;
transportFileOptions.maxFiles = 3; // Keep last 3 files
transportFileOptions.maxsize = 10000000; // 10MB
}
this.fileTransport = new winston.transports.File(transportFileOptions);
this.logger.add(this.fileTransport);
}
});
/* istanbul ignore next */
if (this.output.includes('syslog')) {
logging += `, syslog`;
// eslint-disable-next-line
require('winston-syslog').Syslog;
const options: KeyValue = {
app_name: 'Zigbee2MQTT',
format: winston.format.printf(/* istanbul ignore next */(info) => {
return `${info.namespace}: ${info.message}`;
}),
...settings.get().advanced.log_syslog,
};
if (options.hasOwnProperty('type')) {
options.type = options.type.toString();
}
// @ts-expect-error untyped transport
this.logger.add(new winston.transports.Syslog(options));
}
this.setDebugNamespaceIgnore(settings.get().advanced.log_debug_namespace_ignore);
this.info(logging);
}
get winston(): winston.Logger {
return this.logger;
}
public addTransport(transport: winston.transport): void {
transport.level = this.level;
this.logger.add(transport);
}
public removeTransport(transport: winston.transport): void {
this.logger.remove(transport);
}
public getDebugNamespaceIgnore(): string {
return this.debugNamespaceIgnoreRegex?.toString().slice(1, -1)/* remove slashes */ ?? '';
}
public setDebugNamespaceIgnore(value: string): void {
this.debugNamespaceIgnoreRegex = value != '' ? new RegExp(value) : undefined;
}
// TODO refactor Z2M level to 'warning' to simplify logic
public getLevel(): LogLevel | 'warn' {
return this.level === 'warning' ? 'warn' : this.level;
}
public setLevel(level: LogLevel | 'warn'): void {
if (level === 'warn') {
level = 'warning';
}
this.level = level;
this.logger.transports.forEach((transport) => transport.level = this.level);
}
public warning(message: string, namespace: string = 'z2m'): void {
this.logger.warning(message, {namespace});
}
public info(message: string, namespace: string = 'z2m'): void {
this.logger.info(message, {namespace});
}
public debug(message: string, namespace: string = 'z2m'): void {
if (this.level !== 'debug') {
return;
}
if (this.debugNamespaceIgnoreRegex?.test(namespace)) {
return;
}
this.logger.debug(message, {namespace});
}
public error(message: string, namespace: string = 'z2m'): void {
this.logger.error(message, {namespace});
}
// Cleanup any old log directory.
public cleanup(): void {
if (settings.get().advanced.log_directory.includes('%TIMESTAMP%')) {
const rootDirectory = path.join(this.directory, '..');
let directories = fs.readdirSync(rootDirectory).map((d) => {
d = path.join(rootDirectory, d);
return {path: d, birth: fs.statSync(d).mtime};
});
directories.sort((a: KeyValue, b: KeyValue) => b.birth - a.birth);
directories = directories.slice(10, directories.length);
directories.forEach((dir) => {
this.debug(`Removing old log directory '${dir.path}'`);
rimrafSync(dir.path);
});
}
}
// Workaround for https://github.com/winstonjs/winston/issues/1629.
// https://github.com/Koenkk/zigbee2mqtt/pull/10905
/* istanbul ignore next */
public async end(): Promise<void> {
this.logger.end();
await new Promise<void>((resolve) => {
if (!this.fileTransport) {
process.nextTick(resolve);
} else {
// @ts-expect-error workaround
if (this.fileTransport._dest) {
// @ts-expect-error workaround
this.fileTransport._dest.on('finish', resolve);
} else {
// @ts-expect-error workaround
this.fileTransport.on('open', () => this.fileTransport._dest.on('finish', resolve));
}
}
});
}
}
export default {
init, logOutput, warn, warning, error, info, debug, setLevel, getLevel, cleanup, addTransport, end,
winston: (): winston.Logger => logger,
};
export default new Logger();
+21 -5
View File
@@ -227,7 +227,7 @@
},
"adapter": {
"type": ["string"],
"enum": ["deconz", "zstack", "zigate", "ezsp", "auto"],
"enum": ["deconz", "zstack", "zigate", "ezsp", "auto", "ember"],
"title": "Adapter",
"default": "auto",
"requiresRestart": true,
@@ -345,7 +345,7 @@
"default": false
},
"zigbee_ota_override_index_location": {
"type": "string",
"type": ["string", "null"],
"title": "OTA index override file name",
"requiresRestart": true,
"description": "Location of override OTA index file",
@@ -371,11 +371,10 @@
"requiresRestart": true
},
"host": {
"type": "string",
"type": ["string", "null"],
"title": "Bind host",
"description": "Frontend binding host. Binds to a unix socket when an absolute path is given instead.",
"examples": ["127.0.0.1", "/run/zigbee2mqtt/zigbee2mqtt.sock"],
"default": "0.0.0.0",
"examples": ["127.0.0.1", "::1", "/run/zigbee2mqtt/zigbee2mqtt.sock"],
"requiresRestart": true
},
"auth_token": {
@@ -498,6 +497,23 @@
"description": "Logging level",
"default": "info"
},
"log_debug_to_mqtt_frontend": {
"type": "boolean",
"title": "Log debug to MQTT and frontend",
"description": "Log debug level to MQTT and frontend (may decrease overall performance)",
"requiresRestart": true,
"default": false
},
"log_debug_namespace_ignore": {
"type": "string",
"title": "Log debug namespace ignore",
"description": "Do not log these namespaces (regex-based) for debug level",
"default": "",
"examples": [
"^zhc:legacy:fz:(tuya|moes)",
"^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller"
]
},
"log_syslog": {
"type": "object",
"title": "syslog",
+5 -3
View File
@@ -80,9 +80,11 @@ const defaults: RecursivePartial<Settings> = {
log_symlink_current: false,
log_output: ['console', 'file'],
log_directory: path.join(data.getPath(), 'log', '%TIMESTAMP%'),
log_file: 'log.txt',
log_file: 'log.log',
log_level: /* istanbul ignore next */ process.env.DEBUG ? 'debug' : 'info',
log_syslog: {},
log_debug_to_mqtt_frontend: false,
log_debug_namespace_ignore: '',
pan_id: 0x1a62,
ext_pan_id: [0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD],
channel: 11,
@@ -150,7 +152,7 @@ function loadSettingsWithDefaults(): void {
}
if (_settingsWithDefaults.frontend) {
const defaults = {port: 8080, auth_token: false, host: '0.0.0.0'};
const defaults = {port: 8080, auth_token: false};
const s = typeof _settingsWithDefaults.frontend === 'object' ? _settingsWithDefaults.frontend : {};
// @ts-ignore
_settingsWithDefaults.frontend = {};
@@ -593,7 +595,7 @@ export function removeDevice(IDorName: string): void {
// Remove device from groups
if (settings.groups) {
const regex =
new RegExp(`^(${device.friendly_name}|${device.ID})(/(\\d|${utils.endpointNames.join('|')}))?$`);
new RegExp(`^(${device.friendly_name}|${device.ID})(/[^/]+)?$`);
for (const group of Object.values(settings.groups).filter((g) => g.devices)) {
group.devices = group.devices.filter((device) => !device.match(regex));
}
+48 -48
View File
@@ -6,6 +6,7 @@ import fs from 'fs';
import path from 'path';
import {detailedDiff} from 'deep-object-diff';
import objectAssignDeep from 'object-assign-deep';
import type * as zhc from 'zigbee-herdsman-converters';
// construct a local ISO8601 string (instead of UTC-based)
// Example:
@@ -29,22 +30,6 @@ function toLocalISOString(date: Date): string {
':' + pad(tzOffset % 60);
}
const endpointNames = [
'left', 'right', 'center', 'bottom_left', 'bottom_right', 'default',
'top_left', 'top_right', 'white', 'rgb', 'cct', 'system', 'top', 'bottom', 'center_left', 'center_right',
'ep1', 'ep2', 'row_1', 'row_2', 'row_3', 'row_4', 'relay', 'usb',
'l1', 'l2', 'l3', 'l4', 'l5', 'l6', 'l7', 'l8',
'l9', 'l10', 'l11', 'l12', 'l13', 'l14', 'l15', 'l16',
'l17', 'l18', 'l19', 'l20', 'l21', 'l22', 'l23', 'l24',
'th1', 'th2', 'th3', 'th4', 'th5', 'th6', 'th7', 'th8', 'th9', 'th10',
'button_1', 'button_2', 'button_3', 'button_4', 'button_5',
'button_6', 'button_7', 'button_8', 'button_9', 'button_10',
'button_11', 'button_12', 'button_13', 'button_14', 'button_15',
'button_16', 'button_17', 'button_18', 'button_19', 'button_20',
'button_light', 'button_fan_high', 'button_fan_med', 'button_fan_low',
'heat', 'cool', 'water', 'meter', 'wifi', 'no_occupancy_since',
];
function capitalize(s: string): string {
return s[0].toUpperCase() + s.slice(1);
}
@@ -161,25 +146,21 @@ function loadModuleFromFile(modulePath: string): unknown {
return loadModuleFromText(moduleCode);
}
function* getExternalConvertersDefinitions(settings: Settings): Generator<zhc.ExternalDefinition> {
const externalConverters = settings.external_converters;
export function* loadExternalConverter(moduleName: string): Generator<ExternalDefinition> {
let converter;
for (const moduleName of externalConverters) {
let converter;
if (moduleName.endsWith('.js')) {
converter = loadModuleFromFile(data.joinPath(moduleName));
} else {
converter = require(moduleName);
}
if (moduleName.endsWith('.js')) {
converter = loadModuleFromFile(data.joinPath(moduleName));
} else {
converter = require(moduleName);
}
if (Array.isArray(converter)) {
for (const item of converter) {
yield item;
}
} else {
yield converter;
if (Array.isArray(converter)) {
for (const item of converter) {
yield item;
}
} else {
yield converter;
}
}
@@ -255,16 +236,10 @@ function getAllFiles(path_: string): string[] {
function validateFriendlyName(name: string, throwFirstError=false): string[] {
const errors = [];
for (const endpointName of endpointNames) {
if (name.toLowerCase().endsWith('/' + endpointName)) {
errors.push(`friendly_name is not allowed to end with: '/${endpointName}'`);
}
}
if (name.length === 0) errors.push(`friendly_name must be at least 1 char long`);
if (name.endsWith('/') || name.startsWith('/')) errors.push(`friendly_name is not allowed to end or start with /`);
if (containsControlCharacter(name)) errors.push(`friendly_name is not allowed to contain control char`);
if (endpointNames.includes(name)) errors.push(`Following friendly_name are not allowed: '${endpointNames}'`);
if (name.match(/.*\/\d*$/)) errors.push(`Friendly name cannot end with a "/DIGIT" ('${name}')`);
if (name.includes('#') || name.includes('+')) {
errors.push(`MQTT wildcard (+ and #) not allowed in friendly_name ('${name}')`);
@@ -312,12 +287,6 @@ function isAvailabilityEnabledForEntity(entity: Device | Group, settings: Settin
return !blocklist.includes(entity.name) && !blocklist.includes(entity.ieeeAddr);
}
const entityIDRegex = new RegExp(`^(.+?)(?:/(${endpointNames.join('|')}|\\d+))?$`);
function parseEntityID(ID: string): {ID: string, endpoint: string} {
const match = ID.match(entityIDRegex);
return match && {ID: match[1], endpoint: match[2]};
}
function isEndpoint(obj: unknown): obj is zh.Endpoint {
return obj.constructor.name.toLowerCase() === 'endpoint';
}
@@ -371,6 +340,18 @@ function clone(obj: KeyValue): KeyValue {
return JSON.parse(JSON.stringify(obj));
}
export function isNumericExposeFeature(feature: zhc.Feature): feature is zhc.Numeric {
return feature?.type === 'numeric';
}
export function isEnumExposeFeature(feature: zhc.Feature): feature is zhc.Enum {
return feature?.type === 'enum';
}
export function isBinaryExposeFeature(feature: zhc.Feature): feature is zhc.Binary {
return feature?.type === 'binary';
}
function computeSettingsToChange(current: KeyValue, new_: KeyValue): KeyValue {
const diff: KeyValue = detailedDiff(current, new_);
@@ -404,11 +385,30 @@ function computeSettingsToChange(current: KeyValue, new_: KeyValue): KeyValue {
return newSettings;
}
function getScenes(entity: zh.Endpoint | zh.Group): Scene[] {
const scenes: {[id: number]: Scene} = {};
const endpoints = isEndpoint(entity) ? [entity] : entity.members;
const groupID = isEndpoint(entity) ? 0 : entity.groupID;
for (const endpoint of endpoints) {
for (const [key, data] of Object.entries(endpoint.meta?.scenes || {})) {
const split = key.split('_');
const sceneID = parseInt(split[0], 10);
const sceneGroupID = parseInt(split[1], 10);
if (sceneGroupID === groupID) {
scenes[sceneID] = {id: sceneID, name: (data as KeyValue).name || `Scene ${sceneID}`};
}
}
}
return Object.values(scenes);
}
export default {
endpointNames, capitalize, getZigbee2MQTTVersion, getDependencyVersion, formatDate, objectHasProperties,
capitalize, getZigbee2MQTTVersion, getDependencyVersion, formatDate, objectHasProperties,
equalsPartial, getObjectProperty, getResponse, parseJSON, loadModuleFromText, loadModuleFromFile,
getExternalConvertersDefinitions, removeNullPropertiesFromObject, toNetworkAddressHex, toSnakeCase,
parseEntityID, isEndpoint, isZHGroup, hours, minutes, seconds, validateFriendlyName, sleep,
removeNullPropertiesFromObject, toNetworkAddressHex, toSnakeCase,
isEndpoint, isZHGroup, hours, minutes, seconds, validateFriendlyName, sleep,
sanitizeImageParameter, isAvailabilityEnabledForEntity, publishLastSeen, availabilityPayload,
getAllFiles, filterProperties, flatten, arrayUnique, clone, computeSettingsToChange,
getAllFiles, filterProperties, flatten, arrayUnique, clone, computeSettingsToChange, getScenes,
};
+2 -1
View File
@@ -4,7 +4,8 @@ import equals from 'fast-deep-equal/es6';
function read(file: string): KeyValue {
try {
return yaml.load(fs.readFileSync(file, 'utf8'));
const result = yaml.load(fs.readFileSync(file, 'utf8'));
return result as KeyValue ?? {};
} catch (error) {
if (error.name === 'YAMLException') {
error.file = file;
+50 -9
View File
@@ -11,6 +11,8 @@ import * as ZHEvents from 'zigbee-herdsman/dist/controller/events';
import bind from 'bind-decorator';
import {randomInt} from 'crypto';
const entityIDRegex = new RegExp(`^(.+?)(?:/([^/]+))?$`);
export default class Zigbee {
private herdsman: Controller;
private eventBus: EventBus;
@@ -56,13 +58,17 @@ export default class Zigbee {
let startResult;
try {
this.herdsman = new Controller(herdsmanSettings, logger);
this.herdsman = new Controller(herdsmanSettings);
startResult = await this.herdsman.start();
} catch (error) {
logger.error(`Error while starting zigbee-herdsman`);
throw error;
}
for (const device of this.devices(false)) {
await device.resolveDefinition();
}
this.herdsman.on('adapterDisconnected', () => this.eventBus.emitAdapterDisconnected());
this.herdsman.on('lastSeenChanged', (data: ZHEvents.LastSeenChangedPayload) => {
this.eventBus.emitLastSeenChanged({device: this.resolveDevice(data.device.ieeeAddr), reason: data.reason});
@@ -80,26 +86,29 @@ export default class Zigbee {
logger.debug(`Device '${device.name}' announced itself`);
this.eventBus.emitDeviceAnnounce({device});
});
this.herdsman.on('deviceInterview', (data: ZHEvents.DeviceInterviewPayload) => {
this.herdsman.on('deviceInterview', async (data: ZHEvents.DeviceInterviewPayload) => {
const device = this.resolveDevice(data.device.ieeeAddr);
/* istanbul ignore if */ if (!device) return; // Prevent potential race
await device.resolveDefinition();
const d = {device, status: data.status};
this.logDeviceInterview(d);
this.eventBus.emitDeviceInterview(d);
});
this.herdsman.on('deviceJoined', (data: ZHEvents.DeviceJoinedPayload) => {
this.herdsman.on('deviceJoined', async (data: ZHEvents.DeviceJoinedPayload) => {
const device = this.resolveDevice(data.device.ieeeAddr);
/* istanbul ignore if */ if (!device) return; // Prevent potential race
await device.resolveDefinition();
logger.info(`Device '${device.name}' joined`);
this.eventBus.emitDeviceJoined({device});
});
this.herdsman.on('deviceLeave', (data: ZHEvents.DeviceLeavePayload) => {
const name = settings.getDevice(data.ieeeAddr)?.friendly_name || data.ieeeAddr;
logger.warn(`Device '${name}' left the network`);
logger.warning(`Device '${name}' left the network`);
this.eventBus.emitDeviceLeave({ieeeAddr: data.ieeeAddr, name});
});
this.herdsman.on('message', (data: ZHEvents.MessagePayload) => {
this.herdsman.on('message', async (data: ZHEvents.MessagePayload) => {
const device = this.resolveDevice(data.device.ieeeAddr);
await device.resolveDefinition();
logger.debug(`Received Zigbee message from '${device.name}', type '${data.type}', ` +
`cluster '${data.cluster}', data '${stringify(data.data)}' from endpoint ${data.endpoint.ID}` +
(data.hasOwnProperty('groupID') ? ` with groupID ${data.groupID}` : ``) +
@@ -125,11 +134,11 @@ export default class Zigbee {
};
if (passlist.length > 0) {
if (!passlist.includes(device.ieeeAddr)) {
logger.warn(`Device which is not on passlist connected (${device.ieeeAddr}), removing...`);
logger.warning(`Device which is not on passlist connected (${device.ieeeAddr}), removing...`);
await remove(device);
}
} else if (blocklist.includes(device.ieeeAddr)) {
logger.warn(`Device on blocklist is connected (${device.ieeeAddr}), removing...`);
logger.warning(`Device on blocklist is connected (${device.ieeeAddr}), removing...`);
await remove(device);
}
}
@@ -149,11 +158,11 @@ export default class Zigbee {
if (data.status === 'successful') {
logger.info(`Successfully interviewed '${name}', device has successfully been paired`);
if (data.device.definition) {
if (data.device.isSupported) {
const {vendor, description, model} = data.device.definition;
logger.info(`Device '${name}' is supported, identified as: ${vendor} ${description} (${model})`);
} else {
logger.warn(`Device '${name}' with Zigbee model '${data.device.zh.modelID}' and manufacturer name ` +
logger.warning(`Device '${name}' with Zigbee model '${data.device.zh.modelID}' and manufacturer name ` +
`'${data.device.zh.manufacturerName}' is NOT supported, ` +
// eslint-disable-next-line max-len
`please follow https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html`);
@@ -276,6 +285,38 @@ export default class Zigbee {
}
}
resolveEntityAndEndpoint(ID: string)
: {ID: string, entity: Device | Group, endpointID: string, endpoint: zh.Endpoint} {
// This function matches the following entity formats:
// device_name (just device name)
// device_name/ep_name (device name and endpoint numeric ID or name)
// device/name (device name with slashes)
// device/name/ep_name (device name with slashes, and endpoint numeric ID or name)
// The function tries to find an exact match first
let entityName = ID;
let deviceOrGroup = this.resolveEntity(ID);
let endpointNameOrID = undefined;
// If exact match did not happenc, try matching a device_name/endpoint pattern
if (!deviceOrGroup) {
// First split the input token by the latest slash
const match = ID.match(entityIDRegex);
// Get the resulting IDs from the match
entityName = match[1];
deviceOrGroup = this.resolveEntity(match[1]);
endpointNameOrID = match[2];
}
// If the function returns non-null endpoint name, but the endpoint field is null, then
// it means that endpoint was not matched because there is no such endpoint on the device
// (or the entity is a group)
const endpoint = deviceOrGroup?.isDevice() ? deviceOrGroup.endpoint(endpointNameOrID) : null;
return {ID: entityName, entity: deviceOrGroup, endpointID: endpointNameOrID, endpoint: endpoint};
}
firstCoordinatorEndpoint(): zh.Endpoint {
return this.herdsman.getDevicesByType('Coordinator')[0].endpoints[0];
}
+1487 -8950
View File
File diff suppressed because it is too large Load Diff
+45 -41
View File
@@ -1,6 +1,6 @@
{
"name": "zigbee2mqtt",
"version": "1.33.2",
"version": "1.37.1",
"description": "Zigbee to MQTT bridge using Zigbee-herdsman",
"main": "index.js",
"repository": {
@@ -8,7 +8,7 @@
"url": "git+https://github.com/Koenkk/zigbee2mqtt.git"
},
"engines": {
"node": "^16 || ^18 || ^19 || ^20"
"node": "^18 || ^20 || ^21"
},
"keywords": [
"xiaomi",
@@ -24,11 +24,9 @@
"build-watch": "tsc --watch",
"eslint": "eslint lib/ --max-warnings=0",
"start": "node index.js",
"test-with-coverage": "jest test --coverage",
"test": "jest test",
"test-watch": "jest test --watch",
"clean": "rimraf coverage dist tsconfig.tsbuildinfo",
"prepack": "npm run clean && npm run build"
"test-with-coverage": "jest test --silent --maxWorkers=50% --coverage",
"test": "jest test --silent --maxWorkers=50%",
"test-watch": "jest test --silent --maxWorkers=25% --watch"
},
"author": "Koen Kanters",
"license": "GPL-3.0",
@@ -37,59 +35,62 @@
},
"homepage": "https://koenkk.github.io/zigbee2mqtt",
"dependencies": {
"ajv": "^8.12.0",
"ajv": "^8.13.0",
"bind-decorator": "^1.0.11",
"connect-gzip-static": "2.1.1",
"debounce": "^1.2.1",
"connect-gzip-static": "3.0.1",
"debounce": "^2.0.0",
"deep-object-diff": "^1.1.9",
"fast-deep-equal": "^3.1.3",
"finalhandler": "^1.2.0",
"git-last-commit": "^1.0.1",
"humanize-duration": "^3.30.0",
"humanize-duration": "^3.32.0",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"jszip": "^3.10.1",
"mkdir-recursive": "^0.4.0",
"moment": "^2.29.4",
"mqtt": "5.1.3",
"moment": "^2.30.1",
"mqtt": "^5.5.0",
"object-assign-deep": "^0.4.0",
"rimraf": "^5.0.5",
"semver": "^7.5.4",
"semver": "^7.6.0",
"source-map-support": "^0.5.21",
"uri-js": "^4.4.1",
"winston": "^3.11.0",
"winston": "^3.13.0",
"winston-syslog": "^2.7.0",
"winston-transport": "^4.6.0",
"ws": "^8.14.2",
"zigbee-herdsman": "0.21.0",
"zigbee-herdsman-converters": "15.106.0",
"zigbee2mqtt-frontend": "0.6.142"
"winston-transport": "^4.7.0",
"ws": "^8.17.0",
"zigbee-herdsman": "0.46.6",
"zigbee-herdsman-converters": "19.37.2",
"zigbee2mqtt-frontend": "0.6.167"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@types/debounce": "^1.2.3",
"@types/finalhandler": "^1.2.2",
"@types/humanize-duration": "^3.27.2",
"@types/jest": "^29.5.6",
"@types/js-yaml": "^4.0.8",
"@types/node": "^20.8.9",
"@types/object-assign-deep": "^0.4.2",
"@types/readable-stream": "4.0.4",
"@types/rimraf": "^3.0.2",
"@types/ws": "8.5.4",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@babel/core": "^7.24.5",
"@babel/plugin-proposal-decorators": "^7.24.1",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@types/debounce": "^1.2.4",
"@types/finalhandler": "^1.2.3",
"@types/humanize-duration": "^3.27.4",
"@types/jest": "^29.5.12",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.12.8",
"@types/object-assign-deep": "^0.4.3",
"@types/readable-stream": "4.0.12",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"babel-jest": "^29.7.0",
"eslint": "^8.52.0",
"eslint": "^8.57.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-jest": "^28.5.0",
"jest": "^29.7.0",
"tmp": "^0.2.1",
"typescript": "^5.2.2"
"tmp": "^0.2.3",
"typescript": "^5.4.5"
},
"overrides": {
"zigbee-herdsman-converters": {
"zigbee-herdsman": "$zigbee-herdsman"
}
},
"jest": {
"coverageThreshold": {
@@ -107,5 +108,8 @@
},
"bin": {
"zigbee2mqtt": "cli.js"
},
"optionalDependencies": {
"sd-notify": "^2.8.0"
}
}
+16 -6
View File
@@ -1,15 +1,25 @@
{
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "node",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"draft": false,
"include-component-in-tag": false,
"include-v-in-tag": false,
"prerelease": true,
"skip-github-release": false
"draft": true
},
"charts/zigbee2mqtt": {
"release-type": "helm",
"include-component-in-tag": false,
"include-v-in-tag": false,
"draft": true,
"extra-files": [
{
"type": "yaml",
"path": "charts/zigbee2mqtt",
"jsonpath": "$.appVersion"
}
]
}
},
"pull-request-title-pattern": "chore${scope}: release ${version}",
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
+44 -32
View File
@@ -8,6 +8,7 @@ const zhc = require('zigbee-herdsman-converters');
const z2mTillVersion = process.argv[2];
const zhcTillVersion = process.argv[3];
const zhTillVersion = process.argv[4];
const frontendTillVersion = process.argv[5];
const changelogs = [
{tillVersion: z2mTillVersion, project: 'koenkk/zigbee2mqtt',
@@ -16,16 +17,19 @@ const changelogs = [
contents: fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'zigbee-herdsman-converters', 'CHANGELOG.md'), 'utf-8').split('\n')},
{tillVersion: zhTillVersion, project: 'koenkk/zigbee-herdsman',
contents: fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'zigbee-herdsman', 'CHANGELOG.md'), 'utf-8').split('\n')},
{tillVersion: frontendTillVersion, project: 'nurikk/zigbee2mqtt-frontend', isFrontend: true,
contents: fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'zigbee2mqtt-frontend', 'CHANGELOG.md'), 'utf-8').split('\n')},
];
const releaseRe = /## \[(.+)\]/;
const changes = {features: [], fixes: [], detect: [], add: [], error: []};
const changes = {features: [], fixes: [], detect: [], add: [], error: [], frontend: []};
let context = null;
const changeRe = [
/^\* (\*\*(.+):\*\*)?(.+)\((\[#\d+\]\(.+\))\) \(\[.+\]\(https:.+\/(.+)\)\)$/,
/^\* (\*\*(.+):\*\*)?(.+)(https:\/\/github\.com.+) \(\[.+\]\(https:.+\/(.+)\)\)$/,
/^\* (\*\*(.+):\*\*)?(.+)() \(\[.+\]\(https:.+\/(.+)\)\)$/,
];
const frontendChangeRe = /^\* (\*\*.+:\*\* )()?(.+) \(\[.+\]\(https:.+\/()(.+)\)\)(.+)?$/;
let commitUserLookup = {};
const commitUserFile = path.join(__dirname, 'commit-user-lookup.json');
@@ -36,7 +40,7 @@ if (fs.existsSync(commitUserFile)) {
for (const changelog of changelogs) {
for (const line of changelog.contents) {
const releaseMatch = line.match(releaseRe);
const changeMatch = changeRe.map((re) => line.match(re)).find((e) => e);
const changeMatch = changelog.isFrontend ? line.match(frontendChangeRe) : changeRe.map((re) => line.match(re)).find((e) => e);
if (releaseMatch) {
if (releaseMatch[1] === changelog.tillVersion) {
break;
@@ -48,48 +52,55 @@ for (const changelog of changelogs) {
} else if (line.startsWith('* **ignore:**')) {
continue;
} else if (changeMatch) {
let localContext = changeMatch[2] ? changeMatch[2] : context;
if (!changes[localContext]) throw new Error(`Unknown context: ${localContext}`);
let localContext = changelog.isFrontend ? 'frontend' : (changeMatch[2] ? changeMatch[2] : context);
if (!changes[localContext]) localContext = 'error';
const commitUserKey = `${changelog.project}-${changeMatch[5]} `;
const commit = changeMatch[5];
const commitUserKey = `${changelog.project}-${commit} `;
let user = commitUserKey in commitUserLookup ? commitUserLookup[commitUserKey] :
execSync(`curl -s https://api.github.com/repos/${changelog.project}/commits/${changeMatch[5]} | jq -r '.author.login'`).toString().trim();
execSync(`curl -s https://api.github.com/repos/${changelog.project}/commits/${commit} | jq -r '.author.login'`).toString().trim();
if (user !== 'null') commitUserLookup[commitUserKey] = user;
const messages = [];
let message = changeMatch[3].trim();
if (message.endsWith('.')) message = message.substring(0, message.length - 1);
message = message.charAt(0).toUpperCase() + message.slice(1);
const otherUser = message.match(/\[@(.+)\]\(https:\/\/github.com\/.+\)/) || message.match(/@(.+)/);
if (otherUser) {
user = otherUser[1];
message = message.replace(otherUser[0], '');
}
if (localContext === 'add') {
for (const model of message.split(',')) {
const definition = zhc.definitions.find((d) => d.model === model.trim());
if (definition) {
messages.push(`\`${definition.model}\` ${definition.vendor} ${definition.description}`);
} else {
changes['error'].push(`${line} (model '${model}' does not exist)`);
}
}
} else {
if (changelog.isFrontend) {
changes[localContext].push(`- [${commit.slice(0, 7)}](https://github.com/${changelog.project}/commit/${commit}) ${message} (@${user})`);
messages.push(message);
}
} else {
const otherUser = message.match(/\[@(.+)\]\(https:\/\/github.com\/.+\)/) || message.match(/@(.+)/);
if (otherUser) {
user = otherUser[1];
message = message.replace(otherUser[0], '');
}
let issue = changeMatch[4].trim();
if (issue && !issue.startsWith('[#')) issue = `[#${issue.split('/').pop()}](${issue})`;
if (!issue) {
issue = '_NO_ISSUE_';
localContext = 'error';
}
if (localContext === 'add') {
for (const model of message.split(',')) {
const definition = zhc.definitions.find((d) => d.model === model.trim());
if (definition) {
messages.push(`\`${definition.model}\` ${definition.vendor} ${definition.description}`);
} else {
changes['error'].push(`${line} (model '${model}' does not exist)`);
}
}
} else {
messages.push(message);
}
messages.forEach((m) => changes[localContext].push(`- ${issue} ${m} (@${user})`));
} else if (line === '# Changelog' || !line) {
let issue = changeMatch[4].trim();
if (issue && !issue.startsWith('[#')) issue = `[#${issue.split('/').pop()}](${issue})`;
if (!issue) {
issue = '_NO_ISSUE_';
localContext = 'error';
}
messages.forEach((m) => changes[localContext].push(`- ${issue} ${m} (@${user})`));
}
} else if (line === '# Changelog' || line === '### ⚠ BREAKING CHANGES' || !line) {
continue;
} else {
throw new Error(`Unmatched line: ${line}`);
changes['error'].push(`- Unmatched line: ${line}`);
}
}
}
@@ -98,6 +109,7 @@ let result = '';
const names = [
['features', 'Improvements'],
['fixes', 'Fixes'],
['frontend', 'Frontend'],
['add', 'New supported devices'],
['detect', 'Fixed device detections'],
['error', 'Changelog generator error'],
-12
View File
@@ -1,12 +0,0 @@
const fs = require('fs');
const filename = process.argv[2];
const text = fs.readFileSync(filename, 'utf8');
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
for (const line of text.split('\n')) {
const [modelNumber, user] = line.split(',').map((t) => t.trim());
const model = zigbeeHerdsmanConverters.devices.find((d) => d.model === modelNumber);
if (!model) throw new Error(`${line} does not exist`);
console.log(`- \`${modelNumber}\` ${model.vendor} ${model.description} (${user})`);
}
+4 -2
View File
@@ -24,7 +24,7 @@ echo "Cloning Zigbee2MQTT git repository"
git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
chown -R pi:pi /opt/zigbee2mqtt
echo "Running install. This might take a while and can produce som expected errors"
echo "Running install. This might take a while and can produce some expected errors"
cd /opt/zigbee2mqtt || exit
su pi -c "npm ci"
@@ -36,10 +36,12 @@ Description=zigbee2mqtt
After=network.target
[Service]
ExecStart=/usr/bin/npm start
Type=notify
ExecStart=/usr/bin/node index.js
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=inherit
StandardError=inherit
WatchdogSec=10s
Restart=always
User=pi
+26 -1
View File
@@ -6,10 +6,11 @@ import zigbeeHerdsman from './stub/zigbeeHerdsman';
import utils from '../lib/util/utils';
import * as settings from '../lib/util/settings';
import Controller from '../lib/controller';
import Availability from '../lib/extension/availability';
import flushPromises from './lib/flushPromises';
import stringify from 'json-stable-stringify-without-jsonify';
const mocks = [MQTT.publish, logger.warn, logger.debug];
const mocks = [MQTT.publish, logger.warning, logger.debug];
const devices = zigbeeHerdsman.devices;
zigbeeHerdsman.returnDevices.push(
...[devices.bulb_color.ieeeAddr, devices.bulb_color_2.ieeeAddr, devices.coordinator.ieeeAddr, devices.remote.ieeeAddr])
@@ -344,4 +345,28 @@ describe('Availability', () => {
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/group_tradfri_remote/availability',
'online', {retain: true, qos: 1}, expect.any(Function));
});
it('Should clear the ping queue on stop', async () => {
const availability = controller.extensions.find((extension) => extension instanceof Availability);
const publishAvailabilitySpy = jest.spyOn(availability, 'publishAvailability');
devices.bulb_color.zh = { ping: jest.fn().mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 1000)))};
availability.addToPingQueue(devices.bulb_color);
availability.addToPingQueue(devices.bulb_color_2);
await availability.stop();
await advancedTime(utils.minutes(1));
expect(availability.pingQueue).toEqual([]);
// Validate the stop-interrupt implicitly by checking that it prevents further function invocations
expect(publishAvailabilitySpy).not.toHaveBeenCalled();
});
it('Should prevent instance restart', async () => {
const availability = controller.extensions.find((extension) => extension instanceof Availability);
await availability.stop();
await expect(() => availability.start()).rejects.toThrowError();
});
});
+31 -3
View File
@@ -157,7 +157,7 @@ describe('Bind', () => {
expect(target.configureReporting).toHaveBeenCalledWith("genOnOff",[{"attribute": "onOff", "maximumReportInterval": 0xFFFF, "minimumReportInterval": 0, "reportableChange": 0}]);
expect(target.configureReporting).toHaveBeenCalledWith("genLevelCtrl",[{"attribute": "currentLevel", "maximumReportInterval": 0xFFFF, "minimumReportInterval": 5, "reportableChange": 1}]);
expect(target.configureReporting).toHaveBeenCalledWith("lightingColorCtrl",[{"attribute":"colorTemperature","minimumReportInterval":5,"maximumReportInterval":0xFFFF,"reportableChange":1},{"attribute":"currentX","minimumReportInterval":5,"maximumReportInterval":0xFFFF,"reportableChange":1},{"attribute":"currentY","minimumReportInterval":5,"maximumReportInterval":0xFFFF,"reportableChange":1}]);
expect(zigbeeHerdsman.devices.bulb_color.meta.configured).toBe(2);
expect(zigbeeHerdsman.devices.bulb_color.meta.configured).toBe(332242049);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/unbind',
stringify({"data":{"from":"remote","to":"bulb_color","clusters":["genScenes","genOnOff","genLevelCtrl"],"failed":[]},"status":"ok"}),
@@ -387,7 +387,7 @@ describe('Bind', () => {
);
});
it('Error bind fails when source not existing', async () => {
it('Error bind fails when source device does not exist', async () => {
const device = zigbeeHerdsman.devices.remote;
const target = zigbeeHerdsman.devices.bulb_color.getEndpoint(1);
const endpoint = device.getEndpoint(1);
@@ -401,7 +401,21 @@ describe('Bind', () => {
);
});
it('Error bind fails when target not existing', async () => {
it("Error bind fails when source device's endpoint does not exist", async () => {
const device = zigbeeHerdsman.devices.remote;
const target = zigbeeHerdsman.devices.bulb_color.getEndpoint(1);
const endpoint = device.getEndpoint(1);
mockClear(device);
MQTT.events.message('zigbee2mqtt/bridge/request/device/bind', stringify({from: 'remote/not_existing_endpoint', to: 'bulb_color'}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/bind',
stringify({"data":{"from":"remote/not_existing_endpoint","to":"bulb_color"},"status":"error","error":"Source device 'remote' does not have endpoint 'not_existing_endpoint'"}),
{retain: false, qos: 0}, expect.any(Function)
);
});
it('Error bind fails when target device or group does not exist', async () => {
const device = zigbeeHerdsman.devices.remote;
const target = zigbeeHerdsman.devices.bulb_color.getEndpoint(1);
const endpoint = device.getEndpoint(1);
@@ -415,6 +429,20 @@ describe('Bind', () => {
);
});
it("Error bind fails when target device's endpoint does not exist", async () => {
const device = zigbeeHerdsman.devices.remote;
const target = zigbeeHerdsman.devices.bulb_color.getEndpoint(1);
const endpoint = device.getEndpoint(1);
mockClear(device);
MQTT.events.message('zigbee2mqtt/bridge/request/device/bind', stringify({from: 'remote', to: 'bulb_color/not_existing_endpoint'}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/bind',
stringify({"data":{"from":"remote","to":"bulb_color/not_existing_endpoint"},"status":"error","error":"Target device 'bulb_color' does not have endpoint 'not_existing_endpoint'"}),
{retain: false, qos: 0}, expect.any(Function)
);
});
it('Legacy api: Should bind', async () => {
const device = zigbeeHerdsman.devices.remote;
const target = zigbeeHerdsman.devices.bulb_color.getEndpoint(1);
+145 -15
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -8,7 +8,7 @@ const flushPromises = require('./lib/flushPromises');
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const stringify = require('json-stable-stringify-without-jsonify');
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
describe('Configure', () => {
let controller;
@@ -24,7 +24,7 @@ describe('Configure', () => {
const endpoint2 = device.getEndpoint(2);
expect(endpoint2.write).toHaveBeenCalledTimes(1);
expect(endpoint2.write).toHaveBeenCalledWith("genBasic", {"49": {"type": 25, "value": 11}}, {"disableDefaultResponse": true, "manufacturerCode": 4107});
expect(device.meta.configured).toBe(1);
expect(device.meta.configured).toBe(332242049);
}
const expectBulbConfigured = () => {
@@ -176,11 +176,11 @@ describe('Configure', () => {
});
it('Fail to configure via MQTT when device has no configure', async () => {
await MQTT.events.message('zigbee2mqtt/bridge/request/device/configure', stringify({id: "0x90fd9ffffe4b64ax", transaction: 20}));
await MQTT.events.message('zigbee2mqtt/bridge/request/device/configure', stringify({id: "0x0017882104a44559", transaction: 20}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/configure',
stringify({"data":{"id": "0x90fd9ffffe4b64ax"},"status":"error","error": "Device 'ZNLDP12LM' cannot be configured","transaction":20}),
stringify({"data":{"id": "0x0017882104a44559"},"status":"error","error": "Device 'TS0601_thermostat' cannot be configured","transaction":20}),
{retain: false, qos: 0}, expect.any(Function)
);
});
@@ -200,9 +200,9 @@ describe('Configure', () => {
});
it('Legacy api: Should skip reconfigure when device does not require this', async () => {
await MQTT.events.message('zigbee2mqtt/bridge/configure', '0x90fd9ffffe4b64ax');
await MQTT.events.message('zigbee2mqtt/bridge/configure', '0x0017882104a44559');
await flushPromises();
expect(logger.warn).toHaveBeenCalledWith(`Skipping configure of 'ZNLDP12LM', device does not require this.`)
expect(logger.warning).toHaveBeenCalledWith(`Skipping configure of 'TS0601_thermostat', device does not require this.`)
});
it('Should not configure when interview not completed', async () => {
+26 -5
View File
@@ -1,3 +1,4 @@
process.env.NOTIFY_SOCKET = "mocked";
const data = require('./stub/data');
const logger = require('./stub/logger');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
@@ -16,6 +17,16 @@ const mocksClear = [
const fs = require('fs');
jest.mock('sd-notify', () => {
return {
watchdogInterval: () => {return 3000;},
startWatchdogMode: (interval) => {},
stopWatchdogMode: () => {},
ready: () => {},
stopping: () => {},
};
}, {virtual: true});
describe('Controller', () => {
let controller;
let mockExit;
@@ -42,13 +53,13 @@ describe('Controller', () => {
it('Start controller', async () => {
await controller.start();
expect(zigbeeHerdsman.constructor).toHaveBeenCalledWith({"network":{"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11],"networkKey":[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13]},"databasePath":path.join(data.mockDir, "database.db"), "databaseBackupPath":path.join(data.mockDir, "database.db.backup"),"backupPath":path.join(data.mockDir, "coordinator_backup.json"),"acceptJoiningDeviceHandler": expect.any(Function),adapter: {concurrent: null, delay: null, disableLED: false}, "serialPort":{"baudRate":undefined,"rtscts":undefined,"path":"/dev/dummy"}}, logger);
expect(zigbeeHerdsman.constructor).toHaveBeenCalledWith({"network":{"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11],"networkKey":[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13]},"databasePath":path.join(data.mockDir, "database.db"), "databaseBackupPath":path.join(data.mockDir, "database.db.backup"),"backupPath":path.join(data.mockDir, "coordinator_backup.json"),"acceptJoiningDeviceHandler": expect.any(Function),adapter: {concurrent: null, delay: null, disableLED: false}, "serialPort":{"baudRate":undefined,"rtscts":undefined,"path":"/dev/dummy"}});
expect(zigbeeHerdsman.start).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsman.setTransmitPower).toHaveBeenCalledTimes(0);
expect(zigbeeHerdsman.permitJoin).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsman.permitJoin).toHaveBeenCalledWith(true, undefined, undefined);
expect(logger.info).toHaveBeenCalledWith(`Currently ${Object.values(zigbeeHerdsman.devices).length - 1} devices are joined:`)
expect(logger.info).toHaveBeenCalledWith('bulb (0x000b57fffec6a5b2): LED1545G12 - IKEA TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (Router)');
expect(logger.info).toHaveBeenCalledWith('bulb (0x000b57fffec6a5b2): LED1545G12 - IKEA TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (Router)');
expect(logger.info).toHaveBeenCalledWith('remote (0x0017880104e45517): 324131092621 - Philips Hue dimmer switch (EndDevice)');
expect(logger.info).toHaveBeenCalledWith('0x0017880104e45518 (0x0017880104e45518): Not supported (EndDevice)');
expect(MQTT.connect).toHaveBeenCalledTimes(1);
@@ -269,7 +280,7 @@ describe('Controller', () => {
logger.debug.mockClear();
await controller.mqtt.publish('skip-this-topic', '', {});
await MQTT.events.message('zigbee2mqtt/skip-this-topic', 'skipped');
expect(logger.debug).toHaveBeenCalledTimes(0);
expect(logger.debug).toHaveBeenCalledTimes(1);
});
it('On zigbee event message', async () => {
@@ -387,7 +398,7 @@ describe('Controller', () => {
const payload = {device, status: 'successful'};
await zigbeeHerdsman.events.deviceInterview(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/log', stringify({"type":"pairing","message":"interview_successful","meta":{"friendly_name":"bulb","model":"LED1545G12","vendor":"IKEA","description":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white","supported":true}}), { retain: false, qos: 0 }, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/log', stringify({"type":"pairing","message":"interview_successful","meta":{"friendly_name":"bulb","model":"LED1545G12","vendor":"IKEA","description":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm","supported":true}}), { retain: false, qos: 0 }, expect.any(Function));
});
it('On zigbee deviceInterview successful not supported', async () => {
@@ -546,7 +557,7 @@ describe('Controller', () => {
device = controller.zigbee.resolveEntity('unsupported2');
await controller.publishEntityState(device, {state: 'ON'});
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/unsupported2', stringify({"state":"ON","device":{"friendlyName":"unsupported2","model":"unknown","ieeeAddr":"0x0017880104e45529","networkAddress":6536,"type":"EndDevice","manufacturerID":0,"powerSource":"Battery","dateCode":null, "softwareBuildID": null}}), {"qos": 0, "retain": false}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/unsupported2', stringify({"state":"ON","device":{"friendlyName":"unsupported2","model":"notSupportedModelID","ieeeAddr":"0x0017880104e45529","networkAddress":6536,"type":"EndDevice","manufacturerID":0,"powerSource":"Battery","dateCode":null, "softwareBuildID": null}}), {"qos": 0, "retain": false}, expect.any(Function));
});
it('Should publish entity state without retain', async () => {
@@ -730,4 +741,14 @@ describe('Controller', () => {
await controller.stop();
expect(controller.state.state[device.ieeeAddr]).toStrictEqual(undefined);
});
it('EventBus should handle errors', async () => {
const eventbus = controller.eventBus;
const callback = jest.fn().mockImplementation(async () => {throw new Error('Whoops!')});
eventbus.onStateChange('test', callback);
eventbus.emitStateChange({});
await flushPromises();
expect(callback).toHaveBeenCalledTimes(1);
expect(logger.error).toHaveBeenCalledWith(`EventBus error 'String/stateChange': Whoops!`);
});
});
+21 -15
View File
@@ -10,9 +10,9 @@ const flushPromises = require('./lib/flushPromises');
const path = require('path');
const fs = require('fs');
zigbeeHerdsmanConverters.addDeviceDefinition = jest.fn();
zigbeeHerdsmanConverters.addDefinition = jest.fn();
const mocksClear = [zigbeeHerdsmanConverters.addDeviceDefinition, zigbeeHerdsman.permitJoin,
const mocksClear = [zigbeeHerdsmanConverters.addDefinition, zigbeeHerdsman.permitJoin,
mockExit, MQTT.end, zigbeeHerdsman.stop, logger.debug,
MQTT.publish, MQTT.connect, zigbeeHerdsman.devices.bulb_color.removeFromNetwork,
zigbeeHerdsman.devices.bulb.removeFromNetwork, logger.error,
@@ -67,16 +67,15 @@ describe('Loads external converters', () => {
it('Does not load external converters', async () => {
settings.set(['external_converters'], []);
await resetExtension();
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledTimes(0);
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledTimes(0);
});
it('Loads external converters', async () => {
fs.copyFileSync(path.join(__dirname, 'assets', 'mock-external-converter.js'), path.join(data.mockDir, 'mock-external-converter.js'));
const devicesCount = zigbeeHerdsman.devices.lenght;
settings.set(['external_converters'], ['mock-external-converter.js']);
await resetExtension();
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledWith({
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledWith({
mock: true,
zigbeeModel: ['external_converter_device'],
vendor: 'external',
@@ -90,11 +89,10 @@ describe('Loads external converters', () => {
it('Loads multiple external converters', async () => {
fs.copyFileSync(path.join(__dirname, 'assets', 'mock-external-converter-multiple.js'), path.join(data.mockDir, 'mock-external-converter-multiple.js'));
const devicesCount = zigbeeHerdsman.devices.lenght;
settings.set(['external_converters'], ['mock-external-converter-multiple.js']);
await resetExtension();
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledTimes(2);
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenNthCalledWith(1, {
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledTimes(2);
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenNthCalledWith(1, {
mock: 1,
model: 'external_converters_device_1',
zigbeeModel: ['external_converter_device_1'],
@@ -104,7 +102,7 @@ describe('Loads external converters', () => {
toZigbee: [],
exposes: []
});
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenNthCalledWith(2, {
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenNthCalledWith(2, {
mock: 2,
model: 'external_converters_device_2',
zigbeeModel: ['external_converter_device_2'],
@@ -119,8 +117,8 @@ describe('Loads external converters', () => {
it('Loads external converters from package', async () => {
settings.set(['external_converters'], ['mock-external-converter-module']);
await resetExtension();
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledWith({
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledWith({
mock: true
});
});
@@ -128,12 +126,20 @@ describe('Loads external converters', () => {
it('Loads multiple external converters from package', async () => {
settings.set(['external_converters'], ['mock-multiple-external-converter-module']);
await resetExtension();
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenCalledTimes(2);
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenNthCalledWith(1, {
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenCalledTimes(2);
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenNthCalledWith(1, {
mock: 1
});
expect(zigbeeHerdsmanConverters.addDeviceDefinition).toHaveBeenNthCalledWith(2, {
expect(zigbeeHerdsmanConverters.addDefinition).toHaveBeenNthCalledWith(2, {
mock: 2
});
});
it('Loads external converters with error', async () => {
fs.copyFileSync(path.join(__dirname, 'assets', 'mock-external-converter.js'), path.join(data.mockDir, 'mock-external-converter.js'));
settings.set(['external_converters'], ['mock-external-converter.js']);
zigbeeHerdsmanConverters.addDefinition.mockImplementationOnce(() => {throw new Error('Invalid definition!')});
await resetExtension();
expect(logger.error).toHaveBeenCalledWith(`Failed to load external converter file 'mock-external-converter.js' (Invalid definition!)`);
});
});
+25
View File
@@ -67,6 +67,7 @@ jest.mock('https', () => ({
mockHTTPS.variables.onRequest = onRequest;
return mockHTTPS.implementation;
}),
Agent: jest.fn(),
}));
jest.mock("connect-gzip-static", () =>
@@ -135,6 +136,30 @@ describe('Frontend', () => {
mockHTTPS.implementation.listen.mockClear();
});
it('Start/stop without host', async () => {
settings.set(['frontend'], {port: 8081});
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
expect(mockNodeStatic.variables.path).toBe("my/dummy/path");
expect(mockHTTP.implementation.listen).toHaveBeenCalledWith(8081);
const mockWSClient = {
implementation: {
terminate: jest.fn(),
send: jest.fn(),
},
events: {},
};
mockWS.implementation.clients.push(mockWSClient.implementation);
await controller.stop();
expect(mockWSClient.implementation.terminate).toHaveBeenCalledTimes(1);
expect(mockHTTP.implementation.close).toHaveBeenCalledTimes(1);
expect(mockWS.implementation.close).toHaveBeenCalledTimes(1);
mockWS.implementation.close.mockClear();
mockHTTP.implementation.close.mockClear();
mockHTTP.implementation.listen.mockClear();
mockHTTPS.implementation.listen.mockClear();
});
it('Start/stop unix socket', async () => {
settings.set(['frontend'], {host: "/tmp/zigbee2mqtt.sock"});
controller = new Controller(jest.fn(), jest.fn());
+25 -3
View File
@@ -41,7 +41,7 @@ describe('Groups', () => {
settings.reRead();
MQTT.publish.mockClear();
zigbeeHerdsman.groups.gledopto_group.command.mockClear();
zigbeeHerdsmanConverters.toZigbeeConverters.__clearStore__();
zigbeeHerdsmanConverters.toZigbee.__clearStore__();
controller.state.state = {};
})
@@ -273,7 +273,7 @@ describe('Groups', () => {
expect(logger.error).toHaveBeenCalledWith("Group 'group_1_not_existing' does not exist");
});
it('Legacy api: Log when adding to non-existing device', async () => {
it('Legacy api: Log when adding a non-existing device', async () => {
await resetExtension();
logger.error.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/group/group_1/add', 'bulb_color_not_existing');
@@ -281,6 +281,14 @@ describe('Groups', () => {
expect(logger.error).toHaveBeenCalledWith("Device 'bulb_color_not_existing' does not exist");
});
it('Legacy api: Log when adding a non-existing endpoint', async () => {
await resetExtension();
logger.error.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/group/group_1/add', 'bulb_color/not_existing_endpoint');
await flushPromises();
expect(logger.error).toHaveBeenCalledWith("Device 'bulb_color' does not have endpoint 'not_existing_endpoint'");
});
it('Should publish group state change when a device in it changes state', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
const endpoint = device.getEndpoint(1);
@@ -869,7 +877,7 @@ describe('Groups', () => {
);
});
it('Error when adding to non-existing device', async () => {
it('Error when adding a non-existing device', async () => {
await resetExtension();
logger.error.mockClear();
MQTT.publish.mockClear();
@@ -883,6 +891,20 @@ describe('Groups', () => {
);
});
it('Error when adding a non-existing endpoint', async () => {
await resetExtension();
logger.error.mockClear();
MQTT.publish.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/request/group/members/add', stringify({group: 'group_1', device: 'bulb_color/not_existing_endpoint'}));
await flushPromises();
expect(MQTT.publish).not.toHaveBeenCalledWith('zigbee2mqtt/bridge/groups', expect.any(String), expect.any(Object), expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/group/members/add',
stringify({"data":{"device":"bulb_color/not_existing_endpoint","group":"group_1"},"status":"error","error":"Device 'bulb_color' does not have endpoint 'not_existing_endpoint'"}),
{retain: false, qos: 0}, expect.any(Function)
);
});
it('Should only include relevant properties when publishing member states', async () => {
const bulbColor = zigbeeHerdsman.devices.bulb_color;
const bulbColorTemp = zigbeeHerdsman.devices.bulb;
+521 -95
View File
@@ -5,12 +5,12 @@ const logger = require('./stub/logger');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
const flushPromises = require('./lib/flushPromises');
const MQTT = require('./stub/mqtt');
const sleep = require('./stub/sleep');
const Controller = require('../lib/controller');
const fs = require('fs');
const path = require('path');
describe('HomeAssistant extension', () => {
let version;
let z2m_version;
let controller;
let extension;
let origin;
@@ -32,28 +32,30 @@ describe('HomeAssistant extension', () => {
});
beforeAll(async () => {
version = await require('../lib/util/utils').default.getZigbee2MQTTVersion();
origin = {name: 'Zigbee2MQTT', sw: version.version, url: 'https://www.zigbee2mqtt.io'}
version = `Zigbee2MQTT ${version.version}`;
z2m_version = (await require('../lib/util/utils').default.getZigbee2MQTTVersion()).version;
origin = {name: 'Zigbee2MQTT', sw: z2m_version, url: 'https://www.zigbee2mqtt.io'};
version = `Zigbee2MQTT ${z2m_version}`;
jest.useFakeTimers();
settings.set(['homeassistant'], true);
data.writeDefaultConfiguration();
settings.reRead();
data.writeEmptyState();
MQTT.publish.mockClear();
sleep.mock();
controller = new Controller(false);
await controller.start();
});
afterAll(async () => {
jest.useRealTimers();
sleep.restore();
});
it('Should not have duplicate type/object_ids in a mapping', () => {
const duplicated = [];
require('zigbee-herdsman-converters').devices.forEach((d) => {
require('zigbee-herdsman-converters').definitions.forEach((d) => {
const exposes = typeof d.exposes == 'function' ? d.exposes() : d.exposes;
const device = {definition: d, isDevice: () => true, options: {}, exposes: () => exposes};
const device = {definition: d, isDevice: () => true, isGroup: () => false, options: {}, exposes: () => exposes, zh: {endpoints: []}};
const configs = extension.getConfigs(device);
const cfg_type_object_ids = [];
@@ -81,12 +83,14 @@ describe('HomeAssistant extension', () => {
"availability":[{"topic":"zigbee2mqtt/bridge/state"}],
"brightness":true,
"brightness_scale":254,
"color_mode":true,
"command_topic":"zigbee2mqtt/ha_discovery_group/set",
"device":{
"identifiers":["zigbee2mqtt_1221051039810110150109113116116_9"],
"name":"ha_discovery_group",
"sw_version": version,
"model": "Group",
"manufacturer": "Zigbee2MQTT",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"max_mireds": 454,
"min_mireds": 250,
@@ -130,6 +134,9 @@ describe('HomeAssistant extension', () => {
"identifiers":["zigbee2mqtt_1221051039810110150109113116116_9"],
"name":"ha_discovery_group",
"sw_version": version,
"model": "Group",
"manufacturer": "Zigbee2MQTT",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic":"zigbee2mqtt/ha_discovery_group",
"name":null,
@@ -163,8 +170,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
'enabled_by_default': true,
@@ -192,8 +200,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -220,8 +229,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -249,8 +259,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -279,8 +290,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -299,10 +311,11 @@ describe('HomeAssistant extension', () => {
"identifiers":[
"zigbee2mqtt_0x0017880104e45542"
],
"manufacturer":"Xiaomi",
"model":"Aqara double key wired wall switch without neutral wire. Doesn't work as a router and doesn't support power meter (QBKG03LM)",
"manufacturer":"Aqara",
"model":"Smart wall switch (no neutral, double rocker) (QBKG03LM)",
"name":"wall_switch_double",
"sw_version": null
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic":"zigbee2mqtt/wall_switch_double",
"name":"Left",
@@ -329,10 +342,11 @@ describe('HomeAssistant extension', () => {
"identifiers":[
"zigbee2mqtt_0x0017880104e45542"
],
"manufacturer":"Xiaomi",
"model":"Aqara double key wired wall switch without neutral wire. Doesn't work as a router and doesn't support power meter (QBKG03LM)",
"manufacturer":"Aqara",
"model":"Smart wall switch (no neutral, double rocker) (QBKG03LM)",
"name":"wall_switch_double",
"sw_version": null
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic":"zigbee2mqtt/wall_switch_double",
"name":"Right",
@@ -356,7 +370,6 @@ describe('HomeAssistant extension', () => {
"availability":[{"topic":"zigbee2mqtt/bridge/state"}],
"brightness":true,
"brightness_scale":254,
"color_mode": true,
"supported_color_modes": ["color_temp"],
"min_mireds": 250,
"max_mireds": 454,
@@ -366,9 +379,10 @@ describe('HomeAssistant extension', () => {
"zigbee2mqtt_0x000b57fffec6a5b2"
],
"manufacturer":"IKEA",
"model":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)",
"model":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)",
"name":"bulb",
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"effect":true,
"effect_list":[
@@ -425,8 +439,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -453,8 +468,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -481,8 +497,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -495,7 +512,7 @@ describe('HomeAssistant extension', () => {
);
});
it('Should discover devices with overriden user configuration', async () => {
it('Should discover devices with overridden user configuration', async () => {
settings.set(['devices', '0x0017880104e45522'], {
homeassistant: {
expire_after: 30,
@@ -503,7 +520,7 @@ describe('HomeAssistant extension', () => {
temperature: {
expire_after: 90,
device: {
manufacturer: 'From Xiaomi',
manufacturer: 'From Aqara',
sw_version: 'test'
}
},
@@ -511,7 +528,7 @@ describe('HomeAssistant extension', () => {
unique_id: null,
},
device: {
manufacturer: 'Not from Xiaomi',
manufacturer: 'Not from Aqara',
model: 'custom model',
},
},
@@ -540,7 +557,8 @@ describe('HomeAssistant extension', () => {
'name': 'weather_sensor',
'sw_version': 'test',
'model': 'custom model',
'manufacturer': 'From Xiaomi',
'manufacturer': 'From Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
'expire_after': 90,
@@ -567,7 +585,8 @@ describe('HomeAssistant extension', () => {
'name': 'weather_sensor',
'sw_version': null,
'model': 'custom model',
'manufacturer': 'Not from Xiaomi',
'manufacturer': 'Not from Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'origin': origin,
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
@@ -584,7 +603,7 @@ describe('HomeAssistant extension', () => {
);
});
it('Should discover devices with overriden name', async () => {
it('Should discover devices with overridden name', async () => {
settings.set(['devices', '0x0017880104e45522'], {
homeassistant: {
name: "Weather Sensor",
@@ -612,8 +631,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'Weather Sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
'enabled_by_default': true,
@@ -641,8 +661,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'Weather Sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -655,7 +676,7 @@ describe('HomeAssistant extension', () => {
);
});
it('Should discover devices with overriden user configuration affecting type and object_id', async () => {
it('Should discover devices with overridden user configuration affecting type and object_id', async () => {
settings.set(['devices', '0x0017880104e45541'], {
friendly_name: 'my_switch',
homeassistant: {
@@ -682,10 +703,11 @@ describe('HomeAssistant extension', () => {
"identifiers": [
"zigbee2mqtt_0x0017880104e45541"
],
"manufacturer": "Xiaomi",
"model": "Aqara single key wired wall switch without neutral wire. Doesn't work as a router and doesn't support power meter (QBKG04LM)",
"manufacturer": "Aqara",
"model": "Smart wall switch (no neutral, single rocker) (QBKG04LM)",
"name": "my_switch",
"sw_version": null
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic": "zigbee2mqtt/my_switch",
"name": "my_light_name_override",
@@ -768,7 +790,8 @@ describe('HomeAssistant extension', () => {
"name":"fan",
"sw_version": null,
"model":"Universal wink enabled white ceiling fan premier remote control (99432)",
"manufacturer":"Hampton Bay"
"manufacturer":"Hampton Bay",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -785,7 +808,7 @@ describe('HomeAssistant extension', () => {
let payload;
payload = {
"action_template":"{% set values = {None:None,'idle':'off','heat':'heating','cool':'cooling','fan_only':'fan'} %}{{ values[value_json.running_state] }}",
"action_template":"{% set values = {None:None,'idle':'idle','heat':'heating','cool':'cooling','fan_only':'fan'} %}{{ values[value_json.running_state] }}",
"action_topic":"zigbee2mqtt/TS0601_thermostat",
"availability":[
{
@@ -801,7 +824,8 @@ describe('HomeAssistant extension', () => {
"manufacturer":"TuYa",
"model":"Radiator valve with thermostat (TS0601_thermostat)",
"name":"TS0601_thermostat",
"sw_version":null
"sw_version":null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"preset_mode_command_topic":"zigbee2mqtt/TS0601_thermostat/set/preset",
"preset_modes":[
@@ -870,7 +894,8 @@ describe('HomeAssistant extension', () => {
name: 'smart vent',
sw_version: null,
model: 'Smart vent (SV01)',
manufacturer: 'Keen Home'
manufacturer: 'Keen Home',
via_device: 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -890,7 +915,8 @@ describe('HomeAssistant extension', () => {
"manufacturer": "Siglis",
"model": "zigfred plus smart in-wall switch (ZFP-1A-CH)",
"name": "zigfred_plus",
"sw_version": null
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic": "zigbee2mqtt/zigfred_plus/l6",
"name": "L6",
@@ -940,8 +966,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -964,9 +991,9 @@ describe('HomeAssistant extension', () => {
it('Should warn when starting with cache_state false', async () => {
settings.set(['advanced', 'cache_state'], false);
logger.warn.mockClear();
logger.warning.mockClear();
await resetExtension();
expect(logger.warn).toHaveBeenCalledWith("In order for Home Assistant integration to work properly set `cache_state: true");
expect(logger.warning).toHaveBeenCalledWith("In order for Home Assistant integration to work properly set `cache_state: true");
});
it('Should set missing values to null', async () => {
@@ -1068,8 +1095,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -1205,8 +1233,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability_mode': 'all',
'availability': [{topic: 'zigbee2mqtt/bridge/state'}, {topic: 'zigbee2mqtt/weather_sensor/availability'}],
@@ -1257,13 +1286,6 @@ describe('HomeAssistant extension', () => {
);
});
it('Should not clear discovery when unsupported device is removed', async () => {
MQTT.publish.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/config/remove', 'unsupported2');
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
});
it('Should refresh discovery when device is renamed', async () => {
await MQTT.events.message('homeassistant/device_automation/0x0017880104e45522/action_double/config', stringify({topic: 'zigbee2mqtt/weather_sensor/action'}));
await flushPromises();
@@ -1288,8 +1310,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor_renamed',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -1323,8 +1346,9 @@ describe('HomeAssistant extension', () => {
],
"name":"weather_sensor_renamed",
"sw_version": null,
"model":"Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)",
"manufacturer":"Xiaomi"
"model":"Temperature and humidity sensor (WSDCGQ11LM)",
"manufacturer":"Aqara",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
}
}),
{ retain: true, qos: 1 },
@@ -1343,12 +1367,14 @@ describe('HomeAssistant extension', () => {
"availability":[{"topic":"zigbee2mqtt/bridge/state"}],
"brightness":true,
"brightness_scale":254,
"color_mode":true,
"command_topic":"zigbee2mqtt/ha_discovery_group_new/set",
"device":{
"identifiers":["zigbee2mqtt_1221051039810110150109113116116_9"],
"name":"ha_discovery_group_new",
"sw_version": version,
"model": "Group",
"manufacturer": "Zigbee2MQTT",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic":"zigbee2mqtt/ha_discovery_group_new",
"max_mireds": 454,
@@ -1420,8 +1446,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor_renamed',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -1452,8 +1479,9 @@ describe('HomeAssistant extension', () => {
],
"name":"bulb",
'sw_version': null,
"model":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)",
"manufacturer":"IKEA"
"model":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)",
"manufacturer":"IKEA",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
'device_class': 'update',
@@ -1494,8 +1522,9 @@ describe('HomeAssistant extension', () => {
],
"name":"button",
"sw_version": null,
"model":"Aqara wireless switch (WXKG11LM)",
"manufacturer":"Xiaomi"
"model":"Wireless mini switch (WXKG11LM)",
"manufacturer":"Aqara",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
}
};
@@ -1519,8 +1548,9 @@ describe('HomeAssistant extension', () => {
],
"name":"button",
"sw_version": null,
"model":"Aqara wireless switch (WXKG11LM)",
"manufacturer":"Xiaomi"
"model":"Wireless mini switch (WXKG11LM)",
"manufacturer":"Aqara",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
}
};
@@ -1609,7 +1639,7 @@ describe('HomeAssistant extension', () => {
await flushPromises();
expect(MQTT.publish).not.toHaveBeenCalledWith('homeassistant/device_automation/0x0017880104e45520/action_double/config', expect.any(String), expect.any(Object), expect.any(Function));
// Should rediscover when already discovered in previous session but with diferent name
// Should rediscover when already discovered in previous session but with different name
controller.extensions.find((e) => e.constructor.name === 'HomeAssistant')._clearDiscoveredTrigger();
await MQTT.events.message('homeassistant/device_automation/0x0017880104e45520/action_double/config', stringify({topic: 'zigbee2mqtt/button_other_name/action'}));
await flushPromises();
@@ -1684,8 +1714,9 @@ describe('HomeAssistant extension', () => {
],
"name":"button",
"sw_version": null,
"model":"Aqara wireless switch (WXKG11LM)",
"manufacturer":"Xiaomi"
"model":"Wireless mini switch (WXKG11LM)",
"manufacturer":"Aqara",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
}
};
@@ -1718,7 +1749,7 @@ describe('HomeAssistant extension', () => {
await MQTT.events.message('zigbee2mqtt/U202DST600ZB/l2/set', stringify({state: 'ON', brightness: 20}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/U202DST600ZB', stringify({state_l2:"ON", brightness_l2:20, linkquality: null, state_l1: null}), {"qos": 0, "retain": false}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/U202DST600ZB', stringify({state_l2:"ON", brightness_l2:20, linkquality: null, state_l1: null, power_on_behavior: null}), {"qos": 0, "retain": false}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/U202DST600ZB/l2', stringify({state:"ON", brightness:20}), {"qos": 0, "retain": false}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/U202DST600ZB/l1', stringify({state: null}), {"qos": 0, "retain": false}, expect.any(Function));
});
@@ -1858,8 +1889,9 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae'
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -1881,12 +1913,14 @@ describe('HomeAssistant extension', () => {
"availability":[{"topic":"zigbee2mqtt/bridge/state"}],
"brightness":true,
"brightness_scale":254,
"color_mode":true,
"command_topic":"zigbee2mqtt/ha_discovery_group/set",
"device":{
"identifiers":["zigbee2mqtt_1221051039810110150109113116116_9"],
"name":"ha_discovery_group",
"sw_version": version,
"model": "Group",
"manufacturer": "Zigbee2MQTT",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"json_attributes_topic":"zigbee2mqtt/ha_discovery_group",
"max_mireds": 454,
@@ -1932,12 +1966,14 @@ describe('HomeAssistant extension', () => {
"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":'{{ value_json.state }}'}],
"brightness":true,
"brightness_scale":254,
"color_mode":true,
"command_topic":"zigbee2mqtt/ha_discovery_group/set",
"device":{
"identifiers":["zigbee2mqtt_1221051039810110150109113116116_9"],
"name":"ha_discovery_group",
"sw_version": version,
"model": "Group",
"manufacturer": "Zigbee2MQTT",
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"max_mireds": 454,
"min_mireds": 250,
@@ -1989,16 +2025,16 @@ describe('HomeAssistant extension', () => {
],
"brightness":true,
"brightness_scale":254,
"color_mode":true,
"command_topic":"zigbee2mqtt/bulb/set",
"device":{
"identifiers":[
"zigbee2mqtt_0x000b57fffec6a5b2"
],
"manufacturer":"IKEA",
"model":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)",
"model":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)",
"name":"bulb",
"sw_version":null
"sw_version":null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"effect":true,
"effect_list":[
@@ -2046,9 +2082,10 @@ describe('HomeAssistant extension', () => {
"zigbee2mqtt_0x000b57fffec6a5b2"
],
"manufacturer":"IKEA",
"model":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)",
"model":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)",
"name":"bulb",
"sw_version": null
"sw_version": null,
"via_device": "zigbee2mqtt_bridge_0x00124b00120144ae",
},
"enabled_by_default":false,
"icon":"mdi:clock",
@@ -2094,9 +2131,10 @@ describe('HomeAssistant extension', () => {
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
'name': 'weather_sensor',
'sw_version': null,
'model': 'Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)',
'manufacturer': 'Xiaomi',
'configuration_url': 'http://zigbee.mqtt/#/device/0x0017880104e45522/info'
'model': 'Temperature and humidity sensor (WSDCGQ11LM)',
'manufacturer': 'Aqara',
'configuration_url': 'http://zigbee.mqtt/#/device/0x0017880104e45522/info',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
};
@@ -2108,4 +2146,392 @@ describe('HomeAssistant extension', () => {
expect.any(Function),
);
});
it('Should rediscover scenes when a scene is changed', async () => {
// Device/endpoint scenes.
const device = controller.zigbee.resolveEntity(zigbeeHerdsman.devices.bulb_color_2);
MQTT.publish.mockClear();
controller.eventBus.emitScenesChanged({entity: device});
await flushPromises();
// Discovery messages for scenes have been purged.
expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/0x000b57fffec6a5b4/scene_1/config`,
null,
{retain: true, qos: 1},
expect.any(Function),
);
jest.runOnlyPendingTimers();
await flushPromises();
let payload = {
'name': 'Chill scene',
'command_topic': 'zigbee2mqtt/bulb_color_2/set',
'payload_on': '{ "scene_recall": 1 }',
'json_attributes_topic': 'zigbee2mqtt/bulb_color_2',
'object_id': 'bulb_color_2_1_chill_scene',
'unique_id': '0x000b57fffec6a5b4_scene_1_zigbee2mqtt',
'device': {
'identifiers': [ 'zigbee2mqtt_0x000b57fffec6a5b4' ],
'name': 'bulb_color_2',
'sw_version': '5.127.1.26581',
'model': 'Hue Go (7146060PH)',
'manufacturer': 'Philips',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae',
},
'origin': origin,
'availability': [ { 'topic': 'zigbee2mqtt/bridge/state' } ]
}
expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/0x000b57fffec6a5b4/scene_1/config`,
stringify(payload),
{retain: true, qos: 1},
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledTimes( 12 );
// Group scenes.
const group = controller.zigbee.resolveEntity('ha_discovery_group');
MQTT.publish.mockClear();
controller.eventBus.emitScenesChanged({entity: group});
await flushPromises();
// Discovery messages for scenes have been purged.
expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/1221051039810110150109113116116_9/scene_4/config`,
null,
{retain: true, qos: 1},
expect.any(Function),
);
jest.runOnlyPendingTimers();
await flushPromises();
payload = {
'name': 'Scene 4',
'command_topic': 'zigbee2mqtt/ha_discovery_group/set',
'payload_on': '{ "scene_recall": 4 }',
'json_attributes_topic':'zigbee2mqtt/ha_discovery_group',
'object_id': 'ha_discovery_group_4_scene_4',
'unique_id': '9_scene_4_zigbee2mqtt',
'device': {
'identifiers': [ 'zigbee2mqtt_1221051039810110150109113116116_9' ],
'name': 'ha_discovery_group',
'sw_version': version,
'model': 'Group',
'manufacturer': 'Zigbee2MQTT',
'via_device': 'zigbee2mqtt_bridge_0x00124b00120144ae'
},
'origin': origin,
'availability': [ { 'topic': 'zigbee2mqtt/bridge/state' } ]
}
expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/1221051039810110150109113116116_9/scene_4/config`,
stringify(payload),
{retain: true, qos: 1},
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledTimes( 6 );
});
it('Should not clear bridge entities unnecessarily', async () => {
MQTT.publish.mockClear();
const topic = 'homeassistant/button/1221051039810110150109113116116_0x00124b00120144ae/restart/config';
const payload = {
'name': 'Restart',
'object_id': 'zigbee2mqtt_bridge_restart',
'unique_id': 'bridge_0x00124b00120144ae_restart_zigbee2mqtt',
'device_class': 'restart',
'command_topic': 'zigbee2mqtt/bridge/request/restart',
'payload_press': '',
'origin': origin,
'device': {
'name': 'Zigbee2MQTT Bridge',
'identifiers': ['zigbee2mqtt_bridge_0x00124b00120144ae'],
'manufacturer': 'Zigbee2MQTT',
'model': 'Bridge',
'hw_version': 'z-Stack 20190425',
'sw_version': z2m_version,
},
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
controller.eventBus.emitMQTTMessage({
topic: topic,
message: stringify(payload),
});
await flushPromises();
expect(MQTT.publish).not.toHaveBeenCalledWith(
topic,
null,
{retain: true, qos: 1},
expect.any(Function),
);
});
it('Should discover bridge entities', async () => {
settings.set(['advanced', 'homeassistant_legacy_entity_attributes'], false);
await resetExtension();
const devicePayload = {
'name': 'Zigbee2MQTT Bridge',
'identifiers': ['zigbee2mqtt_bridge_0x00124b00120144ae'],
'manufacturer': 'Zigbee2MQTT',
'model': 'Bridge',
'hw_version': 'z-Stack 20190425',
'sw_version': z2m_version,
};
// Binary sensors.
let payload;
payload = {
'name': 'Connection state',
'object_id': 'zigbee2mqtt_bridge_connection_state',
'entity_category': 'diagnostic',
'device_class': 'connectivity',
'unique_id': 'bridge_0x00124b00120144ae_connection_state_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/state',
'value_template': '{{ value }}',
'payload_on': 'online',
'payload_off': 'offline',
'origin': origin,
'device': devicePayload,
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/binary_sensor/1221051039810110150109113116116_0x00124b00120144ae/connection_state/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
payload = {
'name': 'Restart required',
'object_id': 'zigbee2mqtt_bridge_restart_required',
'entity_category': 'diagnostic',
'device_class': 'problem',
'enabled_by_default': false,
'unique_id': 'bridge_0x00124b00120144ae_restart_required_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ value_json.restart_required }}',
'payload_on': true,
'payload_off': false,
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/binary_sensor/1221051039810110150109113116116_0x00124b00120144ae/restart_required/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
// Buttons.
payload = {
'name': 'Restart',
'object_id': 'zigbee2mqtt_bridge_restart',
'unique_id': 'bridge_0x00124b00120144ae_restart_zigbee2mqtt',
'device_class': 'restart',
'command_topic': 'zigbee2mqtt/bridge/request/restart',
'payload_press': '',
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/button/1221051039810110150109113116116_0x00124b00120144ae/restart/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
// Selects.
payload = {
'name': 'Log level',
'object_id': 'zigbee2mqtt_bridge_log_level',
'entity_category': 'config',
'unique_id': 'bridge_0x00124b00120144ae_log_level_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ value_json.log_level | lower }}',
'command_topic': 'zigbee2mqtt/bridge/request/options',
'command_template':
'{"options": {"advanced": {"log_level": "{{ value }}" } } }',
'options': ['info', 'warn', 'error', 'debug'],
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/select/1221051039810110150109113116116_0x00124b00120144ae/log_level/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
// Sensors.
payload = {
'name': 'Version',
'object_id': 'zigbee2mqtt_bridge_version',
'entity_category': 'diagnostic',
'icon': 'mdi:zigbee',
'unique_id': 'bridge_0x00124b00120144ae_version_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ value_json.version }}',
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/sensor/1221051039810110150109113116116_0x00124b00120144ae/version/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
payload = {
'name': 'Coordinator version',
'object_id': 'zigbee2mqtt_bridge_coordinator_version',
'entity_category': 'diagnostic',
'enabled_by_default': false,
'icon': 'mdi:chip',
'unique_id': 'bridge_0x00124b00120144ae_coordinator_version_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ value_json.coordinator.meta.revision }}',
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/sensor/1221051039810110150109113116116_0x00124b00120144ae/coordinator_version/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
payload = {
'name': 'Network map',
'object_id': 'zigbee2mqtt_bridge_network_map',
'entity_category': 'diagnostic',
'enabled_by_default': false,
'unique_id': 'bridge_0x00124b00120144ae_network_map_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/response/networkmap',
'value_template': "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}",
'json_attributes_topic': 'zigbee2mqtt/bridge/response/networkmap',
'json_attributes_template': '{{ value_json.data.value | tojson }}',
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/sensor/1221051039810110150109113116116_0x00124b00120144ae/network_map/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
payload = {
'name': 'Permit join timeout',
'object_id': 'zigbee2mqtt_bridge_permit_join_timeout',
'entity_category': 'diagnostic',
'device_class': 'duration',
'unit_of_measurement': 's',
'unique_id': 'bridge_0x00124b00120144ae_permit_join_timeout_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ iif(value_json.permit_join_timeout is defined, value_json.permit_join_timeout, None) }}',
'origin': origin,
'device': devicePayload,
'availability': [{'topic': 'zigbee2mqtt/bridge/state'}],
'availability_mode': 'all',
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/sensor/1221051039810110150109113116116_0x00124b00120144ae/permit_join_timeout/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
// Switches.
payload = {
'name': 'Permit join',
'object_id': 'zigbee2mqtt_bridge_permit_join',
'icon': 'mdi:human-greeting-proximity',
'unique_id': 'bridge_0x00124b00120144ae_permit_join_zigbee2mqtt',
'state_topic': 'zigbee2mqtt/bridge/info',
'value_template': '{{ value_json.permit_join | lower }}',
'command_topic': 'zigbee2mqtt/bridge/request/permit_join',
'payload_on': 'true',
'payload_off': 'false',
'origin': origin,
'device': devicePayload,
'availability': [ { 'topic': 'zigbee2mqtt/bridge/state' } ],
'availability_mode': 'all'
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/switch/1221051039810110150109113116116_0x00124b00120144ae/permit_join/config',
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
});
it('Should remove discovery entries for removed exposes when device options change', async () => {
MQTT.publish.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/request/device/options', stringify({"id": "0xf4ce368a38be56a1", "options": {"dimmer_1_enabled": "false", "dimmer_1_dimming_enabled": "false"}}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/light/0xf4ce368a38be56a1/light_l2/config',
null,
{ retain: true, qos: 1 },
expect.any(Function),
);
});
it('Should publish discovery message when a converter announces changed exposes', async () => {
MQTT.publish.mockClear();
const device = zigbeeHerdsman.devices['BMCT-SLZ'];
const data = {deviceMode: 0}
const msg = {data, cluster: 'manuSpecificBosch10', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(msg);
const payload = {
'availability':[{'topic':'zigbee2mqtt/bridge/state'}],
'command_topic':'zigbee2mqtt/0x18fc26000000cafe/set/device_mode',
'device':{
'identifiers':['zigbee2mqtt_0x18fc26000000cafe'],
'manufacturer':'Bosch',
'model':'Light/shutter control unit II (BMCT-SLZ)',
'name':'0x18fc26000000cafe',
'sw_version':null,
'via_device':'zigbee2mqtt_bridge_0x00124b00120144ae'
},
'entity_category':'config',
'icon':'mdi:tune',
'json_attributes_topic':'zigbee2mqtt/0x18fc26000000cafe',
'name':'Device mode',
'object_id':'0x18fc26000000cafe_device_mode',
'options':['light','shutter','disabled'],
'origin': origin,
'state_topic':'zigbee2mqtt/0x18fc26000000cafe',
'unique_id':'0x18fc26000000cafe_device_mode_zigbee2mqtt',
'value_template':'{{ value_json.device_mode }}',
'enabled_by_default': true,
}
expect(MQTT.publish).toHaveBeenCalledWith(
"homeassistant/select/0x18fc26000000cafe/device_mode/config",
stringify(payload),
{ retain: true, qos: 1 },
expect.any(Function),
);
});
});
+3 -3
View File
@@ -25,7 +25,7 @@ describe('Bridge legacy', () => {
data.writeDefaultConfiguration();
settings.reRead();
logger.info.mockClear();
logger.warn.mockClear();
logger.warning.mockClear();
});
afterAll(async () => {
@@ -183,7 +183,7 @@ describe('Bridge legacy', () => {
const payload = JSON.parse(MQTT.publish.mock.calls[0][1]);
expect(payload.length).toStrictEqual(Object.values(zigbeeHerdsman.devices).length);
expect(payload[1]).toStrictEqual({"ieeeAddr": "0x00124b00120144ae", "type": "Coordinator", "dateCode": "20190425", "friendly_name": "Coordinator", networkAddress: 0, softwareBuildID: "z-Stack", lastSeen: 100});
expect(payload[2]).toStrictEqual({"dateCode": null, "friendly_name": "bulb", "ieeeAddr": "0x000b57fffec6a5b2", "lastSeen": 1000, "manufacturerID": 4476, "model": "LED1545G12", "modelID": "TRADFRI bulb E27 WS opal 980lm", "networkAddress": 40369, "powerSource": "Mains (single phase)", "softwareBuildID": null, "type": "Router", "description": "TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white", "vendor": "IKEA"});
expect(payload[2]).toStrictEqual({"dateCode": null, "friendly_name": "bulb", "ieeeAddr": "0x000b57fffec6a5b2", "lastSeen": 1000, "manufacturerID": 4476, "model": "LED1545G12", "modelID": "TRADFRI bulb E27 WS opal 980lm", "networkAddress": 40369, "powerSource": "Mains (single phase)", "softwareBuildID": null, "type": "Router", "description": "TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm", "vendor": "IKEA"});
Date.now = now;
});
@@ -478,6 +478,6 @@ describe('Bridge legacy', () => {
MQTT.events.message('zigbee2mqtt/bridge/config/touchlink/factory_reset', '');
await flushPromises();
expect(zigbeeHerdsman.touchlinkFactoryResetFirst).toHaveBeenCalledTimes(1);
expect(logger.warn).toHaveBeenCalledWith('Failed to factory reset device through Touchlink');
expect(logger.warning).toHaveBeenCalledWith('Failed to factory reset device through Touchlink');
});
});
+1 -1
View File
@@ -16,7 +16,7 @@ const Controller = require('../../lib/controller');
const flushPromises = require('../lib/flushPromises');
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
describe('Report', () => {
let controller;
+114 -63
View File
@@ -9,6 +9,8 @@ const {rimrafSync} = require('rimraf');
const Transport = require('winston-transport');
describe('Logger', () => {
let logger;
beforeEach(async () => {
data.writeDefaultConfiguration();
jest.resetModules();
@@ -17,6 +19,8 @@ describe('Logger', () => {
settings.reRead();
stdOutWriteOriginal = console._stdout.write;
console._stdout.write = () => {};
logger = require('../lib/util/logger').default;
logger.init();
});
afterEach(async () => {
@@ -24,18 +28,11 @@ describe('Logger', () => {
});
it('Create log directory', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const dirs = fs.readdirSync(dir.name);
expect(dirs.length).toBe(1);
});
it('Should cleanup', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
for (const d of fs.readdirSync(dir.name)) {
rimrafSync(path.join(dir.name, d));
}
@@ -50,54 +47,54 @@ describe('Logger', () => {
})
it('Should not cleanup when there is no timestamp set', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
for (let i = 30; i < 40; i++) {
fs.mkdirSync(path.join(dir.name, `log_${i}`));
}
settings.set(['advanced', 'log_directory'], dir.name + '/bla');
expect(fs.readdirSync(dir.name).length).toBe(20);
expect(fs.readdirSync(dir.name).length).toBe(21);
logger.cleanup();
expect(fs.readdirSync(dir.name).length).toBe(20);
expect(fs.readdirSync(dir.name).length).toBe(21);
})
it('Set and get log level', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
logger.setLevel('debug');
expect(logger.getLevel()).toBe('debug');
logger.setLevel('info');
expect(logger.getLevel()).toBe('info');
logger.setLevel('warning');
expect(logger.getLevel()).toBe('warn');// match old Z2M levels
logger.setLevel('warn');
expect(logger.getLevel()).toBe('warn');// match old Z2M levels
logger.setLevel('error');
expect(logger.getLevel()).toBe('error');
});
it('Add transport', () => {
it('Set warning when log level is warn', () => {
settings.set(['advanced', 'log_level'], 'warn');
settings.reRead();
logger.init();
expect(logger.level).toBe('warning');// getLevel() reports old Z2M level to match display/value
settings.set(['advanced', 'log_level'], 'info');
settings.reRead();
});
it('Add/remove transport', () => {
class DummyTransport extends Transport {
log(info, callback) {
}
}
const logger = require('../lib/util/logger').default;
logger.init();
expect(logger.winston().transports.length).toBe(2);
logger.addTransport(new DummyTransport());
expect(logger.winston().transports.length).toBe(3);
});
it('Set and get log level warn <-> warning', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
logger.setLevel('warn');
expect(logger.winston().transports[0].level).toBe('warning');
expect(logger.getLevel()).toBe('warn');
expect(logger.winston.transports.length).toBe(2);
const transport = new DummyTransport();
logger.addTransport(transport);
expect(logger.winston.transports.length).toBe(3);
logger.removeTransport(transport);
expect(logger.winston.transports.length).toBe(2);
});
it('Logger should be console and file by default', () => {
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const pipes = logger.winston()._readableState.pipes;
const pipes = logger.winston._readableState.pipes;
expect(pipes.length).toBe(2);
expect(pipes[0].constructor.name).toBe('Console');
expect(pipes[0].silent).toBe(false);
@@ -107,10 +104,8 @@ describe('Logger', () => {
it('Logger can be file only', () => {
settings.set(['advanced', 'log_output'], ['file']);
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const pipes = logger.winston()._readableState.pipes;
const pipes = logger.winston._readableState.pipes;
expect(pipes.length).toBe(2);
expect(pipes[0].constructor.name).toBe('Console');
expect(pipes[0].silent).toBe(true);
@@ -120,30 +115,24 @@ describe('Logger', () => {
it('Logger can be console only', () => {
settings.set(['advanced', 'log_output'], ['console']);
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const pipes = logger.winston()._readableState.pipes;
const pipes = logger.winston._readableState.pipes;
expect(pipes.constructor.name).toBe('Console');
expect(pipes.silent).toBe(false);
});
it('Logger can be nothing', () => {
settings.set(['advanced', 'log_output'], []);
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const pipes = logger.winston()._readableState.pipes;
const pipes = logger.winston._readableState.pipes;
expect(pipes.constructor.name).toBe('Console');
expect(pipes.silent).toBe(true);
});
it('Should allow to disable log rotation', () => {
settings.set(['advanced', 'log_rotation'], false);
const logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
const pipes = logger.winston()._readableState.pipes;
const pipes = logger.winston._readableState.pipes;
expect(pipes[1].constructor.name).toBe('File');
expect(pipes[1].maxFiles).toBeNull();
expect(pipes[1].tailable).toBeFalsy();
@@ -152,9 +141,7 @@ describe('Logger', () => {
it('Should allow to symlink logs to current directory', () => {
settings.set(['advanced', 'log_symlink_current'], true);
let logger = require('../lib/util/logger').default;
logger.init();
logger.logOutput();
expect(fs.readdirSync(dir.name).includes('current')).toBeTruthy()
jest.resetModules();
@@ -162,26 +149,90 @@ describe('Logger', () => {
});
it('Log', () => {
const logger = require('../lib/util/logger').default;
logger.init();
const warn = jest.spyOn(logger.winston(), 'warning');
logger.warn('warn');
expect(warn).toHaveBeenCalledWith('warn');
logger.setLevel('debug');
const debug = jest.spyOn(logger.winston(), 'debug');
const debug = jest.spyOn(logger.winston, 'debug');
logger.debug('debug');
expect(debug).toHaveBeenCalledWith('debug');
expect(debug).toHaveBeenCalledWith('debug', {namespace: 'z2m'});
expect(debug).toHaveBeenCalledTimes(1);
const warning = jest.spyOn(logger.winston(), 'warning');
logger.warning('warning');
expect(warning).toHaveBeenCalledWith('warning');
const info = jest.spyOn(logger.winston(), 'info');
const info = jest.spyOn(logger.winston, 'info');
logger.info('info');
expect(info).toHaveBeenCalledWith('info');
expect(info).toHaveBeenCalledWith('info', {namespace: 'z2m'});
expect(info).toHaveBeenCalledTimes(1);
const error = jest.spyOn(logger.winston(), 'error');
const warning = jest.spyOn(logger.winston, 'warning');
logger.warning('warning');
expect(warning).toHaveBeenCalledWith('warning', {namespace: 'z2m'});
expect(warning).toHaveBeenCalledTimes(1);
const error = jest.spyOn(logger.winston, 'error');
logger.error('error');
expect(error).toHaveBeenCalledWith('error');
expect(error).toHaveBeenCalledWith('error', {namespace: 'z2m'});
logger.error(new Error('error'));// test for stack=true
expect(error).toHaveBeenCalledWith('error', {namespace: 'z2m'});
expect(error).toHaveBeenCalledTimes(2);
});
it.each([
[
'^zhc:legacy:fz:(tuya|moes)',
new RegExp(/^zhc:legacy:fz:(tuya|moes)/),
[
{ ns: 'zhc:legacy:fz:tuya_device12', match: true },
{ ns: 'zhc:legacy:fz:moes_dimmer', match: true },
{ ns: 'zhc:legacy:fz:not_moes', match: false },
{ ns: 'zhc:legacy:fz', match: false },
{ ns: 'zhc:legacy:fz:', match: false },
{ ns: '1zhc:legacy:fz:tuya_device12', match: false },
]
],
[
'^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller',
new RegExp(/^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller/),
[
{ ns: 'zh:ember:uart:ash', match: true },
{ ns: 'zh:ember:uart', match: false },
{ ns: 'zh:controller', match: true },
{ ns: 'zh:controller:', match: true },
{ ns: 'azh:controller:', match: false },
]
],
[
'',
undefined,
[
{ ns: 'zhc:legacy:fz:tuya_device12', match: false },
{ ns: 'zhc:legacy:fz:moes_dimmer', match: false },
{ ns: 'zhc:legacy:fz:not_moes', match: false },
{ ns: 'zhc:legacy:fz', match: false },
{ ns: 'zhc:legacy:fz:', match: false },
{ ns: '1zhc:legacy:fz:tuya_device12', match: false },
{ ns: 'zh:ember:uart:ash', match: false },
{ ns: 'zh:ember:uart', match: false },
{ ns: 'zh:controller', match: false },
{ ns: 'zh:controller:', match: false },
{ ns: 'azh:controller:', match: false },
]
],
])('Sets namespace ignore for debug level %s', (ignore, expected, tests) => {
logger.setLevel('debug');
const debugSpy = jest.spyOn(logger.winston, 'debug');
logger.setDebugNamespaceIgnore(ignore);
expect(logger.debugNamespaceIgnoreRegex).toStrictEqual(expected);
expect(logger.getDebugNamespaceIgnore()).toStrictEqual(ignore);
for (const test of tests) {
logger.debug('Test message', test.ns);
if (test.match) {
expect(debugSpy).not.toHaveBeenCalled();
} else {
expect(debugSpy).toHaveBeenCalled();
}
debugSpy.mockClear();
}
})
});
+13 -13
View File
@@ -17,7 +17,7 @@ const MQTT = require('./stub/mqtt');
const settings = require('../lib/util/settings');
const Controller = require('../lib/controller');
const flushPromises = require('./lib/flushPromises');
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
const setTimeoutNative = setTimeout;
describe('Networkmap', () => {
@@ -102,7 +102,7 @@ describe('Networkmap', () => {
let call = MQTT.publish.mock.calls[0];
expect(call[0]).toStrictEqual('zigbee2mqtt/bridge/networkmap/raw');
const expected = {"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":110,"lqi":110,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":100,"lqi":100,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"sourceIeeeAddr":"0x0017880104e45559","sourceNwkAddr":6540,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white","model":"LED1545G12","supports":"light (state, brightness, color_temp, color_temp_startup), effect, power_on_behavior, color_options, linkquality","vendor":"IKEA"},"failed":[],"friendlyName":"bulb","ieeeAddr":"0x000b57fffec6a5b2","lastSeen":1000,"modelID":"TRADFRI bulb E27 WS opal 980lm","networkAddress":40369,"type":"Router"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Aqara double key wireless wall switch (2016 model)","model":"WXKG02LM_rev1","supports":"battery, action, voltage, power_outage_count, linkquality","vendor":"Xiaomi"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":null,"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"[CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/)","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description": "external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]};
const expected = {"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":110,"lqi":110,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":100,"lqi":100,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"sourceIeeeAddr":"0x0017880104e45559","sourceNwkAddr":6540,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm","model":"LED1545G12","supports":"light (state, brightness, color_temp, color_temp_startup), effect, power_on_behavior, color_options, identify, linkquality","vendor":"IKEA"},"failed":[],"friendlyName":"bulb","ieeeAddr":"0x000b57fffec6a5b2","lastSeen":1000,"modelID":"TRADFRI bulb E27 WS opal 980lm","networkAddress":40369,"type":"Router"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Wireless remote switch (double rocker), 2016 model","model":"WXKG02LM_rev1","supports":"battery, voltage, power_outage_count, action, linkquality","vendor":"Aqara"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":{"description":"Automatically generated definition","model":"notSupportedModelID","supports":"action, linkquality","vendor":"Boef"},"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"CC2530 router","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description":"external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]};
expect(JSON.parse(call[1])).toStrictEqual(expected);
/**
@@ -143,15 +143,15 @@ describe('Networkmap', () => {
const expected = `digraph G {
node[shape=record];
"0x00124b00120144ae" [style="bold, filled", fillcolor="#e04e5d", fontcolor="#ffffff", label="{Coordinator|0x00124b00120144ae (0x0000)|0 seconds ago}"];
"0x000b57fffec6a5b2" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{bulb|0x000b57fffec6a5b2 (0x9db1)|IKEA TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)|9 seconds ago}"];
"0x000b57fffec6a5b2" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{bulb|0x000b57fffec6a5b2 (0x9db1)|IKEA TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)|9 seconds ago}"];
"0x000b57fffec6a5b2" -> "0x00124b00120144ae" [penwidth=2, weight=1, color="#009900", label="92 (routes: 0x198c)"]
"0x000b57fffec6a5b3" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{bulb_color|0x000b57fffec6a5b3 (0x9dcf)|Philips Hue Go (7146060PH)|unknown}"];
"0x000b57fffec6a5b3" -> "0x00124b00120144ae" [penwidth=0.5, weight=0, color="#994444", label="120"]
"0x000b57fffec6a5b3" -> "0x000b57fffec6a5b2" [penwidth=0.5, weight=0, color="#994444", label="110"]
"0x0017880104e45521" [style="rounded, dashed, filled", fillcolor="#fff8ce", fontcolor="#000000", label="{button_double_key|0x0017880104e45521 (0x198a)|Xiaomi Aqara double key wireless wall switch (2016 model) (WXKG02LM_rev1)|9 seconds ago}"];
"0x0017880104e45521" [style="rounded, dashed, filled", fillcolor="#fff8ce", fontcolor="#000000", label="{button_double_key|0x0017880104e45521 (0x198a)|Aqara Wireless remote switch (double rocker), 2016 model (WXKG02LM_rev1)|9 seconds ago}"];
"0x0017880104e45521" -> "0x0017880104e45559" [penwidth=1, weight=0, color="#994444", label="130"]
"0x0017880104e45525" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{0x0017880104e45525|0x0017880104e45525 (0x1988)failed: lqi,routingTable|Boef notSupportedModelID|9 seconds ago}"];
"0x0017880104e45559" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{cc2530_router|0x0017880104e45559 (0x198c)|Custom devices (DiY) [CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/) (CC2530.ROUTER)|9 seconds ago}"];
"0x0017880104e45525" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{0x0017880104e45525|0x0017880104e45525 (0x1988)failed: lqi,routingTable|Boef Automatically generated definition (notSupportedModelID)|9 seconds ago}"];
"0x0017880104e45559" [style="rounded, filled", fillcolor="#4ea3e0", fontcolor="#ffffff", label="{cc2530_router|0x0017880104e45559 (0x198c)|Custom devices (DiY) CC2530 router (CC2530.ROUTER)|9 seconds ago}"];
"0x0017880104e45559" -> "0x000b57fffec6a5b2" [penwidth=0.5, weight=0, color="#994444", label="100"]
"0x0017880104e45511" [style="rounded, dashed, filled", fillcolor="#fff8ce", fontcolor="#000000", label="{0x0017880104e45511|0x0017880104e45511 (0x045a)|external external (external_converter_device)|9 seconds ago}"];
"0x0017880104e45511" -> "0x00124b00120144ae" [penwidth=1, weight=0, color="#994444", label="92"]
@@ -197,7 +197,7 @@ describe('Networkmap', () => {
---
0x0017880104e45525 (0x1988) failed: lqi,routingTable
---
Boef notSupportedModelID
Boef Automatically generated definition (notSupportedModelID)
---
9 seconds ago
]
@@ -207,7 +207,7 @@ describe('Networkmap', () => {
---
0x000b57fffec6a5b2 (0x9db1)
---
IKEA TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)
IKEA TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm (LED1545G12)
---
9 seconds ago
]
@@ -227,7 +227,7 @@ describe('Networkmap', () => {
---
0x0017880104e45521 (0x198a)
---
Xiaomi Aqara double key wireless wall switch (2016 model) (WXKG02LM_rev1)
Aqara Wireless remote switch (double rocker), 2016 model (WXKG02LM_rev1)
---
9 seconds ago
]
@@ -237,7 +237,7 @@ describe('Networkmap', () => {
---
0x0017880104e45559 (0x198c)
---
Custom devices (DiY) [CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/) (CC2530.ROUTER)
Custom devices (DiY) CC2530 router (CC2530.ROUTER)
---
9 seconds ago
]
@@ -276,12 +276,12 @@ describe('Networkmap', () => {
let call = MQTT.publish.mock.calls[0];
expect(call[0]).toStrictEqual('zigbee2mqtt/bridge/response/networkmap');
const expected = {"data":{"routes":true,"type":"raw","value":{"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":110,"lqi":110,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":100,"lqi":100,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"sourceIeeeAddr":"0x0017880104e45559","sourceNwkAddr":6540,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white","model":"LED1545G12","supports":"light (state, brightness, color_temp, color_temp_startup), effect, power_on_behavior, color_options, linkquality","vendor":"IKEA"},"failed":[],"friendlyName":"bulb","ieeeAddr":"0x000b57fffec6a5b2","lastSeen":1000,"modelID":"TRADFRI bulb E27 WS opal 980lm","networkAddress":40369,"type":"Router"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Aqara double key wireless wall switch (2016 model)","model":"WXKG02LM_rev1","supports":"battery, action, voltage, power_outage_count, linkquality","vendor":"Xiaomi"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":null,"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"[CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/)","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description":"external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]}},"status":"ok"};
const expected = {"data":{"routes":true,"type":"raw","value":{"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":110,"lqi":110,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":100,"lqi":100,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"sourceIeeeAddr":"0x0017880104e45559","sourceNwkAddr":6540,"target":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"targetIeeeAddr":"0x000b57fffec6a5b2"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"TRADFRI bulb E26/E27, white spectrum, globe, opal, 980 lm","model":"LED1545G12","supports":"light (state, brightness, color_temp, color_temp_startup), effect, power_on_behavior, color_options, identify, linkquality","vendor":"IKEA"},"failed":[],"friendlyName":"bulb","ieeeAddr":"0x000b57fffec6a5b2","lastSeen":1000,"modelID":"TRADFRI bulb E27 WS opal 980lm","networkAddress":40369,"type":"Router"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Wireless remote switch (double rocker), 2016 model","model":"WXKG02LM_rev1","supports":"battery, voltage, power_outage_count, action, linkquality","vendor":"Aqara"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":{"description":"Automatically generated definition","model":"notSupportedModelID","supports":"action, linkquality","vendor":"Boef"},"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"CC2530 router","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description":"external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]}},"status":"ok"};
const actual = JSON.parse(call[1]);
expect(actual).toStrictEqual(expected);
});
it('Should throw error when rquesting invalid type', async () => {
it('Should throw error when requesting invalid type', async () => {
mock();
MQTT.publish.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/request/networkmap', 'not_existing');
@@ -303,7 +303,7 @@ describe('Networkmap', () => {
let call = MQTT.publish.mock.calls[0];
expect(call[0]).toStrictEqual('zigbee2mqtt/bridge/response/networkmap');
const expected = {"data":{"routes":true,"type":"raw","value":{"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Aqara double key wireless wall switch (2016 model)","model":"WXKG02LM_rev1","supports":"battery, action, voltage, power_outage_count, linkquality","vendor":"Xiaomi"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":null,"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"[CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/)","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description":"external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]}},"status":"ok"};
const expected = {"data":{"routes":true,"type":"raw","value":{"links":[{"depth":1,"linkquality":120,"lqi":120,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x000b57fffec6a5b3","networkAddress":40399},"sourceIeeeAddr":"0x000b57fffec6a5b3","sourceNwkAddr":40399,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[{"destinationAddress":6540,"nextHop":40369,"status":"ACTIVE"}],"source":{"ieeeAddr":"0x000b57fffec6a5b2","networkAddress":40369},"sourceIeeeAddr":"0x000b57fffec6a5b2","sourceNwkAddr":40369,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":1,"linkquality":92,"lqi":92,"relationship":2,"routes":[],"source":{"ieeeAddr":"0x0017880104e45511","networkAddress":1114},"sourceIeeeAddr":"0x0017880104e45511","sourceNwkAddr":1114,"target":{"ieeeAddr":"0x00124b00120144ae","networkAddress":0},"targetIeeeAddr":"0x00124b00120144ae"},{"depth":2,"linkquality":130,"lqi":130,"relationship":1,"routes":[],"source":{"ieeeAddr":"0x0017880104e45521","networkAddress":6538},"sourceIeeeAddr":"0x0017880104e45521","sourceNwkAddr":6538,"target":{"ieeeAddr":"0x0017880104e45559","networkAddress":6540},"targetIeeeAddr":"0x0017880104e45559"}],"nodes":[{"definition":null,"failed":[],"friendlyName":"Coordinator","ieeeAddr":"0x00124b00120144ae","lastSeen":1000,"modelID":null,"networkAddress":0,"type":"Coordinator"},{"definition":{"description":"Hue Go","model":"7146060PH","supports":"light (state, brightness, color_temp, color_temp_startup, color_xy, color_hs), power_on_behavior, effect, linkquality","vendor":"Philips"},"failed":[],"friendlyName":"bulb_color","ieeeAddr":"0x000b57fffec6a5b3","lastSeen":1000,"modelID":"LLC020","networkAddress":40399,"type":"Router"},{"definition":{"description":"Wireless remote switch (double rocker), 2016 model","model":"WXKG02LM_rev1","supports":"battery, voltage, power_outage_count, action, linkquality","vendor":"Aqara"},"friendlyName":"button_double_key","ieeeAddr":"0x0017880104e45521","lastSeen":1000,"modelID":"lumi.sensor_86sw2.es1","networkAddress":6538,"type":"EndDevice"},{"definition":{"description":"Automatically generated definition","model":"notSupportedModelID","supports":"action, linkquality","vendor":"Boef"},"failed":["lqi","routingTable"],"friendlyName":"0x0017880104e45525","ieeeAddr":"0x0017880104e45525","lastSeen":1000,"manufacturerName":"Boef","modelID":"notSupportedModelID","networkAddress":6536,"type":"Router"},{"definition":{"description":"CC2530 router","model":"CC2530.ROUTER","supports":"led, linkquality","vendor":"Custom devices (DiY)"},"failed":[],"friendlyName":"cc2530_router","ieeeAddr":"0x0017880104e45559","lastSeen":1000,"modelID":"lumi.router","networkAddress":6540,"type":"Router"},{"definition":{"description":"external","model":"external_converter_device","supports":"linkquality","vendor":"external"},"friendlyName":"0x0017880104e45511","ieeeAddr":"0x0017880104e45511","lastSeen":1000,"modelID":"external_converter_device","networkAddress":1114,"type":"EndDevice"}]}},"status":"ok"}
const actual = JSON.parse(call[1]);
expect(actual).toStrictEqual(expected);
});
+3 -4
View File
@@ -7,13 +7,12 @@ const MQTT = require('./stub/mqtt');
const settings = require('../lib/util/settings');
const Controller = require('../lib/controller');
const flushPromises = require('./lib/flushPromises');
const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {});
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
const mockOnEvent = jest.fn();
const mappedLivolo = zigbeeHerdsmanConverters.findByDevice(zigbeeHerdsman.devices.LIVOLO);
const mappedLivolo = zigbeeHerdsmanConverters.findByModel('TI0001');
mappedLivolo.onEvent = mockOnEvent;
zigbeeHerdsmanConverters.onEvent = jest.fn();
@@ -76,6 +75,6 @@ describe('On event', () => {
await zigbeeHerdsman.events.deviceAnnounce({device});
await flushPromises();
expect(zigbeeHerdsmanConverters.onEvent).toHaveBeenCalledTimes(1);
expect(zigbeeHerdsmanConverters.onEvent).toHaveBeenCalledWith('deviceAnnounce', {device}, device, settings.getDevice(device.ieeeAddr), {});
expect(zigbeeHerdsmanConverters.onEvent).toHaveBeenCalledWith('deviceAnnounce', {device}, device);
});
});
+42 -32
View File
@@ -2,6 +2,7 @@ const path = require('path');
const data = require('./stub/data');
const logger = require('./stub/logger');
const sleep = require('./stub/sleep');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
const MQTT = require('./stub/mqtt');
const settings = require('../lib/util/settings');
@@ -35,6 +36,7 @@ describe('OTA update', () => {
settings.reRead();
jest.useFakeTimers();
controller = new Controller(jest.fn(), jest.fn());
sleep.mock();
await controller.start();
await jest.runOnlyPendingTimers();
await flushPromises();
@@ -47,6 +49,7 @@ describe('OTA update', () => {
afterAll(async () => {
jest.useRealTimers();
sleep.restore();
});
beforeEach(async () => {
@@ -65,11 +68,11 @@ describe('OTA update', () => {
count++;
return {swBuildId: count, dateCode: '2019010' + count}
});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.info.mockClear();
device.save.mockClear();
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
mapped.ota.updateToLatest.mockImplementationOnce((a, onUpdate) => {
onUpdate(0, null);
onUpdate(10, 3600.2123);
return 90;
@@ -80,14 +83,14 @@ describe('OTA update', () => {
expect(logger.info).toHaveBeenCalledWith(`Updating 'bulb' to latest firmware`);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(0);
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(1);
expect(mapped.ota.updateToLatest).toHaveBeenCalledWith(device, logger, expect.any(Function));
expect(mapped.ota.updateToLatest).toHaveBeenCalledWith(device, expect.any(Function));
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 0.00%`);
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 10.00%, ≈ 60 minutes remaining`);
expect(logger.info).toHaveBeenCalledWith(`Finished update of 'bulb'`);
expect(logger.info).toHaveBeenCalledWith(`Device 'bulb' was updated from '{"dateCode":"20190101","softwareBuildID":1}' to '{"dateCode":"20190103","softwareBuildID":3}'`);
expect(device.save).toHaveBeenCalledTimes(2);
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendWhen': 'immediate'});
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendWhen': 'active'});
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendPolicy': 'immediate'});
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {});
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"update_available":false,"update":{"state":"updating","progress":0}}),
@@ -120,10 +123,10 @@ describe('OTA update', () => {
const device = zigbeeHerdsman.devices.bulb;
const endpoint = device.endpoints[0];
endpoint.read.mockImplementation(() => {return {swBuildId: 1, dateCode: '2019010'}});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
device.save.mockClear();
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
mapped.ota.updateToLatest.mockImplementationOnce((a, onUpdate) => {
throw new Error('Update failed');
});
@@ -143,7 +146,7 @@ describe('OTA update', () => {
it('Should be able to check if OTA update is available', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 10, otaFileVersion: 10});
@@ -172,9 +175,9 @@ describe('OTA update', () => {
it('Should handle if OTA update check fails', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF singals disturbed because of dogs barking')});
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF signals disturbed because of dogs barking')});
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/check', "bulb");
await flushPromises();
@@ -182,7 +185,7 @@ describe('OTA update', () => {
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(0);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/ota_update/check',
stringify({"data":{"id": "bulb"},"status":"error","error": `Failed to check if update available for 'bulb' (RF singals disturbed because of dogs barking)`}),
stringify({"data":{"id": "bulb"},"status":"error","error": `Failed to check if update available for 'bulb' (RF signals disturbed because of dogs barking)`}),
{retain: false, qos: 0}, expect.any(Function)
);
});
@@ -209,7 +212,7 @@ describe('OTA update', () => {
it('Should refuse to check/update when already in progress', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {
@@ -234,7 +237,7 @@ describe('OTA update', () => {
const endpoint = device.endpoints[0];
endpoint.read.mockImplementation(() => {throw new Error('Failed!')});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/update', "bulb");
await flushPromises();
@@ -249,7 +252,7 @@ describe('OTA update', () => {
const device = zigbeeHerdsman.devices.bulb;
device.endpoints[0].commandResponse.mockClear();
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 10, otaFileVersion: 12});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10, meta: {zclTransactionSequenceNumber: 10}};
@@ -257,7 +260,7 @@ describe('OTA update', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"imageType": 12382});
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, {"imageType": 12382});
expect(logger.info).toHaveBeenCalledWith(`Update available for 'bulb'`);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x98}, undefined, 10);
@@ -283,7 +286,7 @@ describe('OTA update', () => {
const device = zigbeeHerdsman.devices.bulb;
device.endpoints[0].commandResponse.mockClear();
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('Nothing to find here')})
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10, meta: {zclTransactionSequenceNumber: 10}};
@@ -291,7 +294,7 @@ describe('OTA update', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"imageType": 12382});
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, {"imageType": 12382});
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x98}, undefined, 10);
expect(MQTT.publish).toHaveBeenCalledWith(
@@ -305,7 +308,7 @@ describe('OTA update', () => {
const device = zigbeeHerdsman.devices.bulb;
device.endpoints[0].commandResponse.mockClear();
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 13, otaFileVersion: 13});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10, meta: {zclTransactionSequenceNumber: 10}};
@@ -313,7 +316,7 @@ describe('OTA update', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"imageType": 12382});
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, {"imageType": 12382});
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x98}, undefined, 10);
expect(MQTT.publish).toHaveBeenCalledWith(
@@ -327,7 +330,7 @@ describe('OTA update', () => {
settings.set(['ota', 'disable_automatic_update_check'], true);
const device = zigbeeHerdsman.devices.bulb;
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 10, otaFileVersion: 13});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10, meta: {zclTransactionSequenceNumber: 10}};
@@ -366,12 +369,12 @@ describe('OTA update', () => {
count++;
return {swBuildId: count, dateCode: '2019010' + count}
});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.info.mockClear();
logger.error.mockClear();
device.save.mockClear();
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
mapped.ota.updateToLatest.mockImplementationOnce((a, onUpdate) => {
onUpdate(0, null);
onUpdate(10, 3600);
return 91;
@@ -382,26 +385,26 @@ describe('OTA update', () => {
expect(logger.info).toHaveBeenCalledWith(`Updating 'bulb' to latest firmware`);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(0);
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(1);
expect(mapped.ota.updateToLatest).toHaveBeenCalledWith(device, logger, expect.any(Function));
expect(mapped.ota.updateToLatest).toHaveBeenCalledWith(device, expect.any(Function));
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 0.00%`);
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 10.00%, ≈ 60 minutes remaining`);
expect(logger.info).toHaveBeenCalledWith(`Finished update of 'bulb'`);
expect(logger.info).toHaveBeenCalledWith(`Device 'bulb' was updated from '{"dateCode":"20190101","softwareBuildID":1}' to '{"dateCode":"20190103","softwareBuildID":3}'`);
expect(logger.info).toHaveBeenCalledWith(`Device 'bulb' was updated from '{"dateCode":"20190101","softwareBuildID":1}' to '{"dateCode":"20190103","softwareBuildID":3}'`);
expect(logger.error).toHaveBeenCalledTimes(0);
expect(device.save).toHaveBeenCalledTimes(2);
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendWhen': 'immediate'});
expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendPolicy': 'immediate'});
});
it('Legacy api: Should handle when OTA update fails', async () => {
const device = zigbeeHerdsman.devices.bulb;
const endpoint = device.endpoints[0];
endpoint.read.mockImplementation(() => {return {swBuildId: 1, dateCode: '2019010'}});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.info.mockClear();
logger.error.mockClear();
device.save.mockClear();
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
mapped.ota.updateToLatest.mockImplementationOnce((a, onUpdate) => {
throw new Error('Update failed');
});
@@ -413,7 +416,7 @@ describe('OTA update', () => {
it('Legacy api: Should be able to check if OTA update is available', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.info.mockClear();
@@ -435,16 +438,16 @@ describe('OTA update', () => {
it('Legacy api: Should handle if OTA update check fails', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.error.mockClear();
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF singals disturbed because of dogs barking')});
mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF signals disturbed because of dogs barking')});
MQTT.events.message('zigbee2mqtt/bridge/ota_update/check', 'bulb');
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(0);
expect(logger.error).toHaveBeenCalledWith(`Failed to check if update available for 'bulb' (RF singals disturbed because of dogs barking)`);
expect(logger.error).toHaveBeenCalledWith(`Failed to check if update available for 'bulb' (RF signals disturbed because of dogs barking)`);
});
it('Legacy api: Should not check for OTA when device does not support it', async () => {
@@ -463,7 +466,7 @@ describe('OTA update', () => {
return {swBuildId: 1, dateCode: '2019010'}
});
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
logger.info.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/ota_update/update', 'bulb');
@@ -482,4 +485,11 @@ describe('OTA update', () => {
expect(spyUseIndexOverride).toHaveBeenCalledWith('http://my.site/index.json');
spyUseIndexOverride.mockClear();
});
it('Clear update state on startup', async () => {
const device = controller.zigbee.resolveEntity(zigbeeHerdsman.devices.bulb_color.ieeeAddr);
controller.state.set(device, {update: {progress: 100, remaining: 10, state: 'updating'}})
await resetExtension();
expect(controller.state.get(device)).toStrictEqual({update: {state: 'available'}});
});
});
+46 -9
View File
@@ -1,4 +1,5 @@
const data = require('./stub/data');
const sleep = require('./stub/sleep');
const logger = require('./stub/logger');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
@@ -8,7 +9,7 @@ const settings = require('../lib/util/settings');
const Controller = require('../lib/controller');
const flushPromises = require('./lib/flushPromises');
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
const expectNothingPublished = () => {
Object.values(zigbeeHerdsman.devices).forEach((d) => {
@@ -30,6 +31,7 @@ describe('Publish', () => {
jest.useFakeTimers();
data.writeEmptyState();
controller = new Controller(jest.fn(), jest.fn());
sleep.mock();
await controller.start();
await flushPromises();
});
@@ -50,12 +52,13 @@ describe('Publish', () => {
g.command.mockClear();
});
zigbeeHerdsmanConverters.toZigbeeConverters.__clearStore__();
zigbeeHerdsmanConverters.toZigbee.__clearStore__();
});
afterAll(async () => {
jest.runOnlyPendingTimers();
jest.useRealTimers();
sleep.restore();
});
it('Should publish messages to zigbee devices', async () => {
@@ -145,7 +148,7 @@ describe('Publish', () => {
it('Should publish messages to zigbee devices with color_temp in %', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
const endpoint = device.getEndpoint(1);
await MQTT.events.message('zigbee2mqtt/bulb_color/set', stringify({color_temp_percent: '100'}));
await MQTT.events.message('zigbee2mqtt/bulb_color/set', stringify({color_temp_percent: 100}));
await flushPromises();
expect(endpoint.command).toHaveBeenCalledTimes(1);
expect(endpoint.command).toHaveBeenCalledWith("lightingColorCtrl", "moveToColorTemp", {colortemp: 500, transtime: 0}, {});
@@ -220,6 +223,40 @@ describe('Publish', () => {
);
});
it('Should publish messages to TuYa switch with dummy endpoints', async () => {
const device = zigbeeHerdsman.devices.TS0601_switch;
const endpoint = device.getEndpoint(1);
await MQTT.events.message('zigbee2mqtt/TS0601_switch/set', stringify({state_l2: 'ON'}));
await flushPromises();
expect(endpoint.command).toHaveBeenCalledTimes(1);
expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {dpValues: [{data: [1], datatype: 1, dp: 2}], seq: expect.any(Number)}, {disableDefaultResponse: true});
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/TS0601_switch',
stringify({state_l2: 'ON'}),
{ retain: false, qos: 0 },
expect.any(Function)
);
});
it('Should publish messages to TuYa cover switch with dummy endpoints', async () => {
const device = zigbeeHerdsman.devices.TS0601_cover_switch;
const endpoint = device.getEndpoint(1);
await MQTT.events.message('zigbee2mqtt/TS0601_cover_switch/set', stringify({state: 'OPEN'}));
await MQTT.events.message('zigbee2mqtt/TS0601_cover_switch/set', stringify({state_l1: 'ON'}));
await MQTT.events.message('zigbee2mqtt/TS0601_cover_switch/l2/set', stringify({state: 'OFF'}));
await flushPromises();
expect(endpoint.command).toHaveBeenCalledTimes(3);
expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {dpValues: [{data: [0], datatype: 4, dp: 1}], seq: expect.any(Number)}, {disableDefaultResponse: true});
expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {dpValues: [{data: [1], datatype: 1, dp: 102}], seq: expect.any(Number)}, {disableDefaultResponse: true});
expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {dpValues: [{data: [0], datatype: 1, dp: 101}], seq: expect.any(Number)}, {disableDefaultResponse: true});
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/TS0601_cover_switch',
stringify({state_l2: 'OFF', state_l1: 'ON', state: 'OPEN'}),
{ retain: false, qos: 0 },
expect.any(Function)
);
});
it('Should publish messages to zigbee devices with color xy', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
const endpoint = device.getEndpoint(1);
@@ -531,7 +568,7 @@ describe('Publish', () => {
logger.error.mockClear();
await MQTT.events.message('zigbee2mqtt/0x0017880104e45542/get', stringify({state_center: '', state_right: ''}));
await flushPromises();
expect(logger.error).toHaveBeenCalledWith(`Device 'wall_switch_double' has no endpoint 'center'`);
expect(logger.error).toHaveBeenCalledWith(`No converter available for 'state_center' ("")`);
expect(endpoint2.read).toHaveBeenCalledTimes(0);
expect(endpoint3.read).toHaveBeenCalledTimes(1);
expect(endpoint3.read).toHaveBeenCalledWith('genOnOff', ['onOff']);
@@ -972,7 +1009,7 @@ describe('Publish', () => {
await MQTT.events.message('zigbee2mqtt/curtain/set', stringify(payload));
await flushPromises();
expect(endpoint.write).toHaveBeenCalledTimes(1);
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {"85": {"type": 57, "value": 100}});
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {presentValue: 100});
});
it('ZNCLDJ11LM position', async () => {
@@ -982,7 +1019,7 @@ describe('Publish', () => {
await MQTT.events.message('zigbee2mqtt/curtain/set', stringify(payload));
await flushPromises();
expect(endpoint.write).toHaveBeenCalledTimes(1);
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {"85": {"type": 57, "value": 10}});
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {presentValue: 10});
});
it('ZNCLDJ11LM position', async () => {
@@ -992,7 +1029,7 @@ describe('Publish', () => {
await MQTT.events.message('zigbee2mqtt/curtain/set', stringify(payload));
await flushPromises();
expect(endpoint.write).toHaveBeenCalledTimes(1);
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {"85": {"type": 57, "value": 0}});
expect(endpoint.write).toHaveBeenCalledWith("genAnalogOutput", {presentValue: 0});
});
it('ZNCLDJ11LM position', async () => {
@@ -1276,7 +1313,7 @@ describe('Publish', () => {
expect(endpoint.command).toHaveBeenCalledWith("ssIasWd", "startWarning", {"startwarninginfo": 53, "warningduration": 10, "strobedutycycle": 0, "strobelevel": 1}, {disableDefaultResponse: true});
});
it('Shouldnt do anythign when device is not supported', async () => {
it('Shouldnt do anything when device is not supported', async () => {
const payload = {state: 'ON'};
await MQTT.events.message('zigbee2mqtt/unsupported2/set', stringify(payload));
await flushPromises();
@@ -1343,7 +1380,7 @@ describe('Publish', () => {
await MQTT.events.message('zigbee2mqtt/bulb_color/set', stringify({state: 'ON', brightness: 20, transition: 0.0}));
await flushPromises();
zigbeeHerdsmanConverters.toZigbeeConverters.__clearStore__();
zigbeeHerdsmanConverters.toZigbee.__clearStore__();
await MQTT.events.message('zigbee2mqtt/bulb_color/set', stringify({"state": "ON", "transition": 1.0}));
await flushPromises();
+17 -19
View File
@@ -1,4 +1,5 @@
const data = require('./stub/data');
const sleep = require('./stub/sleep');
const logger = require('./stub/logger');
const stringify = require('json-stable-stringify-without-jsonify');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
@@ -7,7 +8,7 @@ const settings = require('../lib/util/settings');
const Controller = require('../lib/controller');
const flushPromises = require('./lib/flushPromises');
const mocksClear = [MQTT.publish, logger.warn, logger.debug];
const mocksClear = [MQTT.publish, logger.warning, logger.debug];
describe('Receive', () => {
let controller;
@@ -15,6 +16,7 @@ describe('Receive', () => {
beforeAll(async () => {
jest.useFakeTimers();
controller = new Controller(jest.fn(), jest.fn());
sleep.mock();
await controller.start();
await jest.runOnlyPendingTimers();
await flushPromises();
@@ -30,6 +32,7 @@ describe('Receive', () => {
afterAll(async () => {
jest.useRealTimers();
sleep.restore();
});
it('Should handle a zigbee message', async () => {
@@ -182,7 +185,7 @@ describe('Receive', () => {
// Summary:
// First send multiple measurements to device that is debouncing. Make sure only one message is sent out to MQTT. This also ensures first message is cached to "State".
// Then send another measurement to that same device and trigger asyncronous event to push data from Cache. Newest value should be sent out.
// Then send another measurement to that same device and trigger asynchronous event to push data from Cache. Newest value should be sent out.
const device = zigbeeHerdsman.devices.WSDCGQ11LM;
settings.set(['devices', device.ieeeAddr, 'debounce'], 0.1);
@@ -201,11 +204,11 @@ describe('Receive', () => {
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/weather_sensor');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({temperature: 0.08, humidity: 0.01, pressure: 2});
// Send another Zigbee messages...
// Send another Zigbee message...
await zigbeeHerdsman.events.message({data: {measuredValue: 9}, cluster: 'msTemperatureMeasurement', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10});
const realDevice = controller.zigbee.resolveEntity(device);
// Trigger asyncronous event while device is "debouncing" to trigger Message to be sent out from State cache.
// Trigger asynchronous event while device is "debouncing" to trigger Message to be sent out from State cache.
await controller.publishEntityState( realDevice, {} );
jest.runOnlyPendingTimers();
await flushPromises();
@@ -213,7 +216,7 @@ describe('Receive', () => {
// Total of 3 messages should have triggered.
expect(MQTT.publish).toHaveBeenCalledTimes(3);
// Test that message pushed by asyncronous message contains NEW measurement and not old.
// Test that message pushed by asynchronous message contains NEW measurement and not old.
expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toStrictEqual({temperature: 0.09, humidity: 0.01, pressure: 2});
// Test that messages after debouncing contains NEW measurement and not old.
expect(JSON.parse(MQTT.publish.mock.calls[2][1])).toStrictEqual({temperature: 0.09, humidity: 0.01, pressure: 2});
@@ -388,18 +391,6 @@ describe('Receive', () => {
expect(MQTT.publish).toHaveBeenCalledTimes(0);
});
it('Should not handle messages from unsupported devices and link to docs', async () => {
const device = zigbeeHerdsman.devices.unsupported;
const data = {onOff: 1};
logger.warn.mockClear();
const payload = {data, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(logger.warn).toHaveBeenCalledWith(`Received message from unsupported device with Zigbee model 'notSupportedModelID' and manufacturer name 'notSupportedMfg'`);
expect(logger.warn).toHaveBeenCalledWith(`Please see: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html`);
expect(MQTT.publish).toHaveBeenCalledTimes(0);
});
it('Should not handle messages from still interviewing devices with unknown definition', async () => {
const device = zigbeeHerdsman.devices.interviewing;
const data = {onOff: 1};
@@ -408,7 +399,7 @@ describe('Receive', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(0);
expect(logger.debug).toHaveBeenCalledWith(`Skipping message, definition is undefined and still interviewing`);
expect(logger.debug).toHaveBeenCalledWith(`Skipping message, still interviewing`);
});
it('Should handle a command', async () => {
@@ -474,6 +465,13 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/SP600_OLD');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({energy: 6.648, power: 496});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({energy: 6.65, power: 496});
});
it('Should emit DevicesChanged event when a converter announces changed exposes', async () => {
const device = zigbeeHerdsman.devices['BMCT-SLZ'];
const data = {deviceMode: 0}
const payload = {data, cluster: 'manuSpecificBosch10', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual("zigbee2mqtt/bridge/devices");
});
});
+19 -25
View File
@@ -335,22 +335,15 @@ describe('Settings', () => {
expect(read(devicesFile)).toStrictEqual(expected);
});
it('Should add devices for first file when using 2 separates file', () => {
function extractFromMultipleDeviceConfigs(contentDevices2) {
const contentConfiguration = {
devices: ['devices.yaml', 'devices2.yaml']
devices: ['devices.yaml', 'devices2.yaml'],
};
const contentDevices = {
'0x12345678': {
friendly_name: '0x12345678',
retain: false,
},
};
const contentDevices2 = {
'0x87654321': {
friendly_name: '0x87654321',
retain: false,
retain: false,
},
};
@@ -365,15 +358,28 @@ describe('Settings', () => {
const expected = {
'0x12345678': {
friendly_name: '0x12345678',
retain: false,
retain: false,
},
'0x1234': {
'0x1234': {
friendly_name: '0x1234',
},
};
expect(read(devicesFile)).toStrictEqual(expected);
expect(read(devicesFile2)).toStrictEqual(contentDevices2);
}
it('Should add devices for first file when using 2 separates file', () => {
extractFromMultipleDeviceConfigs({
'0x87654321': {
friendly_name: '0x87654321',
retain: false,
},
});
});
it('Should add devices for first file when using 2 separates file and the second file is empty', () => {
extractFromMultipleDeviceConfigs(null)
});
it('Should add devices to a separate file if devices.yaml doesnt exist', () => {
@@ -876,18 +882,6 @@ describe('Settings', () => {
expect(settings.validate()).toEqual(expect.arrayContaining([error]));
});
it('Configuration shouldnt be valid when friendly_name is a postfix', async () => {
write(configurationFile, {
...minimalConfig,
devices: {'0x0017880104e45519': {friendly_name: 'left', retain: false}},
});
settings.reRead();
const error = `Following friendly_name are not allowed: '${utils.endpointNames}'`;
expect(settings.validate()).toEqual(expect.arrayContaining([error]));
});
it('Configuration shouldnt be valid when duplicate friendly_name are used', async () => {
write(configurationFile, {
devices: {
@@ -935,7 +929,7 @@ describe('Settings', () => {
});
settings.reRead();
expect(settings.get().frontend).toStrictEqual({port: 8080, auth_token: false, host: '0.0.0.0'})
expect(settings.get().frontend).toStrictEqual({port: 8080, auth_token: false})
});
it('Baudrate config', () => {
+6
View File
@@ -179,6 +179,12 @@ function writeDefaultConfiguration() {
'0x0017882104a44559': {
friendly_name: 'TS0601_thermostat',
},
'0x0017882104a44560': {
friendly_name: 'TS0601_switch',
},
'0x0017882104a44562': {
friendly_name: 'TS0601_cover_switch',
},
'0x0017882194e45543': {
friendly_name: 'QS-Zigbee-D02-TRIAC-2C-LN',
},
+13 -7
View File
@@ -1,28 +1,34 @@
let level = 'info';
let debugNamespaceIgnore = '';
const transports = [];
let transports = [];
let transportsEnabled = false;
const callTransports = (level, message) => {
const callTransports = (level, message, namespace) => {
if (transportsEnabled) {
for (const transport of transports) {
transport.log({level, message}, () => {});
transport.log({level, message, namespace}, () => {});
}
}
}
const mock = {
init: jest.fn(),
info: jest.fn().mockImplementation((msg) => callTransports('info', msg)),
warn: jest.fn().mockImplementation((msg) => callTransports('warn', msg)),
error: jest.fn().mockImplementation((msg) => callTransports('error', msg)),
debug: jest.fn().mockImplementation((msg) => callTransports('debug', msg)),
info: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('info', msg, namespace)),
warning: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('warning', msg, namespace)),
error: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('error', msg, namespace)),
debug: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('debug', msg, namespace)),
cleanup: jest.fn(),
logOutput: jest.fn(),
add: (transport) => transports.push(transport),
addTransport: (transport) => transports.push(transport),
removeTransport: (transport) => {
transports = transports.filter((t) => t !== transport);
},
setLevel: (newLevel) => {level = newLevel},
getLevel: () => level,
setDebugNamespaceIgnore: (newIgnore) => {debugNamespaceIgnore = newIgnore},
getDebugNamespaceIgnore: () => debugNamespaceIgnore,
setTransportsEnabled: (value) => {transportsEnabled = value},
end: jest.fn(),
};
+10
View File
@@ -0,0 +1,10 @@
const utils = require('../../lib/util/utils');
const spy = jest.spyOn(utils.default, 'sleep');
export function mock() {
spy.mockImplementation(() => {});
}
export function restore() {
spy.mockRestore();
}
+10 -2
View File
@@ -118,6 +118,8 @@ class Device {
this.ping = jest.fn();
this.removeFromNetwork = jest.fn();
this.removeFromDatabase = jest.fn();
this.customClusters = {};
this.addCustomCluster = jest.fn();
this.save = jest.fn();
this.manufacturerName = manufacturerName;
this.lastSeen = 1000;
@@ -134,7 +136,9 @@ const bulb_color = new Device('Router', '0x000b57fffec6a5b3', 40399, 4107, [new
const bulb_color_2 = new Device('Router', '0x000b57fffec6a5b4', 401292, 4107, [new Endpoint(1, [0,3,4,5,6,8,768,2821,4096], [5,25,32,4096], '0x000b57fffec6a5b4', [], {lightingColorCtrl: {colorCapabilities: 254}}, [], null, null, {'scenes': {'1_0': {name: 'Chill scene', state: {state: 'ON'}}, '4_9': {state: {state: 'OFF'}}}})], true, "Mains (single phase)", "LLC020", false, 'Philips', '2019.09', '5.127.1.26581');
const bulb_2 = new Device('Router', '0x000b57fffec6a5b7', 40369, 4476, [new Endpoint(1, [0,3,4,5,6,8,768,2821,4096], [5,25,32,4096], '0x000b57fffec6a5b7', [], {lightingColorCtrl: {colorCapabilities: 17}})], true, "Mains (single phase)", "TRADFRI bulb E27 WS opal 980lm");
const TS0601_thermostat = new Device('EndDevice', '0x0017882104a44559', 6544,4151, [new Endpoint(1, [], [], '0x0017882104a44559')], true, "Mains (single phase)", 'kud7u2l');
const ZNCZ02LM = new Device('Router', '0x0017880104e45524', 6540,4151, [new Endpoint(1, [0], [], '0x0017880104e45524')], true, "Mains (single phase)", "lumi.plug");
const TS0601_switch = new Device('EndDevice', '0x0017882104a44560', 6544,4151, [new Endpoint(1, [], [], '0x0017882104a44560')], true, "Mains (single phase)", 'kjintbl');
const TS0601_cover_switch = new Device('EndDevice', '0x0017882104a44562', 6544,4151, [new Endpoint(1, [], [], '0x0017882104a44562')], true, "Mains (single phase)", 'TS0601', false, '_TZE200_5nldle7w');
const ZNCZ02LM = new Device('Router', '0x0017880104e45524', 6540,4151, [new Endpoint(1, [0, 6], [], '0x0017880104e45524')], true, "Mains (single phase)", "lumi.plug");
const GLEDOPTO_2ID = new Device('Router', '0x0017880104e45724', 6540,4151, [new Endpoint(11, [0,3,4,5,6,8,768], [], '0x0017880104e45724', [], {}, [], 49246, 528), new Endpoint(12, [0, 3, 4, 5, 6, 8, 768], [], '0x0017880104e45724', [], {}, [], 260, 258), new Endpoint(13, [4096], [4096], '0x0017880104e45724', [], {}, [], 49246, 57694), new Endpoint(15, [0, 3, 4, 5, 6, 8, 768], [], '0x0017880104e45724', [], {}, [], 49246, 256)], true, "Mains (single phase)", 'GL-C-007', false, 'GLEDOPTO');
const QBKG03LM = new Device('Router', '0x0017880104e45542', 6540,4151, [new Endpoint(1, [0], [], '0x0017880104e45542'), new Endpoint(2, [0, 6], [], '0x0017880104e45542'), new Endpoint(3, [0, 6], [], '0x0017880104e45542')], true, "Mains (single phase)", 'lumi.ctrl_neutral2');
const zigfred_plus = new Device('Router', '0xf4ce368a38be56a1', 6589, 0x129C, [new Endpoint(5, [0, 3, 4, 5, 6, 8, 0x0300, 0xFC42], [0xFC42], '0xf4ce368a38be56a1'), new Endpoint(7, [0, 3, 4, 5, 6, 8], [], '0xf4ce368a38be56a1'), new Endpoint(8, [0, 3, 4, 5, 6, 8], [], '0xf4ce368a38be56a1'), new Endpoint(9, [0, 3, 4, 5, 6, 8], [], '0xf4ce368a38be56a1'), new Endpoint(10, [0, 3, 4, 5, 6, 8], [], '0xf4ce368a38be56a1'), new Endpoint(11, [0, 3, 4, 5, 0x0102], [], '0xf4ce368a38be56a1'), new Endpoint(12, [0, 3, 4, 5, 0x0102], [], '0xf4ce368a38be56a1')], true, "Mains (single phase)", 'zigfred plus', false, 'Siglis');
@@ -197,6 +201,8 @@ const devices = {
'3157100': new Device('Router', '0x0017880104e44559', 6542,4151, [new Endpoint(1, [], [], '0x0017880104e44559')], true, "Mains (single phase)", '3157100', false, 'Centralite'),
'J1': new Device('Router', '0x0017880104a44559', 6543,4151, [new Endpoint(1, [], [], '0x0017880104a44559')], true, "Mains (single phase)", 'J1 (5502)'),
'TS0601_thermostat': TS0601_thermostat,
'TS0601_switch': TS0601_switch,
'TS0601_cover_switch': TS0601_cover_switch,
'external_converter_device': new Device('EndDevice', '0x0017880104e45511', 1114, 'external', [new Endpoint(1, [], [], '0x0017880104e45511')], false, null, 'external_converter_device' ),
'QS_Zigbee_D02_TRIAC_2C_LN':new Device('Router', '0x0017882194e45543', 6549,4151, [new Endpoint(1, [0], [], '0x0017882194e45543'), new Endpoint(2, [0, 6], [], '0x0017882194e45543')], true, "Mains (single phase)", 'TS110F', false, '_TYZB01_v8gtiaed'),
'unknown': new Device('Router', '0x0017980134e45545', 6540,4151, [], true, "Mains (single phase)"),
@@ -204,6 +210,8 @@ const devices = {
'heating_actuator': new Device('Router', '0x0017880104e45562', 6545,4151, [new Endpoint(1, [0,3,4,513], [1026])], true, "Mains (single phase)", "heating.actuator"),
'bj_scene_switch': new Device('EndDevice', '0xd85def11a1002caa', 50117, 4398, [new Endpoint(10, [0,4096], [3,4,5,6,8,25,768,4096], '0xd85def11a1002caa', [{target: bulb_color_2.endpoints[0], cluster: {ID: 8, name: 'genLevelCtrl'}}, {target: bulb_color_2.endpoints[0], cluster: {ID: 6, name: 'genOnOff'}}, {target: bulb_color_2.endpoints[0], cluster: {ID: 768, name: 'lightingColorCtrl'}},]), new Endpoint(11, [0,4096], [3,4,5,6,8,25,768,4096], '0xd85def11a1002caa')], true, 'Battery', 'RB01', false, 'Busch-Jaeger', '20161222', '1.2.0'),
'GW003-AS-IN-TE-FC': new Device('Router', '0x0017548104a44669', 6545,4699, [new Endpoint(1, [3], [0,3,513,514], '0x0017548104a44669')], true, "Mains (single phase)", 'Adapter Zigbee FUJITSU'),
'BMCT-SLZ': new Device('Router', '0x18fc26000000cafe', 6546,4617, [new Endpoint(1, [0,3,4,5,258,1794,2820,2821,64672], [10,25], '0x18fc26000000cafe')], true, "Mains (single phase)", 'RBSH-MMS-ZB-EU'),
}
const mock = {
@@ -255,8 +263,8 @@ const mock = {
const mockConstructor = jest.fn().mockImplementation(() => mock);
jest.mock('zigbee-herdsman', () => ({
...jest.requireActual('zigbee-herdsman'),
Controller: mockConstructor,
Zcl: {ManufacturerCode: {Philips: 4107}},
}));
module.exports = {
+4 -4
View File
@@ -1,9 +1,10 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"esModuleInterop": true,
"target": "es2018",
"lib": ["es2018"],
"target": "ES2022",
"lib": ["ES2022"],
"noImplicitAny": true,
"noImplicitThis": true,
"moduleResolution": "node",
@@ -15,8 +16,7 @@
"rootDir": "lib",
"inlineSourceMap": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"incremental": true
"experimentalDecorators": true
},
"include": [
"lib/**/*",
+21 -13
View File
@@ -1,17 +1,24 @@
#!/bin/bash -e
cd "$(dirname "$0")"
NEED_RESTART=0
if [ -d data-backup ]; then
echo "ERROR: Backup directory exists. May be previous restoring was failed?"
echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later."
echo "2. Manually delete 'data-backup' dir and try again."
exit 1
echo "ERROR: Backup directory exists. May be previous restoring was failed?"
echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later."
echo "2. Manually delete 'data-backup' dir and try again."
exit 1
fi
if which systemctl 2> /dev/null > /dev/null; then
echo "Stopping Zigbee2MQTT..."
sudo systemctl stop zigbee2mqtt
echo "Checking Zigbee2MQTT status..."
if systemctl is-active --quiet zigbee2mqtt; then
echo "Stopping Zigbee2MQTT..."
sudo systemctl stop zigbee2mqtt
NEED_RESTART=1
fi
else
echo "Skipped stopping Zigbee2MQTT, no systemctl found"
echo "Skipped stopping Zigbee2MQTT, no systemctl found"
fi
echo "Creating backup of configuration..."
@@ -21,20 +28,21 @@ echo "Checking out changes to package-lock.json..."
git checkout package-lock.json
echo "Updating..."
git pull
git pull --no-rebase
echo "Installing dependencies..."
npm ci
echo "Building..."
npm run build
echo "Restore configuration..."
cp -R data-backup/* data
rm -rf data-backup
if which systemctl 2> /dev/null > /dev/null; then
echo "Starting Zigbee2MQTT..."
sudo systemctl start zigbee2mqtt
else
echo "Skipped starting Zigbee2MQTT, no systemctl found"
if [ $NEED_RESTART -eq 1 ]; then
echo "Starting Zigbee2MQTT..."
sudo systemctl start zigbee2mqtt
fi
echo "Done!"