Compare commits

...
397 Commits
Author SHA1 Message Date
Koen Kanters cdf62ea560 1.30.2 2023-03-01 16:43:20 +01:00
Koen Kanters 5dcd3f67ed Undev 2023-03-01 16:43:06 +01:00
github-actions[bot]andKoenkk b013a7d8ef Update zigbee-herdsman-converters to 15.0.58 (#16860)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-03-01 15:28:46 +00:00
github-actions[bot]andKoenkk 8e6e38b968 Update zigbee-herdsman to 0.14.96 (#16851)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-28 16:00:34 +00:00
github-actions[bot]andKoenkk 8f20640008 Update zigbee-herdsman-converters to 15.0.57 (#16850)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-28 15:51:18 +00:00
github-actions[bot]andnurikk 57707cd9b9 Update zigbee2mqtt-frontend to 0.6.125 (#16844)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-02-27 22:28:55 +00:00
github-actions[bot]andKoenkk 911683ad13 Update zigbee-herdsman-converters to 15.0.56 (#16841)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-27 19:42:13 +00:00
github-actions[bot]andKoenkk 99204682b8 Update dependencies (#16819)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-26 08:57:31 +01:00
github-actions[bot]andKoenkk fec7fca89e Update zigbee-herdsman-converters to 15.0.55 (#16814)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-25 10:17:03 +00:00
github-actions[bot]andKoenkk 6bea88eeb6 Update zigbee-herdsman to 0.14.95 (#16813)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-25 10:09:26 +00:00
github-actions[bot]andKoenkk 6afcb97c0d Update zigbee-herdsman-converters to 15.0.54 (#16798)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-23 17:09:09 +00:00
github-actions[bot]andKoenkk 73d60396bc Update zigbee-herdsman-converters to 15.0.53 (#16788)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-22 20:09:37 +00:00
Koen Kanters 942faf412f Revert "Capitalize entity name in Home Assistant (#16702)"
This reverts commit f5cceb1719.
2023-02-22 20:34:39 +01:00
github-actions[bot]andKoenkk b62f65f045 Update zigbee-herdsman-converters to 15.0.52 (#16771)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-21 16:26:31 +00:00
Artem Draft f5cceb1719 Capitalize entity name in Home Assistant (#16702) 2023-02-21 17:18:15 +01:00
github-actions[bot]andKoenkk 0b6040dd25 Update zigbee-herdsman-converters to 15.0.51 (#16765)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-20 19:32:31 +00:00
github-actions[bot]andKoenkk 45fda8aefd Update zigbee-herdsman to 0.14.94 (#16764)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-20 19:14:42 +00:00
Andreas Fritiofson 85f32c039f Add entity_category to indicator_mode and led_enable for Home Assistant discovery (#16744)
These names are used by some TuYa and IKEA devices.
2023-02-20 19:53:22 +01:00
github-actions[bot]andKoenkk 7fa2b5fcc3 Update zigbee-herdsman-converters to 15.0.50 (#16742)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-19 09:32:01 +00:00
github-actions[bot]andKoenkk 08a0ace11a Update dependencies (#16738)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-19 09:36:47 +01:00
github-actions[bot]andKoenkk 7605e1ec06 Update zigbee-herdsman-converters to 15.0.49 (#16722)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-18 08:53:16 +00:00
Koen Kanters e934b0d94e Support Hue effects for groups. https://github.com/Koenkk/zigbee2mqtt/issues/15997 2023-02-16 18:20:08 +01:00
github-actions[bot]andKoenkk 4aa8e17214 Update zigbee-herdsman-converters to 15.0.48 (#16694)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-15 19:36:12 +00:00
github-actions[bot]andKoenkk a9f5f7c620 Update zigbee-herdsman-converters to 15.0.47 (#16679)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-14 19:11:35 +00:00
github-actions[bot]andKoenkk 6e193ca442 Update zigbee-herdsman-converters to 15.0.46 (#16661)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-13 18:48:16 +00:00
Tami 2eadf30199 Fix error when device is added when device: [] in configuration.yaml (#16629)
* fix for TypeError: The "path" argument must be of type string in writeDevicesOrGroups

* added test case that produces the error when running on old implementation

Summary of all failing tests
 FAIL  test/settings.test.js
  ● Settings › Should add devices even when devices exist empty

    TypeError: The "path" argument must be of type string. Received undefined

      275 |
      276 | jest.mock('../../lib/util/data', () => ({
    > 277 |     joinPath: (file) => require('path').join(mockDir, file),
          |                                         ^
      278 |     getPath: () => mockDir,
      279 | }));
      280 |

      at Object.join [as joinPath] (test/stub/data.js:277:41)
      at joinPath (lib/util/settings.ts:245:38)
      at writeDevicesOrGroups (lib/util/settings.ts:250:5)
      at Object.write [as addDevice] (lib/util/settings.ts:555:5)
      at Object.addDevice (test/settings.test.js:128:18)
2023-02-13 19:41:49 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 600e743941 Bump alpine from 3.17.1 to 3.17.2 in /docker (#16659)
Bumps alpine from 3.17.1 to 3.17.2.

---
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-02-13 19:23:38 +01:00
github-actions[bot]andKoenkk 932541649e Update zigbee-herdsman to 0.14.93 (#16635)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-12 08:44:39 +00:00
Artem Draft 0217593c77 Improve checks in HA covers (#16614) 2023-02-12 09:28:57 +01:00
github-actions[bot]andKoenkk 10e65b5f26 Update dependencies (#16632)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-12 09:17:14 +01:00
github-actions[bot]andKoenkk e9a38353fa Update zigbee-herdsman to 0.14.92 (#16616)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-10 20:42:59 +00:00
68caf0260d Update zigbee-herdsman-converters to 15.0.45 (#16604)
* Update zigbee-herdsman-converters to 15.0.45

* Fix tests

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2023-02-09 18:32:04 +01:00
github-actions[bot]andKoenkk 7d887adb7f Update zigbee-herdsman to 0.14.91 (#16603)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-09 18:04:15 +01:00
github-actions[bot]andKoenkk ec57d899e5 Update zigbee-herdsman-converters to 15.0.44 (#16576)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-07 19:41:16 +00:00
github-actions[bot]andKoenkk 61b1732ecb Update zigbee-herdsman-converters to 15.0.43 (#16558)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-06 16:58:21 +00:00
Koen Kanters a35705cd38 Merge branch 'master' into dev 2023-02-06 17:49:55 +01:00
Koen Kanters eb878d3d8e 1.30.1 2023-02-06 17:42:06 +01:00
Robert Kaussow 3420cf508b disable buildx provenance in the ci build command (#16495) 2023-02-06 17:39:51 +01:00
Koen Kanters d5a3bf626f Update zigbee-herdsman-converters to 15.0.38-hotfix.0 2023-02-06 17:39:10 +01:00
github-actions[bot]andKoenkk 0e1220ff24 Update zigbee-herdsman-converters to 15.0.42 (#16542)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-05 14:54:53 +00:00
github-actions[bot]andKoenkk 1496b95067 Update dependencies (#16534)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-05 13:29:02 +01:00
github-actions[bot]andKoenkk bd0694e164 Update zigbee-herdsman to 0.14.90 (#16523)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-04 14:23:17 +00:00
github-actions[bot]andKoenkk d580741dfe Update zigbee-herdsman-converters to 15.0.41 (#16522)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-04 14:11:41 +00:00
Robert Kaussow a24586bec3 disable buildx provenance in the ci build command (#16495) 2023-02-04 14:12:24 +01:00
github-actions[bot]andKoenkk 1e7a76139d Update zigbee-herdsman-converters to 15.0.40 (#16487)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-02 16:57:11 +00:00
github-actions[bot]andKoenkk ea0a9990b9 Update zigbee-herdsman-converters to 15.0.39 (#16459)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-01 17:20:38 +00:00
Koen Kanters 97af5a64e7 Promote to dev 2023-02-01 17:17:11 +01:00
Koen Kanters 8f781db93e 1.30.0 2023-02-01 17:14:40 +01:00
Koen Kanters 1a6ba18ec2 Undev 2023-02-01 17:14:22 +01:00
Koen Kanters d91e363d76 Merge branch 'dev' 2023-02-01 17:13:53 +01:00
github-actions[bot]andKoenkk f7e45b8284 Update zigbee-herdsman-converters to 15.0.38 (#16452)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-02-01 14:58:34 +00:00
github-actions[bot]andKoenkk bbbaaf4d89 Update zigbee-herdsman-converters to 15.0.37 (#16443)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-31 17:17:49 +00:00
github-actions[bot]andKoenkk c9076f8ce6 Update zigbee-herdsman to 0.14.89 (#16442)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-31 18:11:43 +01:00
github-actions[bot]andKoenkk 82fd062668 Update zigbee-herdsman-converters to 15.0.36 (#16429)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-30 17:22:52 +00:00
github-actions[bot]andKoenkk 769a1afd96 Update zigbee-herdsman-converters to 15.0.35 (#16416)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-29 18:28:16 +00:00
Koen Kanters f943619387 Always respond to OTA request. https://github.com/Koenkk/zigbee2mqtt/issues/16371 2023-01-29 19:16:03 +01:00
github-actions[bot]andKoenkk 43e204b7d1 Update zigbee-herdsman-converters to 15.0.34 (#16409)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-29 11:55:41 +00:00
Koen Kanters a3f1399489 Log device OTA request response. https://github.com/Koenkk/zigbee2mqtt/issues/16371 2023-01-29 11:23:21 +01:00
github-actions[bot]andKoenkk 4179d879d2 Update dependencies (#16400)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-29 10:27:14 +01:00
github-actions[bot]andKoenkk 6ce2d2e73f Update zigbee-herdsman-converters to 15.0.33 (#16374)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-26 16:54:37 +00:00
github-actions[bot]andKoenkk 981542827c Update zigbee-herdsman-converters to 15.0.32 (#16355)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-25 18:24:35 +00:00
github-actions[bot]andKoenkk 2f0a2cee6e Update zigbee-herdsman-converters to 15.0.31 (#16335)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-24 16:30:10 +00:00
Koen Kanters 0bc685a8e3 Sanatize manufacturerName. https://github.com/home-assistant/core/issues/85691 2023-01-24 17:19:56 +01:00
Artem Draft 02a99703a8 Fix motor_state and moving in HA covers (#16324) 2023-01-24 17:00:24 +01:00
github-actions[bot]andKoenkk 7639ce44a7 Update zigbee-herdsman-converters to 15.0.30 (#16322)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-23 19:26:59 +00:00
Koen Kanters b89a99fe0c Fix another Failed to call 'Frontend' 'stop' . https://github.com/Koenkk/zigbee2mqtt/issues/16317 2023-01-23 20:21:03 +01:00
mtdcr 06820d2220 Sane defaults for remote syslog (#16300)
The most commonly used transport for remote syslog is port 514/udp.
It also is the only defined method for BSD syslog (RFC 3164). RFCs
5424+5425 specify an additional TLS transport via 6514/tcp, which
does not seem to be supported by zigbee2mqtt, as evidenced by the
lack of TLS-related configuration options in this area. RFC 6587
describes legacy uses of syslog over TCP, recommending against them.

Port 123, the previous default, was probably used by accident and
is reserved for NTP.

| $ grep -w -e 123 -e 514 -e 601 -e 6514 /etc/services
| ntp		123/udp				# Network Time Protocol
| shell		514/tcp		cmd syslog	# no passwords used
| syslog	514/udp
| syslog-tls	6514/tcp			# Syslog over TLS [RFC5425]
2023-01-23 19:31:10 +01:00
Roland Ramthun 140213950d Disable provenance information in Docker images (#16297)
* Disable provenance information in Docker images

The new default of buildx to include provenance information to OCI images causes a series of infrastructure issues with current Docker versions. 

Disable generation of the new provenance information until all necessary infrastructure software components and registries have been fixed to support it properly.

* Correct docker/setup-buildx-action version number
2023-01-23 19:26:43 +01:00
github-actions[bot]andKoenkk f4f2c498b7 Update zigbee-herdsman-converters to 15.0.29 (#16295)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-22 08:45:14 +00:00
github-actions[bot]andKoenkk 31807c6c6b Update zigbee-herdsman to 0.14.88 (#16294)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-22 08:08:45 +00:00
github-actions[bot]andKoenkk 8ccad8ee53 Update dependencies (#16293)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-22 09:03:03 +01:00
github-actions[bot]andKoenkk a930539dc3 Update zigbee-herdsman-converters to 15.0.28 (#16284)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-21 09:37:42 +00:00
github-actions[bot]andnurikk b33db9397d Update zigbee2mqtt-frontend to 0.6.124 (#16277)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-01-20 15:19:13 +00:00
github-actions[bot]andKoenkk de4b7fb022 Update zigbee-herdsman-converters to 15.0.27 (#16264)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-19 16:58:25 +00:00
github-actions[bot]andKoenkk 9e85419f9e Update zigbee-herdsman-converters to 15.0.26 (#16254)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-18 20:28:00 +00:00
github-actions[bot]andKoenkk 80c464c951 Update zigbee-herdsman-converters to 15.0.25 (#16230)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-17 16:29:30 +00:00
github-actions[bot]andKoenkk e56dff4972 Update zigbee-herdsman-converters to 15.0.24 (#16215)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-16 18:46:18 +00:00
Koen Kanters d8501f04eb Fix Failed to call 'Frontend' 'stop' (TypeError: Cannot read properties of null (reading 'clients') error. https://github.com/Koenkk/zigbee2mqtt/issues/16207 2023-01-16 19:19:51 +01:00
github-actions[bot]andKoenkk c927b4b935 Update zigbee-herdsman-converters to 15.0.23 (#16177)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-15 13:26:50 +00:00
github-actions[bot]andKoenkk fb9872a4ff Update dependencies (#16172)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-15 10:05:39 +01:00
39b0964739 Update zigbee-herdsman-converters to 15.0.22 (#16159)
* Update zigbee-herdsman-converters to 15.0.22

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2023-01-14 13:39:45 +00:00
Koen Kanters 2c509c0368 Promote to dev 2023-01-13 22:33:21 +01:00
Koen Kanters 49e1c68cac Merge branch 'master' into dev 2023-01-13 22:32:50 +01:00
Koen Kanters bb3e8f6d41 1.29.2 2023-01-13 22:28:52 +01:00
Koen Kanters 835a3288a0 Update zh to 0.14.83-hotfix.0 and zhc to 15.0.12-hotfix.1 2023-01-13 22:27:36 +01:00
Koen Kanters cddbb9a5e5 Fix f600066134 2023-01-13 16:59:20 +01:00
github-actions[bot]andnurikk 65366478e3 Update zigbee2mqtt-frontend to 0.6.123 (#16143)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-01-13 11:33:49 +00:00
1d8b19dce9 Update zigbee-herdsman-converters to 15.0.21 (#16123)
* Update zigbee-herdsman-converters to 15.0.21

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2023-01-12 17:34:49 +00:00
Koen Kanters f600066134 Fix 328b9fbd60. https://github.com/Koenkk/zigbee2mqtt/issues/15958 2023-01-12 17:20:07 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 75533c20b8 Bump alpine from 3.17.0 to 3.17.1 in /docker (#16081)
Bumps alpine from 3.17.0 to 3.17.1.

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-12 09:42:42 +01:00
Koen Kanters 0605a5e0e3 Attempt to improve Log when MQTT client is unavailable stability 2023-01-12 09:41:30 +01:00
cf9640bd59 Update zigbee-herdsman-converters to 15.0.20 (#16106)
* Update zigbee-herdsman-converters to 15.0.20

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2023-01-12 08:37:17 +00:00
Koen Kanters 328b9fbd60 Remove state_class measurement when unit_of_measurement is not set. https://github.com/Koenkk/zigbee2mqtt/issues/15958 2023-01-11 18:23:13 +01:00
github-actions[bot]andnurikk bc6d1070c7 Update zigbee2mqtt-frontend to 0.6.122 (#16092)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2023-01-11 09:29:08 +00:00
github-actions[bot]andKoenkk bf339636b5 Update zigbee-herdsman to 0.14.87 (#16068)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-09 21:50:14 +00:00
github-actions[bot]andKoenkk d90dae5d9d Update zigbee-herdsman to 0.14.86 (#16066)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-09 21:00:50 +01:00
github-actions[bot]andKoenkk b34b0e866f Update zigbee-herdsman-converters to 15.0.19 (#16062)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-09 18:57:47 +00:00
Dan Klaffenbach 2288c0f1c2 Poll Busch-Jaeger devices for updates after binding-initiated changes (#16036)
The Busch-Jaeger devices don't support reporting and therefore their
state should be polled after being changed through a binding partner.
2023-01-09 19:18:13 +01:00
Miguel Cabral 9c4abb64c3 Expose cover moving state to Home Assistant (#16017) 2023-01-08 10:05:29 +01:00
github-actions[bot]andKoenkk 559f235e88 Update zigbee-herdsman-converters to 15.0.18 (#16023)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-08 09:01:56 +00:00
github-actions[bot]andKoenkk 30df0e25f9 Update zigbee-herdsman to 0.14.85 (#16020)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-08 08:44:31 +00:00
Koen Kanters e7735112e8 Fix Home Assistant Entity sensor.xxx (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement '' which is not a valid unit for the device class ('illuminance') warning. https://github.com/Koenkk/zigbee2mqtt/issues/15958 2023-01-08 08:50:10 +01:00
github-actions[bot]andKoenkk b943feef29 Update dependencies (#16019)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-08 08:45:04 +01:00
Koen Kanters e92d3f4ede Promote to dev 2023-01-07 10:26:02 +01:00
Koen Kanters 044cd0b3a6 Merge branch 'master' into dev 2023-01-07 10:25:19 +01:00
github-actions[bot]andKoenkk 3351bc2f42 Update zigbee-herdsman to 0.14.84 (#15978)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-06 11:29:07 +01:00
github-actions[bot]andKoenkk 6a8d236b4d Update zigbee-herdsman-converters to 15.0.17 (#15977)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-06 10:26:52 +00:00
Koen Kanters 7d67ffc429 1.29.1 2023-01-06 11:07:47 +01:00
Koen Kanters f984734961 Update zigbee-herdsman-converters to v15.0.12-hotfix.0 2023-01-06 11:07:14 +01:00
Koen Kanters 217fbb284a Fix Home Assistant Template variable warning: 'dict object' has no attribute 'latest_version' when rendering '{{ value_json['update']['latest_version'] }}' error attempt 2. https://github.com/Koenkk/zigbee2mqtt/issues/15747 2023-01-06 10:41:43 +01:00
Koen Kanters 9fe48e2a88 Revert "Expose cover moving state to Home Assistant (#15555)"
This reverts commit 56f7f3e1bd.
2023-01-06 10:41:37 +01:00
Koen Kanters 1c7817ad77 Fix Home Assistant Template variable warning: 'dict object' has no attribute 'latest_version' when rendering '{{ value_json['update']['latest_version'] }}' error. https://github.com/Koenkk/zigbee2mqtt/issues/15747 2023-01-06 10:41:13 +01:00
github-actions[bot]andKoenkk cf801344f8 Update zigbee-herdsman-converters to 15.0.16 (#15947)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-04 19:00:11 +00:00
Koen Kanters 50bca161ce Fix Home Assistant Template variable warning: 'dict object' has no attribute 'latest_version' when rendering '{{ value_json['update']['latest_version'] }}' error attempt 2. https://github.com/Koenkk/zigbee2mqtt/issues/15747 2023-01-04 19:49:27 +01:00
github-actions[bot]andKoenkk 15ccf945c3 Update zigbee-herdsman-converters to 15.0.15 (#15906)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-03 10:27:14 +00:00
Koen Kanters d49f06f34d Revert "Expose cover moving state to Home Assistant (#15555)"
This reverts commit 56f7f3e1bd.
2023-01-03 10:59:20 +01:00
github-actions[bot]andKoenkk 826f03220d Update zigbee-herdsman-converters to 15.0.14 (#15876)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-02 09:12:10 +00:00
Koen Kanters cdb984f830 Fix Home Assistant Template variable warning: 'dict object' has no attribute 'latest_version' when rendering '{{ value_json['update']['latest_version'] }}' error. https://github.com/Koenkk/zigbee2mqtt/issues/15747 2023-01-02 09:18:36 +01:00
github-actions[bot]andKoenkk 4e40c8223f Update zigbee-herdsman-converters to 15.0.13 (#15852)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-01 10:27:09 +00:00
github-actions[bot]andKoenkk 02d86ab233 Update dependencies (#15848)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-01-01 11:13:54 +01:00
Koen Kanters a49079f560 Dev 2023-01-01 10:58:37 +01:00
Koen Kanters dddce571d3 1.29.0 2023-01-01 10:53:46 +01:00
Koen Kanters f1841377db Undev 2023-01-01 10:52:49 +01:00
Koen Kanters f3edfbf75b Update generateNewSupportedDevices.js 2023-01-01 10:52:02 +01:00
github-actions[bot]andnurikk d701d96bb2 Update zigbee2mqtt-frontend to 0.6.121 (#15845)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-12-31 19:11:30 +00:00
github-actions[bot]andKoenkk 3b9d6c5651 Update zigbee-herdsman-converters to 15.0.12 (#15837)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-31 09:36:55 +00:00
MattandKoen Kanters 19bd87de4a Keep cached device state until Zigbee2MQTT is stopped (#15770)
* Fix extension path to make debugginge easier in VScode

* Fix linting error

* Add setting "cache_state_persist_on_leave" (default false)

This setting does not remove a device from State if it leaves the network

* Merge from upstream kk/dev

* Re-define cache_state_persist_on_leave to be a timeout

Allows the config to specify how long the state should be held (and the device to re-join & maintain the state).

Remove all pending deletions if the system is stopped

* Add debug. Fix "time" test

* Disable esline warnings for long debug lines

* Simplify state maintenance for leave/join devices

* Restore default configuration.yaml

* Don't track device presence via events, but examine herdsman on system stop

* Update configuration.yaml

* Update state.ts

* Update state.ts

* Update controller.test.js

* Update eventBus.ts

* Update eventBus.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-12-31 10:15:11 +01:00
github-actions[bot]andKoenkk af27e910d8 Update zigbee-herdsman-converters to 15.0.11 (#15816)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-30 08:22:39 +00:00
github-actions[bot]andKoenkk d8f1f3ef06 Update zigbee-herdsman-converters to 15.0.10 (#15797)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-29 09:50:01 +00:00
Koen Kanters 5b2756fef3 Build linux/386 Docker image. https://github.com/Koenkk/zigbee2mqtt/issues/15796 2022-12-29 10:44:15 +01:00
github-actions[bot]andKoenkk 75db8cf3f1 Update zigbee-herdsman-converters to 15.0.9 (#15775)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-28 08:28:49 +00:00
github-actions[bot]andKoenkk b4660417f8 Update zigbee-herdsman-converters to 15.0.8 (#15764)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-27 08:28:19 +00:00
github-actions[bot]andKoenkk 75e677608b Update zigbee-herdsman-converters to 15.0.7 (#15757)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-26 11:43:44 +00:00
Matt 05cb1406bb Fix extension path to make debugging easier in VS Code (#15741)
* Fix extension path to make debugginge easier in VScode

* Fix linting error
2022-12-25 16:57:48 +01:00
github-actions[bot]andKoenkk 10c6d1e4d9 Update dependencies (#15746)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-25 16:40:03 +01:00
Koen Kanters 6d08a2f0f6 Use Node.js 18 in CI 2022-12-24 09:50:32 +01:00
Koen Kanters 8d8c46ecae Reduce Docker image size 2022-12-24 09:45:15 +01:00
Koen Kanters 1f642d86e8 Add disabled option (#15589)
* Add disabled option

* Updates

* Tests

* Add restart required
2022-12-23 23:56:29 +01:00
github-actions[bot]andKoenkk 5afda96cf4 Update zigbee-herdsman-converters to 15.0.6 (#15722)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-23 19:39:13 +00:00
github-actions[bot]andnurikk 2550ca5978 Update zigbee2mqtt-frontend to 0.6.120 (#15717)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-12-23 16:55:52 +00:00
github-actions[bot]andKoenkk 566fc625cd Update zigbee-herdsman-converters to 15.0.4 (#15703)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-22 17:24:59 +00:00
github-actions[bot]andKoenkk 7f9de55b6c Update zigbee-herdsman-converters to 15.0.3 (#15689)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-21 19:18:48 +00:00
github-actions[bot]andKoenkk ccb5b49c80 Update zigbee-herdsman to 0.14.83 (#15688)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-21 19:13:08 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> dea44579c3 Bump actions/stale from 6 to 7 (#15685)
Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v6...v7)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-21 17:03:55 +01:00
github-actions[bot]andKoenkk 58445a2327 Update zigbee-herdsman to 0.14.82 (#15673)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-20 22:09:08 +00:00
github-actions[bot]andKoenkk 98cf8dbe5e Update zigbee-herdsman-converters to 15.0.2 (#15671)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-20 21:55:29 +00:00
github-actions[bot]andKoenkk 8fc83caac7 Update zigbee-herdsman-converters to 15.0.1 (#15651)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-19 20:07:35 +00:00
Miguel Cabral 56f7f3e1bd Expose cover moving state to Home Assistant (#15555) 2022-12-19 20:27:15 +01:00
Koen Kanters 01b46cf74e Use fileVersion for Home Assistant update sensor instead of softwareBuildID (#15630)
* Use fileVersion for Home Assistant update sensor instead of softwareBuildID. https://github.com/Koenkk/zigbee2mqtt/issues/15502

* Remove onlythis
2022-12-18 22:05:16 +01:00
github-actions[bot]andKoenkk 825c761c26 Update zigbee-herdsman-converters to 15.0.0 (#15631)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-18 21:04:48 +00:00
github-actions[bot]andKoenkk 443eb23a91 Update zigbee-herdsman-converters to 14.0.694 (#15624)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-18 13:01:34 +00:00
github-actions[bot]andKoenkk 9b78d85a46 Update dependencies (#15618)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-18 13:04:08 +01:00
6731c85981 Update zigbee-herdsman-converters to 14.0.693 (#15603)
* Update zigbee-herdsman-converters to 14.0.693

* fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-12-17 10:04:38 +00:00
github-actions[bot]andKoenkk da44667926 Update zigbee-herdsman-converters to 14.0.692 (#15573)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-15 20:02:58 +00:00
github-actions[bot]andKoenkk 3796084a27 Update zigbee-herdsman-converters to 14.0.691 (#15538)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-13 20:16:17 +00:00
Koen Kanters 4d32326a4f Fix failing configure blocking startup. https://github.com/Koenkk/zigbee2mqtt/issues/15299 2022-12-12 21:35:10 +01:00
github-actions[bot]andKoenkk 54d8002fd3 Update zigbee-herdsman-converters to 14.0.690 (#15517)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-12 20:31:55 +00:00
github-actions[bot]andKoenkk 21a30fc555 Update zigbee-herdsman-converters to 14.0.689 (#15490)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-11 09:44:07 +00:00
github-actions[bot]andKoenkk b90c0c4114 Update zigbee-herdsman to 0.14.81 (#15489)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-11 10:37:37 +01:00
github-actions[bot]andKoenkk e2deb23d77 Update dependencies (#15484)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-11 09:07:13 +01:00
github-actions[bot]andKoenkk b69d31d3ee Update zigbee-herdsman-converters to 14.0.688 (#15480)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-10 15:39:17 +00:00
github-actions[bot]andKoenkk 3481423810 Update zigbee-herdsman-converters to 14.0.687 (#15465)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-09 17:09:17 +00:00
github-actions[bot]andKoenkk d093200fec Update zigbee-herdsman to 0.14.80 (#15463)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-09 16:38:33 +00:00
eaf834a921 Update zigbee-herdsman to 0.14.79 (#15449)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-12-08 19:48:45 +01:00
github-actions[bot]andKoenkk 27377b0658 Update zigbee-herdsman-converters to 14.0.686 (#15448)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-08 18:40:40 +00:00
github-actions[bot]andKoenkk 2c53bc2c61 Update zigbee-herdsman-converters to 14.0.685 (#15430)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-07 19:15:23 +00:00
Gustav WestlingandKoen Kanters 83fae81724 docker: rebuild serialport from source (#15400)
* docker: rebuild serialport from source

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-12-07 17:54:24 +01:00
github-actions[bot]andKoenkk d075f0752e Update zigbee-herdsman-converters to 14.0.684 (#15399)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-06 17:21:51 +00:00
github-actions[bot]andKoenkk a29f90b441 Update zigbee-herdsman to 0.14.78 (#15398)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-06 17:11:48 +00:00
Koen Kanters 891392ff9a Revert "Fix Home Assistant installed_version error (#15369)" (#15396)
This reverts commit ba2d9aefe6.
2022-12-06 17:31:48 +01:00
Koen Kanters ba2d9aefe6 Fix Home Assistant installed_version error (#15369)
* Fix HA installed_version error

* add link
2022-12-05 16:52:11 +01:00
github-actions[bot]andKoenkk 586dda4d46 Update zigbee-herdsman-converters to 14.0.683 (#15356)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-04 20:09:14 +00:00
github-actions[bot]andKoenkk 1aa600ee59 Update zigbee-herdsman to 0.14.77 (#15355)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-04 19:56:20 +00:00
Pheel Tiandphil b0e352bfea Support HTTPS for frontend server (#15329)
* Adding 2 config params under 'frontend' : 'ssl_cert' and 'ssl_key' to contain file patch of certificate files to expose frontend in HTTPS.

* Taking all PR remarks in account.

Co-authored-by: phil <phil@8godsprod.com>
2022-12-04 19:33:04 +01:00
github-actions[bot]andKoenkk 959ca95219 Update dependencies (#15342)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-04 19:13:38 +01:00
github-actions[bot]andKoenkk 54bd9aa024 Update zigbee-herdsman-converters to 14.0.682 (#15320)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-02 16:55:00 +00:00
github-actions[bot]andKoenkk 0e4ea6a335 Update zigbee-herdsman-converters to 14.0.681 (#15287)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-01 19:18:59 +00:00
Koen Kanters ab1261385b Promote to dev 2022-12-01 19:59:17 +01:00
Koen Kanters 52e545f900 1.28.4 2022-12-01 19:58:42 +01:00
Koen Kanters 350abb354b Undev 2022-12-01 19:58:39 +01:00
Koen Kanters 87f253997c Update zhc to 14.0.681-hotfix.0 2022-12-01 19:56:37 +01:00
Koen Kanters 4e9b18fcbf Promote to dev 2022-12-01 17:38:11 +01:00
Koen Kanters e43c371d76 1.28.3 2022-12-01 17:35:02 +01:00
Koen Kanters a7e85a0bd9 Undev 2022-12-01 17:34:47 +01:00
Koen Kanters 7f6f6a69c7 Merge remote-tracking branch 'origin/master' into dev 2022-12-01 17:33:55 +01:00
github-actions[bot]andKoenkk 87667bdac7 Update zigbee-herdsman-converters to 14.0.680 (#15276)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-12-01 15:02:29 +00:00
github-actions[bot]andKoenkk bd8edd70bb Update zigbee-herdsman-converters to 14.0.679 (#15262)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-30 16:06:01 +00:00
github-actions[bot]andKoenkk 4a3e6b9561 Update zigbee-herdsman-converters to 14.0.678 (#15249)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-29 18:45:39 +00:00
Artem Draft f92134fc5f Disable by default update_available sensor in HA (#15237) 2022-11-29 19:18:33 +01:00
9dba2d7f11 Update zigbee-herdsman-converters to 14.0.677 (#15229)
* Update zigbee-herdsman-converters to 14.0.677

* Fix

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-28 18:49:34 +00:00
9289a26f11 Update dependencies (#15204)
* Update dependencies

* Fix diff

* fix

* update

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-27 14:52:47 +01:00
github-actions[bot]andKoenkk 17054627e9 Update zigbee-herdsman-converters to 14.0.676 (#15207)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-27 09:38:39 +00:00
github-actions[bot]andKoenkk 66c4ca072e Update zigbee-herdsman-converters to 14.0.675 (#15190)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-26 09:32:55 +00:00
github-actions[bot]andKoenkk 3b221d4fb0 Update zigbee-herdsman-converters to 14.0.674 (#15168)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-24 16:40:12 +00:00
github-actions[bot]andKoenkk 4464554f90 Update zigbee-herdsman to 0.14.76 (#15167)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-24 16:32:05 +00:00
b15cd433c4 Update zigbee-herdsman-converters to 14.0.673 (#15150)
* Update zigbee-herdsman-converters to 14.0.673

* Update homeassistant.test.js

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-23 17:56:32 +00:00
github-actions[bot]andKoenkk 4b5a03c6c5 Update zigbee-herdsman to 0.14.75 (#15149)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-23 16:10:46 +00:00
github-actions[bot]andKoenkk ca4badca4d Update zigbee-herdsman-converters to 14.0.672 (#15133)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-22 19:03:36 +00:00
DJTerentjevandAlex 1b3dd7540b Add polling when bounded for Trust and Gledopto (#15126)
* GitHub Workflows security hardening (#14799)

* build: harden update_frontend.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden update_zhc.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden ghcr_cleanup.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden update_zh.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* Add bound polling by manufacturerNames

Based on:
#7825

* Add bound polling by manufacturerNames

Based on:
#7825

Signed-off-by: Alex <aleksandrosansan@gmail.com>
Co-authored-by: Alex <aleksandrosansan@gmail.com>
2022-11-22 19:35:15 +01:00
Koen Kanters c7183ca080 Update external converter tester. 2022-11-22 19:16:25 +01:00
Koen Kanters 119531e9e2 Add external converter tester 2022-11-22 19:12:03 +01:00
85be7d28d5 Update zigbee-herdsman-converters to 14.0.671 (#15123)
* Update zigbee-herdsman-converters to 14.0.671

* Update homeassistant.ts

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-21 19:35:37 +00:00
github-actions[bot]andnurikk 6c147dae6c Update zigbee2mqtt-frontend to 0.6.119 (#15109)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-11-20 20:48:42 +00:00
github-actions[bot]andKoenkk 1fe138c34c Update zigbee-herdsman-converters to 14.0.670 (#15107)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-20 18:26:44 +00:00
github-actions[bot]andKoenkk 1258aee464 Update zigbee-herdsman to 0.14.74 (#15105)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-20 16:35:01 +00:00
github-actions[bot]andnurikk fbb0ed0e67 Update zigbee2mqtt-frontend to 0.6.118 (#15083)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-11-19 11:16:56 +00:00
github-actions[bot]andKoenkk 8510e99010 Update zigbee-herdsman-converters to 14.0.669 (#15053)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-17 17:07:37 +00:00
Koen Kanters 342955666a Fix 'dict object' has no attribute 'installed_version'. https://github.com/Koenkk/zigbee2mqtt/discussions/15039 2022-11-17 17:52:59 +01:00
github-actions[bot]andKoenkk 50cb421f64 Update zigbee-herdsman-converters to 14.0.668 (#15007)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-15 19:38:26 +00:00
github-actions[bot]andnurikk 16398b7810 Update zigbee2mqtt-frontend to 0.6.117 (#14995)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-11-15 11:36:57 +00:00
github-actions[bot]andKoenkk f3b5aee173 Update zigbee-herdsman-converters to 14.0.667 (#14983)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-14 20:16:38 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> e8f85b35c1 Bump actions/dependency-review-action from 2 to 3 (#14978)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 2 to 3.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 18:13:49 +01:00
github-actions[bot]andKoenkk dd8f13aa8d Update zigbee-herdsman to 0.14.73 (#14979)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-14 17:07:35 +00:00
dreed47 ced2ba7344 small clarification to the description for adding a user-defined device icon (#14960)
* small clarification to the description for adding a user-defined device icon

* small wording change
2022-11-14 17:49:18 +01:00
Jakub Jirutka a2f8534823 Allow to specify full file name in value reference '!' (#14955)
* Extract parsing of value reference '!' in settings into a function

* Allow to specify full file name in value reference '!'

This `network_key: '!secret network_key'` is really confusing because
it looks like a YAML tag named 'secret' and a value "network_key".
When we write `network_key: '!secret.yaml network_key'` instead, it's
a little clearer what's going on. Also, it's more consistent with file
references in 'devices' and 'groups'.
2022-11-13 15:17:59 +01:00
github-actions[bot]andKoenkk d05ef70901 Update zigbee-herdsman to 0.14.72 (#14958)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-13 09:26:45 +00:00
Jakub JirutkaandKoen Kanters 4bc0c3ed6b Use path.resolve instead of path.join in data.joinPath (#14953)
This allows specifying a path outside of the data directory using an
absolute path (e.g. /path/to/devices.yaml) or a path relative to the data
directory (e.g. devices.yaml, foo/devices.yaml, ../../devices.yaml, ...).
This change is backward compatible because file names and nested paths are
just a special case of a relative path.

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-13 09:24:47 +01:00
Koen Kanters 489d1de756 Fix Cannot set properties of undefined (setting 'installed_version'). https://github.com/Koenkk/zigbee2mqtt/issues/14917 2022-11-13 09:21:27 +01:00
github-actions[bot]andKoenkk 499b993410 Update zigbee-herdsman to 0.14.71 (#14946)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-12 15:20:46 +00:00
github-actions[bot]andKoenkk 9f0b16291a Update zigbee-herdsman-converters to 14.0.666 (#14930)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-11 16:16:51 +00:00
github-actions[bot]andKoenkk 98a6a2dfe8 Update zigbee-herdsman-converters to 14.0.665 (#14916)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-10 17:05:54 +00:00
Koen Kanters fb14ba20ca Update Docker image to use node:18-alpine3.16 (#14915) 2022-11-10 17:48:17 +01:00
Koen Kanters b68b984de6 Log Zigbee2MQTT started! on startup. https://github.com/Koenkk/zigbee2mqtt/issues/14283 2022-11-10 17:45:48 +01:00
Koen Kanters 1d36dfd932 Support Home Assistant MQTT update #14748 (#14905) 2022-11-09 21:01:30 +01:00
github-actions[bot]andKoenkk 672da64913 Update zigbee-herdsman-converters to 14.0.664 (#14900)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-09 18:53:08 +00:00
github-actions[bot]andKoenkk cb29e164f8 Update zigbee-herdsman-converters to 14.0.663 (#14889)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-08 18:20:43 +00:00
Vincenzo Mantova 1e6a457190 more Home Assistant icons (#14865)
* add missing icons and classes for BRT-100-TRV (and possibly others)

* use high/low thermometer icons for max/min temperatures
2022-11-08 16:24:19 +01:00
github-actions[bot]andKoenkk cd22dafc89 Update zigbee-herdsman-converters to 14.0.662 (#14860)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-07 17:34:17 +00:00
github-actions[bot]andKoenkk 83d8a0e6a2 Update zigbee-herdsman to 0.14.70 (#14858)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-07 17:06:27 +00:00
Vincenzo Mantova e0b765ba88 Revert "Respect climate system_mode ACCESS_SET bit in Home Assistant (#14715)" (#14842)
This reverts commit 58c800181a.
2022-11-07 17:38:30 +01:00
5e2df18b75 Update zigbee-herdsman-converters to 14.0.661 (#14839)
* Update zigbee-herdsman-converters to 14.0.661

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-06 14:42:08 +00:00
github-actions[bot]andKoenkk 9b48334e0e Update zigbee-herdsman to 0.14.69 (#14838)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-06 12:51:48 +00:00
github-actions[bot]andKoenkk c8ae15e92d Update dependencies (#14834)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-06 13:37:56 +01:00
John DoeandAinur Timerbaev f88ac154a2 Mark node v19 as supported (#14837)
* Mark node19 as supported

* Fix condition

* Fix tests

Co-authored-by: Ainur Timerbaev <ainur.timerbaev@superawesome.com>
2022-11-06 12:28:59 +00:00
Alex e66fe8534e GitHub Workflows security hardening (#14799)
* build: harden update_frontend.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden update_zhc.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden ghcr_cleanup.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

* build: harden update_zh.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>

Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-11-05 14:21:55 +01:00
Jakub Jirutka c2e95bdb6a Remove core-js polyfills (#14788)
According to engines.node in package.json, the minimal supported version
of Node.js is 14.

* `Object.fromEntries()` is supported by Node.js since 12.0.0
* `Array.prototype.flat()` is supported by Node.js since 11.0.0

These polyfills were added in #9085, but the minimum supported Node.js
version has since been raised to 14.
2022-11-05 14:17:53 +01:00
github-actions[bot]andnurikk 7c5ef8a3d6 Update zigbee2mqtt-frontend to 0.6.115 (#14816)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-11-05 09:59:34 +00:00
Koen Kanters 4a2190f969 Add back fsevents 2022-11-04 19:35:14 +01:00
github-actions[bot]andKoenkk a3ed236524 Update dependencies (#14810)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-04 17:08:56 +01:00
Koen Kanters f4d8e6f4c5 Merge branch 'master' into dev 2022-11-04 17:05:54 +01:00
Koen Kanters 360a777a4e 1.28.2 2022-11-04 16:53:33 +01:00
Koen Kanters 5ed8b36cf2 Bump zigbee-herdsman-converters to 14.0.657-hotfix.0 2022-11-04 16:52:53 +01:00
github-actions[bot]andKoenkk 9540b6c182 Update zigbee-herdsman-converters to 14.0.660 (#14792)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-03 18:43:32 +00:00
Koen Kanters 31f002294e Update README.md 2022-11-02 22:00:25 +01:00
ecfc7e8906 Update zigbee-herdsman-converters to 14.0.659 (#14780)
* Update zigbee-herdsman-converters to 14.0.659

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-11-02 20:56:54 +00:00
Koen Kanters 60bf855e74 Fix starting via cli.js. https://github.com/Koenkk/zigbee2mqtt/pull/14396 2022-11-02 20:01:06 +01:00
Koen Kanters c3f6e793fa Promote to dev 2022-11-01 19:59:25 +01:00
Koen Kanters 48117fddfa 1.28.1 2022-11-01 19:58:47 +01:00
Koen Kanters 7e70a5984f Undev 2022-11-01 19:58:44 +01:00
github-actions[bot]andKoenkk 4589c9f691 Update zigbee-herdsman-converters to 14.0.657 (#14753)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-01 18:51:21 +00:00
github-actions[bot]andKoenkk d81c15b5af Update zigbee-herdsman to 0.14.68 (#14754)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-01 16:44:28 +00:00
github-actions[bot]andKoenkk 043ae738d2 Update zigbee-herdsman to 0.14.67 (#14752)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-11-01 16:07:35 +00:00
github-actions[bot]andKoenkk 68184d669e Update zigbee-herdsman-converters to 14.0.655 (#14734)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-31 18:20:01 +00:00
github-actions[bot]andKoenkk fb3ee70c7a Update zigbee-herdsman-converters to 14.0.654 (#14727)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-30 19:07:00 +00:00
github-actions[bot]andKoenkk c5697e6c2b Update dependencies (#14718)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-30 19:23:11 +01:00
Vincenzo Mantova 58c800181a Respect climate system_mode ACCESS_SET bit in Home Assistant (#14715) 2022-10-30 19:16:32 +01:00
github-actions[bot]andKoenkk fd023268c5 Update zigbee-herdsman-converters to 14.0.652 (#14708)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-29 15:50:52 +00:00
github-actions[bot]andKoenkk 9dc93c7d27 Update zigbee-herdsman-converters to 14.0.651 (#14700)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-29 08:21:29 +00:00
Koen Kanters c943992e49 Fix 60de5b7676 2022-10-27 21:49:25 +02:00
github-actions[bot]andKoenkk dd9e92f81f Update zigbee-herdsman-converters to 14.0.650 (#14677)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-27 21:46:16 +02:00
Koen Kanters 60de5b7676 Respond with NO_IMAGE_AVAILABLE when device requests OTA. https://github.com/Koenkk/zigbee2mqtt/issues/13396 2022-10-27 20:39:44 +02:00
github-actions[bot]andKoenkk 6c0430b6e2 Update zigbee-herdsman-converters to 14.0.649 (#14660)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-26 16:57:24 +00:00
github-actions[bot]andKoenkk ddc4345f01 Update zigbee-herdsman-converters to 14.0.648 (#14633)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-24 17:49:52 +00:00
Koen Kanters 41053aa024 Set NODE_ENV to PRODUTION in Docker container. https://github.com/Koenkk/zigbee2mqtt/discussions/14625 2022-10-24 19:30:40 +02:00
github-actions[bot]andKoenkk 08ceae235e Update dependencies (#14602)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-23 09:09:56 +02:00
github-actions[bot]andKoenkk 599380dd63 Update zigbee-herdsman-converters to 14.0.647 (#14592)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-22 15:58:08 +00:00
github-actions[bot]andKoenkk a426ee1041 Update zigbee-herdsman-converters to 14.0.646 (#14576)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-21 14:44:53 +00:00
github-actions[bot]andKoenkk 939fdf0496 Update zigbee-herdsman-converters to 14.0.645 (#14553)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-19 15:59:22 +00:00
github-actions[bot]andKoenkk 3cffc2fdd8 Update zigbee-herdsman to 0.14.66 (#14549)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-19 15:26:35 +00:00
github-actions[bot]andKoenkk 22d2170d41 Update zigbee-herdsman-converters to 14.0.644 (#14540)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-18 18:16:04 +00:00
Vladyslav Pavlov 50a9de4e2b Expose step size of local_temperature_calibration Home Assistant sensor (#14502) 2022-10-18 17:59:32 +02:00
github-actions[bot]andKoenkk 2c12cbaf18 Update zigbee-herdsman to 0.14.65 (#14538)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-18 15:50:13 +00:00
github-actions[bot]andKoenkk ef6826f263 Update dependencies (#14503)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-18 17:38:26 +02:00
github-actions[bot]andKoenkk ceeaabafbc Update zigbee-herdsman-converters to 14.0.643 (#14458)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-12 19:47:13 +00:00
github-actions[bot]andKoenkk c49f5b157d Update zigbee-herdsman-converters to 14.0.642 (#14444)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-11 18:52:33 +00:00
github-actions[bot]andKoenkk 0a71e39253 Update zigbee-herdsman-converters to 14.0.641 (#14426)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-10 15:20:46 +00:00
github-actions[bot]andKoenkk 52a0f68c87 Update zigbee-herdsman-converters to 14.0.640 (#14416)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-09 18:19:11 +00:00
github-actions[bot]andKoenkk 457fc9da7c Update dependencies (#14411)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-09 09:01:32 +02:00
github-actions[bot]andKoenkk 5b39884c13 Update zigbee-herdsman-converters to 14.0.639 (#14403)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-08 12:18:16 +00:00
Matt 4d7b1a6c03 Allow Zigbee2MQTT to be installed as a module (#14396)
* Fix mnodule resolution

Allows the correct module path to be found if installed as a package

* Correct signature to avoid TS error

* Allow module to be included in another module

Only create hash ot auto-start if it is the main module, otherwise export the `start` function
2022-10-08 10:48:15 +02:00
Koen Kanters 50b5c67dde Support effects for Home Assistant light groups. #13438 2022-10-08 10:22:26 +02:00
Ben Windsor 005ada0237 Make temperature sensor selection for thermostats appear as a config item in HA (#14376) 2022-10-07 16:58:06 +02:00
github-actions[bot]andKoenkk e9b1080734 Update zigbee-herdsman-converters to 14.0.638 (#14374)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-06 16:12:23 +00:00
Ben Windsor 56cc1432e9 Mark min_temperature_limit as a config variable for HA (#14358) 2022-10-06 17:31:48 +02:00
github-actions[bot]andKoenkk e3dcc7b0a6 Update zigbee-herdsman-converters to 14.0.637 (#14353)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-05 19:08:45 +00:00
github-actions[bot]andKoenkk 37aea8df8f Update zigbee-herdsman to 0.14.64 (#14348)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-05 14:30:54 +00:00
github-actions[bot]andKoenkk f8d64b67ad Update zigbee-herdsman-converters to 14.0.636 (#14331)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-04 17:30:49 +00:00
github-actions[bot]andKoenkk 77fc3a9308 Update dependencies (#14279)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-04 19:26:54 +02:00
Ben Windsor db3730ea44 Expose value_step to home assistant if it has been set on a numeric type (#14313) 2022-10-04 18:02:35 +02:00
github-actions[bot]andnurikk 98ceaa04bb Update zigbee2mqtt-frontend to 0.6.114 (#14290)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-10-02 16:51:48 +00:00
github-actions[bot]andnurikk e3e4a0a440 Update zigbee2mqtt-frontend to 0.6.113 (#14271)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-10-01 09:41:07 +00:00
github-actions[bot]andKoenkk 52150b7257 Update zigbee-herdsman to 0.14.63 (#14270)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-01 08:53:48 +00:00
Koen Kanters 5727fe3a49 Dev 2022-10-01 09:40:35 +02:00
Koen Kanters 03ba647dc6 1.28.0 2022-10-01 09:39:09 +02:00
Koen Kanters be1e9b4421 Undev 2022-10-01 09:38:55 +02:00
github-actions[bot]andKoenkk 57ce1e98a7 Update zigbee-herdsman-converters to 14.0.635 (#14268)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-10-01 07:33:47 +00:00
github-actions[bot]andKoenkk 3d2d4fd298 Update zigbee-herdsman-converters to 14.0.633 (#14262)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-30 18:58:14 +00:00
github-actions[bot]andKoenkk 2258ed1dfa Update zigbee-herdsman to 0.14.62 (#14259)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-30 18:02:25 +00:00
github-actions[bot]andKoenkk 2d750f8b9a Update zigbee-herdsman-converters to 14.0.632 (#14254)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-29 20:31:02 +00:00
b54e29917e Update zigbee-herdsman to 0.14.61 (#14238)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-09-28 18:28:27 +00:00
Markus WegmannandKoen Kanters 3b60a8e02a Fix cover state publishing of multi-endpoint devices (#14200)
* Fix cover state publishing of multi-endpoint devices

* WIP testing

* WIP test for multiEndpoint cover device

* WIP zigfred plus test

* WIP zigfred plus test

* Remove zigfred plus meta testing flag

* Working zigfred plus integration into bridge test

* Working integration of zigfred plus in tests

* WIP zigfred plus testing

* Add working test for multi-cover devices. Working cover state for multi-cover + multi-light devices.

* Fix republishing of cover state

* Fix cover position and tilt readout with postfix topic

* Fix homeassistant.test.js for zigfred plus cover

* Fix cover value template to support multi-cover devices

* Update homeassistant.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-09-28 20:21:30 +02:00
github-actions[bot]andKoenkk a95d47fef9 Update zigbee-herdsman-converters to 14.0.631 (#14232)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-28 15:14:56 +00:00
github-actions[bot]andKoenkk d385d6c1af Update zigbee-herdsman to 0.14.60 (#14231)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-28 15:12:36 +00:00
github-actions[bot]andnurikk 3453585fd0 Update zigbee2mqtt-frontend to 0.6.112 (#14216)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-09-27 15:55:09 +00:00
github-actions[bot]andKoenkk 7b72b85cf7 Update zigbee-herdsman-converters to 14.0.630 (#14186)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-25 08:15:30 +00:00
github-actions[bot]andKoenkk 47378c46bd Update dependencies (#14180)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-25 09:16:35 +02:00
github-actions[bot]andKoenkk 647d45c4fa Update zigbee-herdsman-converters to 14.0.629 (#14171)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-23 20:03:53 +00:00
github-actions[bot]andKoenkk 6775423b86 Update zigbee-herdsman to 0.14.59 (#14167)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-23 18:13:43 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 3413d472ab Bump actions/stale from 5 to 6 (#14160)
Bumps [actions/stale](https://github.com/actions/stale) from 5 to 6.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v5...v6)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 19:49:49 +02:00
github-actions[bot]andKoenkk d654e085ae Update zigbee-herdsman-converters to 14.0.628 (#14143)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-22 18:24:44 +00:00
github-actions[bot]andKoenkk 802803479e Update zigbee-herdsman to 0.14.58 (#14142)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-22 18:00:13 +00:00
github-actions[bot]andKoenkk 639babd9ab Update zigbee-herdsman-converters to 14.0.627 (#14127)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-21 18:05:46 +00:00
Koen Kanters 49f7a5ca1d Improve Home Assistant history view for sensors without unit. #14103 2022-09-21 17:11:03 +02:00
github-actions[bot]andKoenkk 615c70f3bb Update zigbee-herdsman to 0.14.57 (#14102)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-20 14:59:08 +00:00
github-actions[bot]andKoenkk 9b4a03c0e8 Update zigbee-herdsman-converters to 14.0.626 (#14083)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-19 16:17:25 +00:00
github-actions[bot]andKoenkk 0ccfb5aded Update zigbee-herdsman to 0.14.56 (#14082)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-19 18:01:46 +02:00
NoneangelandKoen Kanters 1966456814 Add HVAC swing mode to Home Assistant discovery (#13784)
* hvac swing mode

* test: add GW003-AS-IN-TE-FC to tested devices

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-09-19 17:56:58 +02:00
github-actions[bot]andKoenkk 925714022f Update dependencies (#14052)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-19 17:39:10 +02:00
github-actions[bot]andKoenkk 1e24734a6c Update zigbee-herdsman-converters to 14.0.625 (#14022)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-16 07:50:35 +00:00
github-actions[bot]andKoenkk c4fc5335d5 Update zigbee-herdsman to 0.14.55 (#14017)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-15 08:44:52 +00:00
github-actions[bot]andKoenkk 0133afaef0 Update zigbee-herdsman-converters to 14.0.624 (#14016)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-15 08:15:30 +00:00
github-actions[bot]andKoenkk 4d0fd3275b Update zigbee-herdsman-converters to 14.0.623 (#14004)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-14 07:41:56 +00:00
5f992cae76 Update zigbee-herdsman-converters to 14.0.622 (#13994)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-09-13 08:04:17 +00:00
Koen Kanters 5a24e62b51 Fix #ba1e3a06b62d9b53f456065f18807410333da3fd 2022-09-13 10:00:22 +02:00
Koen Kanters ba1e3a06b6 Fix cover value_template properties for multi endpoint devices. #13944 2022-09-13 09:16:24 +02:00
github-actions[bot]andKoenkk 809f5d3ed1 Update zigbee-herdsman-converters to 14.0.621 (#13977)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-12 09:25:13 +00:00
Koen Kanters 125ca61812 Log MQTT disconnect reason. #13965 2022-09-12 09:34:20 +02:00
Koen Kanters d38b8ff5f1 Fix cover state in Home Assistant for multi channel cover controllers. #13944 2022-09-12 09:30:07 +02:00
github-actions[bot]andKoenkk 3f7e9941e2 Update zigbee-herdsman-converters to 14.0.619 (#13961)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-11 08:13:59 +00:00
github-actions[bot]andKoenkk 8ba0fe9367 Update dependencies (#13955)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-11 09:39:20 +02:00
github-actions[bot]andKoenkk cbf75d6339 Update zigbee-herdsman-converters to 14.0.618 (#13949)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-10 07:51:44 +00:00
github-actions[bot]andKoenkk 0ea528f750 Update zigbee-herdsman-converters to 14.0.617 (#13936)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-09 07:51:25 +00:00
github-actions[bot]andKoenkk d12b6e0ca9 Update zigbee-herdsman to 0.14.54 (#13935)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-09 07:20:30 +00:00
github-actions[bot]andKoenkk 2b1d1ff6ef Update zigbee-herdsman-converters to 14.0.616 (#13915)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-08 08:11:04 +00:00
github-actions[bot]andKoenkk fc7de95d1d Update zigbee-herdsman-converters to 14.0.614 (#13897)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-07 08:16:05 +00:00
Koen Kanters 2bca5deb66 Fix setting devices/groups to file via environment variables not working. #7807 2022-09-07 10:07:16 +02:00
github-actions[bot]andKoenkk 8be8c4df56 Update zigbee-herdsman-converters to 14.0.613 (#13883)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-06 08:56:30 +00:00
Koen KantersandJohn Doe 9519ffdac7 Add install code support (#13780)
* Add install code support

* Update bridge.ts

Co-authored-by: John Doe <nurikk@users.noreply.github.com>
2022-09-06 09:30:03 +02:00
github-actions[bot]andKoenkk 0b645a4e6a Update zigbee-herdsman-converters to 14.0.611 (#13868)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-05 08:02:00 +00:00
github-actions[bot]andKoenkk 67a94621ab Update dependencies (#13842)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-05 09:10:10 +02:00
github-actions[bot]andnurikk 24d83b05f7 Update zigbee2mqtt-frontend to 0.6.111 (#13841)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-09-03 21:26:02 +00:00
Koen Kanters 178f72c304 Promote to dev 2022-09-01 11:27:14 +02:00
Koen Kanters 7dc48fb6d6 1.27.2 2022-09-01 11:24:20 +02:00
Koen Kanters 5017f556fa Undev 2022-09-01 11:24:17 +02:00
github-actions[bot]andKoenkk 437eeb350c Update zigbee-herdsman to 0.14.53 (#13793)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-01 11:23:29 +02:00
github-actions[bot]andKoenkk cfd792dc70 Update zigbee-herdsman to 0.14.52 (#13792)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-09-01 09:11:55 +00:00
Koen Kanters 2a4722bd38 Promote to dev 2022-09-01 08:42:29 +02:00
Koen Kanters d381f2daa4 1.27.1 2022-09-01 08:41:47 +02:00
Koen Kanters b05b4adf57 Undev 2022-09-01 08:40:53 +02:00
Koen Kanters 96d72103f2 Merge branch 'dev' 2022-09-01 08:37:54 +02:00
github-actions[bot]andKoenkk 97ffa9610b Update zigbee-herdsman-converters to 14.0.610 (#13782)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-31 16:46:59 +00:00
github-actions[bot]andKoenkk 09d6c8601c Update zigbee-herdsman to 0.14.51 (#13781)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-31 16:04:14 +00:00
github-actions[bot]andKoenkk fc409a6884 Update zigbee-herdsman-converters to 14.0.609 (#13769)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-30 15:38:45 +00:00
github-actions[bot]andnurikk fa63ede4b6 Update zigbee2mqtt-frontend to 0.6.110 (#13757)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-08-29 19:21:24 +00:00
github-actions[bot]andKoenkk fd24c8186e Update zigbee-herdsman to 0.14.50 (#13753)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-29 18:06:26 +00:00
github-actions[bot]andKoenkk 0816d07b93 Update zigbee-herdsman-converters to 14.0.608 (#13752)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-29 16:39:36 +00:00
github-actions[bot]andnurikk c1b9345613 Update zigbee2mqtt-frontend to 0.6.109 (#13748)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-08-29 10:30:15 +00:00
github-actions[bot]andKoenkk 7f198d18ac Update zigbee-herdsman-converters to 14.0.607 (#13739)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-28 17:49:58 +00:00
github-actions[bot]andKoenkk 802bccd1f3 Update zigbee-herdsman to 0.14.49 (#13736)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-28 15:26:35 +00:00
github-actions[bot]andKoenkk 77bd76d1ca Update zigbee-herdsman-converters to 14.0.606 (#13710)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-27 08:14:22 +00:00
github-actions[bot]andKoenkk 8dd8b2848c Update zigbee-herdsman-converters to 14.0.605 (#13703)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-26 19:23:43 +00:00
github-actions[bot]andKoenkk c5d54a845a Update zigbee-herdsman-converters to 14.0.604 (#13687)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-25 16:04:17 +00:00
github-actions[bot]andKoenkk f1a19151fc Update zigbee-herdsman-converters to 14.0.603 (#13670)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-24 17:08:37 +00:00
963c2d86d3 Update zigbee-herdsman-converters to 14.0.602 (#13654)
* Update zigbee-herdsman-converters to 14.0.602

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-08-23 19:53:49 +00:00
9e6b4083b2 Update zigbee-herdsman-converters to 14.0.601 (#13646)
* Update zigbee-herdsman-converters to 14.0.601

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-08-22 18:06:45 +00:00
github-actions[bot]andKoenkk f29c4a24c2 Update zigbee-herdsman-converters to 14.0.600 (#13634)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-21 18:23:36 +00:00
github-actions[bot]andKoenkk a75e1c2b2b Update dependencies (#13630)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-21 09:30:25 +02:00
github-actions[bot]andKoenkk 62499483ce Update zigbee-herdsman-converters to 14.0.599 (#13618)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-20 07:39:24 +00:00
github-actions[bot]andKoenkk 304bb7b9d1 Update zigbee-herdsman-converters to 14.0.598 (#13611)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-19 19:06:19 +00:00
github-actions[bot]andKoenkk 15a069e3c7 Update zigbee-herdsman to 0.14.48 (#13610)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-19 19:01:11 +00:00
Koen Kanters e0a9323d6e Update dont-stale label 2022-08-19 20:57:44 +02:00
github-actions[bot]andKoenkk a0182c2e39 Update zigbee-herdsman-converters to 14.0.597 (#13596)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-18 17:23:05 +00:00
github-actions[bot]andKoenkk 327f816c0e Update zigbee-herdsman-converters to 14.0.596 (#13586)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-17 18:29:55 +00:00
github-actions[bot]andnurikk 040d2a1b36 Update zigbee2mqtt-frontend to 0.6.108 (#13573)
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
2022-08-16 20:51:02 +00:00
github-actions[bot]andKoenkk 497a48b8b0 Update zigbee-herdsman-converters to 14.0.595 (#13569)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-16 18:59:33 +00:00
github-actions[bot]andKoenkk 36a4754430 Update zigbee-herdsman-converters to 14.0.594 (#13542)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-14 16:29:56 +00:00
Koen Kanters 60b9f6f6b2 Home Assistant discovery: add enums with only SET (e.g. selftest). https://github.com/Koenkk/zigbee2mqtt/issues/13532 2022-08-14 18:22:35 +02:00
github-actions[bot]andKoenkk 2bdc7b7aca Update dependencies (#13535)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-14 09:58:14 +02:00
github-actions[bot]andKoenkk fea5d44a57 Update zigbee-herdsman-converters to 14.0.593 (#13517)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-12 14:59:07 +00:00
Koen Kanters 281e3870d3 Fix tests 2022-08-11 20:32:01 +02:00
Koen Kanters c9b2a7f6d4 Revert "Publish device and bridge availability when Home Assistant comes online. https://github.com/Koenkk/zigbee2mqtt/issues/13382"
This reverts commit 619d5232db.
2022-08-11 20:23:40 +02:00
Koen Kanters 6314b86d9b Better fix for #13382 2022-08-11 20:23:19 +02:00
Koen Kanters 619d5232db Publish device and bridge availability when Home Assistant comes online. https://github.com/Koenkk/zigbee2mqtt/issues/13382 2022-08-11 19:50:46 +02:00
Koen Kanters da4a3b9a77 Fix exception when using group remove_all. https://github.com/Koenkk/zigbee2mqtt/issues/13484 2022-08-10 22:38:04 +02:00
github-actions[bot]andKoenkk 62284dbd1a Update zigbee-herdsman-converters to 14.0.592 (#13489)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-10 17:41:21 +00:00
wysiwyng addb09275a Add category and icon for flip_indicator_light Home Assistant discovery (#13477) 2022-08-10 16:57:31 +02:00
github-actions[bot]andKoenkk 9c45a5fdf0 Update zigbee-herdsman-converters to 14.0.591 (#13469)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-09 15:06:24 +00:00
Koen Kanters 0aa29a0fab Home Assistant discovery: always expose cover state. https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/359 2022-08-09 17:01:22 +02:00
github-actions[bot]andKoenkk 5f778a7570 Update zigbee-herdsman-converters to 14.0.590 (#13458)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-08 15:54:36 +00:00
github-actions[bot]andKoenkk e8f6def246 Update zigbee-herdsman-converters to 14.0.589 (#13447)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-07 16:27:47 +00:00
github-actions[bot]andKoenkk 99485fa324 Update dependencies (#13441)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-07 09:20:22 +02:00
github-actions[bot]andKoenkk 483ff4aa8a Update zigbee-herdsman-converters to 14.0.588 (#13424)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-06 08:02:28 +00:00
github-actions[bot]andKoenkk b6c0afc129 Update zigbee-herdsman-converters to 14.0.587 (#13402)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-04 19:55:35 +00:00
github-actions[bot]andKoenkk 7def5ea9bf Update zigbee-herdsman to 0.14.47 (#13394)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-03 16:06:19 +00:00
github-actions[bot]andKoenkk 4e590ece19 Update zigbee-herdsman-converters to 14.0.586 (#13376)
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2022-08-02 17:42:22 +00:00
c2faa3815a Update zigbee-herdsman-converters to 14.0.585 (#13362)
* Update zigbee-herdsman-converters to 14.0.585

* Fix tests

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-08-01 18:12:28 +00:00
Koen Kanters 52f8753a09 Promote to dev 2022-08-01 17:44:02 +02:00
53 changed files with 3523 additions and 4112 deletions
+6 -4
View File
@@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'npm'
- name: Install dependencies
@@ -45,8 +45,9 @@ jobs:
run: |
docker buildx build \
--build-arg COMMIT=$(git rev-parse --short HEAD) \
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7 \
--platform linux/arm64/v8,linux/386,linux/amd64,linux/arm/v6,linux/arm/v7 \
-f docker/Dockerfile \
--provenance=false \
--push \
-t koenkk/zigbee2mqtt:latest-dev -t ghcr.io/koenkk/zigbee2mqtt:latest-dev \
.
@@ -56,8 +57,9 @@ jobs:
TAG="$(git describe --tags)"
docker buildx build \
--build-arg COMMIT=$(git rev-parse --short HEAD) \
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7 \
--platform linux/arm64/v8,linux/386,linux/amd64,linux/arm/v6,linux/arm/v7 \
-f docker/Dockerfile \
--provenance=false \
--push \
-t koenkk/zigbee2mqtt:latest -t "koenkk/zigbee2mqtt:$TAG" -t ghcr.io/koenkk/zigbee2mqtt:latest -t "ghcr.io/koenkk/zigbee2mqtt:$TAG" \
.
@@ -80,7 +82,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [14, 16, 18]
node: [14, 16, 18, 19]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
+1 -1
View File
@@ -11,4 +11,4 @@ jobs:
- name: 'Checkout repository'
uses: actions/checkout@v3
- name: 'Dependency review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v3
+1
View File
@@ -3,6 +3,7 @@ on:
name: GHCR cleanup
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
+2 -2
View File
@@ -14,7 +14,7 @@ jobs:
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
- uses: actions/stale@v7
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'
@@ -22,4 +22,4 @@ jobs:
days-before-stale: 30
days-before-close: 7
operations-per-run: 500
exempt-issue-labels: 'breaking change'
exempt-issue-labels: dont-stale
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npx npm-check-updates -u -x connect-gzip-static # connect-gzip-static only supports node 16
- run: npm install
- uses: peter-evans/create-pull-request@v4
+6 -1
View File
@@ -3,8 +3,13 @@ on:
repository_dispatch:
types: update_frontend
permissions: {}
jobs:
update_frontend:
permissions:
contents: write # to create branch (peter-evans/create-pull-request)
pull-requests: write # to create a PR (peter-evans/create-pull-request)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -13,7 +18,7 @@ jobs:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm install zigbee2mqtt-frontend@${{ github.event.client_payload.version }} --save-exact
- uses: peter-evans/create-pull-request@v4
id: cpr
+6 -1
View File
@@ -3,8 +3,13 @@ on:
repository_dispatch:
types: update_zh
permissions: {}
jobs:
update_zh:
permissions:
contents: write # to create branch (peter-evans/create-pull-request)
pull-requests: write # to create a PR (peter-evans/create-pull-request)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -13,7 +18,7 @@ jobs:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm install zigbee-herdsman@${{ github.event.client_payload.version }} --save-exact
- uses: peter-evans/create-pull-request@v4
id: cpr
+6 -1
View File
@@ -3,8 +3,13 @@ on:
repository_dispatch:
types: update_zhc
permissions: {}
jobs:
update_zhc:
permissions:
contents: write # to create branch (peter-evans/create-pull-request)
pull-requests: write # to create a PR (peter-evans/create-pull-request)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -13,7 +18,7 @@ jobs:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm install zigbee-herdsman-converters@${{ github.event.client_payload.version }} --save-exact
- uses: peter-evans/create-pull-request@v4
id: cpr
+1 -1
View File
@@ -54,7 +54,7 @@ Zigbee2MQTT integrates well with (almost) every home automation solution because
### [Home Assistant](https://www.home-assistant.io/)
- [Home Assistant](https://www.home-assistant.io/hassio/): Using [the official addon](https://github.com/zigbee2mqtt/hassio-zigbee2mqtt)
- Generic install or Hassbian: Using instructions [here](https://www.zigbee2mqtt.io/guide/usage/integrations/home_assistant.html)
- Generic install: using instructions [here](https://www.zigbee2mqtt.io/guide/usage/integrations/home_assistant.html)
<img align="left" height="100px" width="100px" src="https://user-images.githubusercontent.com/2734836/47615848-b8dd8700-dabd-11e8-9d77-175002dd8987.png">
+8 -4
View File
@@ -1,7 +1,7 @@
FROM node:16-alpine3.15 as base
FROM alpine:3.17.2 as base
WORKDIR /app
RUN apk add --no-cache tzdata eudev tini
RUN apk add --no-cache tzdata eudev tini nodejs
# Dependencies and build
FROM base as dependencies_and_build
@@ -9,8 +9,10 @@ FROM base as dependencies_and_build
COPY package*.json tsconfig.json index.js ./
COPY lib ./lib
RUN apk add --no-cache --virtual .buildtools make gcc g++ python3 linux-headers git && \
RUN apk add --no-cache --virtual .buildtools make gcc g++ python3 linux-headers git npm && \
npm ci --production --no-audit --no-optional --no-update-notifier && \
# Serialport needs to be rebuild for Alpine https://serialport.io/docs/9.x.x/guide-installation#alpine-linux
npm rebuild --build-from-source && \
apk del .buildtools
# Release
@@ -28,5 +30,7 @@ RUN mkdir /app/data
ARG COMMIT
RUN echo "$COMMIT" > dist/.hash
ENV NODE_ENV production
ENTRYPOINT ["docker-entrypoint.sh"]
CMD [ "/sbin/tini", "--", "node", "index.js"]
CMD [ "/sbin/tini", "--", "node", "index.js"]
+9 -5
View File
@@ -1,5 +1,3 @@
require('core-js/features/object/from-entries');
require('core-js/features/array/flat');
const semver = require('semver');
const engines = require('./package.json').engines;
const fs = require('fs');
@@ -120,10 +118,16 @@ async function handleQuit() {
}
}
if (process.argv.length === 3 && process.argv[2] === 'writehash') {
writeHash();
if (require.main === module || require.main.filename.endsWith(path.sep + 'cli.js')) {
if (process.argv.length === 3 && process.argv[2] === 'writehash') {
writeHash();
} else {
process.on('SIGINT', handleQuit);
process.on('SIGTERM', handleQuit);
start();
}
} else {
process.on('SIGINT', handleQuit);
process.on('SIGTERM', handleQuit);
start();
module.exports = {start};
}
+10 -6
View File
@@ -39,7 +39,7 @@ const AllExtensions = [
type ExtensionArgs = [Zigbee, MQTT, State, PublishEntityState, EventBus,
(enable: boolean, name: string) => Promise<void>, () => void, (extension: Extension) => Promise<void>];
class Controller {
export class Controller {
private eventBus: EventBus;
private zigbee: Zigbee;
private state: State;
@@ -49,7 +49,7 @@ class Controller {
private extensions: Extension[];
private extensionArgs: ExtensionArgs;
constructor(restartCallback: () => void, exitCallback: (code: number) => void) {
constructor(restartCallback: () => void, exitCallback: (code: number, restart: boolean) => void) {
logger.init();
this.eventBus = new EventBus( /* istanbul ignore next */ (error) => {
logger.error(`Error: ${error.message}`);
@@ -57,7 +57,7 @@ class Controller {
});
this.zigbee = new Zigbee(this.eventBus);
this.mqtt = new MQTT(this.eventBus);
this.state = new State(this.eventBus);
this.state = new State(this.eventBus, this.zigbee);
this.restartCallback = restartCallback;
this.exitCallback = exitCallback;
@@ -144,8 +144,7 @@ class Controller {
try {
await this.mqtt.connect();
} catch (error) {
logger.error(`MQTT failed to connect: ${error.message}`);
logger.error('Exiting...');
logger.error(`MQTT failed to connect, exiting...`);
await this.zigbee.stop();
await this.exit(1);
}
@@ -164,6 +163,8 @@ class Controller {
this.eventBus.onLastSeenChanged(this,
(data) => utils.publishLastSeen(data, settings.get(), false, this.publishEntityState));
logger.info(`Zigbee2MQTT started!`);
}
@bind async enableDisableExtension(enable: boolean, name: string): Promise<void> {
@@ -242,11 +243,14 @@ class Controller {
message.device = {
friendlyName: entity.name, model: entity.definition ? entity.definition.model : 'unknown',
ieeeAddr: entity.ieeeAddr, networkAddress: entity.zh.networkAddress, type: entity.zh.type,
manufacturerID: entity.zh.manufacturerID, manufacturerName: entity.zh.manufacturerName,
manufacturerID: entity.zh.manufacturerID,
powerSource: entity.zh.powerSource, applicationVersion: entity.zh.applicationVersion,
stackVersion: entity.zh.stackVersion, zclVersion: entity.zh.zclVersion,
hardwareVersion: entity.zh.hardwareVersion, dateCode: entity.zh.dateCode,
softwareBuildID: entity.zh.softwareBuildID,
// Manufacturer name can contain \u0000, remove this.
// https://github.com/home-assistant/core/issues/85691
manufacturerName: entity.zh.manufacturerName?.split('\u0000')[0],
};
}
+19 -2
View File
@@ -68,7 +68,8 @@ const reportClusters: {[s: string]:
type PollOnMessage = {
cluster: {[s: string]: {type: string, data: KeyValue}[]}
read: {cluster: string, attributes: string[], attributesForEndpoint?: (endpoint: zh.Endpoint) => Promise<string[]>}
manufacturerIDs: number[]
manufacturerIDs: number[],
manufacturerNames: string [],
}[];
const pollOnMessage: PollOnMessage = [
@@ -101,6 +102,11 @@ const pollOnMessage: PollOnMessage = [
zigbeeHersdman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHersdman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHersdman.Zcl.ManufacturerCode.TELINK,
zigbeeHersdman.Zcl.ManufacturerCode.BUSCH_JAEGER,
],
manufacturerNames: [
'GLEDOPTO',
'Trust International B.V.\u0000',
],
},
{
@@ -132,6 +138,11 @@ const pollOnMessage: PollOnMessage = [
zigbeeHersdman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHersdman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHersdman.Zcl.ManufacturerCode.TELINK,
zigbeeHersdman.Zcl.ManufacturerCode.BUSCH_JAEGER,
],
manufacturerNames: [
'GLEDOPTO',
'Trust International B.V.\u0000',
],
},
{
@@ -159,6 +170,11 @@ const pollOnMessage: PollOnMessage = [
zigbeeHersdman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
zigbeeHersdman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
zigbeeHersdman.Zcl.ManufacturerCode.TELINK,
// Note: ManufacturerCode.BUSCH_JAEGER is left out intentionally here as their devices don't support colors
],
manufacturerNames: [
'GLEDOPTO',
'Trust International B.V.\u0000',
],
},
];
@@ -456,7 +472,8 @@ export default class Bind extends Extension {
for (const endpoint of toPoll) {
for (const poll of polls) {
if (!poll.manufacturerIDs.includes(endpoint.getDevice().manufacturerID) ||
if ((!poll.manufacturerIDs.includes(endpoint.getDevice().manufacturerID) &&
!poll.manufacturerNames.includes(endpoint.getDevice().manufacturerName)) ||
!endpoint.supportsInputCluster(poll.read.cluster)) {
continue;
}
+24 -32
View File
@@ -6,7 +6,6 @@ import Transport from 'winston-transport';
import bind from 'bind-decorator';
import stringify from 'json-stable-stringify-without-jsonify';
import objectAssignDeep from 'object-assign-deep';
import {detailedDiff} from 'deep-object-diff';
import Extension from './extension';
import Device from '../model/device';
import Group from '../model/group';
@@ -44,6 +43,7 @@ export default class Bridge extends Extension {
'backup': this.backup,
'touchlink/factory_reset': this.touchlinkFactoryReset,
'touchlink/identify': this.touchlinkIdentify,
'install_code/add': this.installCodeAdd,
'touchlink/scan': this.touchlinkScan,
'health_check': this.healthCheck,
'options': this.bridgeOptions,
@@ -147,35 +147,7 @@ export default class Bridge extends Extension {
throw new Error(`Invalid payload`);
}
const diff: KeyValue = detailedDiff(settings.get(), message.options);
// Remove any settings that are in the deleted.diff but not in the passed options
const cleanupDeleted = (options: KeyValue, deleted: KeyValue): void => {
for (const key of Object.keys(deleted)) {
if (!(key in options)) {
delete deleted[key];
} else if (!Array.isArray(options[key])) {
cleanupDeleted(options[key], deleted[key]);
}
}
};
cleanupDeleted(message.options, diff.deleted);
const newSettings = objectAssignDeep({}, diff.added, diff.updated, diff.deleted);
// deep-object-diff converts arrays to objects, set original array back here
const convertBackArray = (before: KeyValue, after: KeyValue): void => {
for (const [key, afterValue] of Object.entries(after)) {
const beforeValue = before[key];
if (Array.isArray(beforeValue)) {
after[key] = beforeValue;
} else if (afterValue && typeof beforeValue === 'object') {
convertBackArray(beforeValue, afterValue);
}
}
};
convertBackArray(message.options, newSettings);
const newSettings = utils.computeSettingsToChange(settings.get(), message.options);
const restartRequired = settings.apply(newSettings);
if (restartRequired) this.restartRequired = true;
@@ -248,6 +220,17 @@ export default class Bridge extends Extension {
return utils.getResponse(message, {zip: base64Zip}, null);
}
@bind async installCodeAdd(message: KeyValue | string): Promise<MQTTResponse> {
if (typeof message === 'object' && !message.hasOwnProperty('value')) {
throw new Error('Invalid payload');
}
const value = typeof message === 'object' ? message.value : message;
await this.zigbee.addInstallCode(value);
logger.info('Successfully added new install code');
return utils.getResponse(message, {value}, null);
}
@bind async permitJoin(message: KeyValue | string): Promise<MQTTResponse> {
if (typeof message === 'object' && !message.hasOwnProperty('value')) {
throw new Error('Invalid payload');
@@ -407,15 +390,23 @@ export default class Bridge extends Extension {
const ID = message.id;
const entity = this.getEntity(entityType, ID);
const currentOptions = entityType === 'device' ? settings.get().devices[entity.ID] :
settings.get().groups[entity.ID];
const options = utils.computeSettingsToChange(currentOptions, message.options);
const oldOptions = objectAssignDeep({}, cleanup(entity.options));
settings.changeEntityOptions(ID, message.options);
const restartRequired = settings.changeEntityOptions(ID, options);
if (restartRequired) this.restartRequired = true;
const newOptions = cleanup(entity.options);
await this.publishInfo();
logger.info(`Changed config for ${entityType} ${ID}`);
this.eventBus.emitEntityOptionsChanged({from: oldOptions, to: newOptions, entity});
return utils.getResponse(message, {from: oldOptions, to: newOptions, id: ID}, null);
return utils.getResponse(
message,
{from: oldOptions, to: newOptions, id: ID, restart_required: this.restartRequired},
null,
);
}
@bind async deviceConfigureReporting(message: string | KeyValue): Promise<MQTTResponse> {
@@ -665,6 +656,7 @@ export default class Bridge extends Extension {
network_address: device.zh.networkAddress,
supported: !!device.definition,
friendly_name: device.name,
disabled: !!device.options.disabled,
description: device.options.description,
definition: this.getDefinitionPayload(device),
power_source: device.zh.powerSource,
+6 -4
View File
@@ -64,9 +64,11 @@ export default class Configure extends Extension {
}
override async start(): Promise<void> {
for (const device of this.zigbee.devices(false)) {
await this.configure(device, 'started');
}
setImmediate(async () => {
for (const device of this.zigbee.devices(false)) {
await this.configure(device, 'started');
}
});
this.eventBus.onDeviceJoined(this, (data) => {
if (data.device.zh.meta.hasOwnProperty('configured')) {
@@ -85,7 +87,7 @@ export default class Configure extends Extension {
private async configure(device: Device, event: 'started' | 'zigbee_event' | 'reporting_disabled' | 'mqtt_message',
force=false, thowError=false): Promise<void> {
if (!force) {
if (!device.definition?.configure || !device.zh.interviewCompleted) {
if (device.options.disabled || !device.definition?.configure || !device.zh.interviewCompleted) {
return;
}
+2 -2
View File
@@ -56,7 +56,7 @@ export default class ExternalExtension extends Extension {
@bind private async saveExtension(message: KeyValue): Promise<MQTTResponse> {
const {name, code} = message;
const ModuleConstructor = utils.loadModuleFromText(code) as typeof Extension;
const ModuleConstructor = utils.loadModuleFromText(code, name) as typeof Extension;
await this.loadExtension(ModuleConstructor);
const basePath = this.getExtensionsBasePath();
/* istanbul ignore else */
@@ -95,7 +95,7 @@ export default class ExternalExtension extends Extension {
private loadUserDefinedExtensions(): void {
const extensions = this.getListOfUserDefinedExtensions();
extensions
.map(({code}) => utils.loadModuleFromText(code))
.map(({code, name}) => utils.loadModuleFromText(code, name))
.map(this.loadExtension);
}
+31 -4
View File
@@ -1,4 +1,5 @@
import http from 'http';
import https from 'https';
import gzipStatic, {RequestHandler} from 'connect-gzip-static';
import finalhandler from 'finalhandler';
import logger from '../util/logger';
@@ -6,6 +7,7 @@ import frontend from 'zigbee2mqtt-frontend';
import WebSocket from 'ws';
import net from 'net';
import url from 'url';
import fs from 'fs';
import * as settings from '../util/settings';
import utils from '../util/utils';
import stringify from 'json-stable-stringify-without-jsonify';
@@ -19,6 +21,8 @@ export default class Frontend extends Extension {
private mqttBaseTopic = settings.get().mqtt.base_topic;
private host = settings.get().frontend.host;
private port = settings.get().frontend.port;
private sslCert = settings.get().frontend.ssl_cert;
private sslKey = settings.get().frontend.ssl_key;
private authToken = settings.get().frontend.auth_token;
private retainedMessages = new Map();
private server: http.Server;
@@ -33,8 +37,28 @@ export default class Frontend extends Extension {
this.eventBus.onMQTTMessagePublished(this, this.onMQTTPublishMessage);
}
private isHttpsConfigured():boolean {
if (this.sslCert && this.sslKey) {
if (!fs.existsSync(this.sslCert) || !fs.existsSync(this.sslKey)) {
logger.error(`defined ssl_cert '${this.sslCert}' or ssl_key '${this.sslKey}' file path does not exists, server won't be secured.`); /* eslint-disable-line max-len */
return false;
}
return true;
}
return false;
}
override async start(): Promise<void> {
this.server = http.createServer(this.onRequest);
if (this.isHttpsConfigured()) {
const serverOptions = {
key: fs.readFileSync(this.sslKey),
cert: fs.readFileSync(this.sslCert)};
this.server = https.createServer(serverOptions, this.onRequest);
} else {
this.server = http.createServer(this.onRequest);
}
this.server.on('upgrade', this.onUpgrade);
/* istanbul ignore next */
@@ -56,12 +80,15 @@ export default class Frontend extends Extension {
override async stop(): Promise<void> {
super.stop();
for (const client of this.wss.clients) {
this.wss?.clients.forEach((client) => {
client.send(stringify({topic: 'bridge/state', payload: 'offline'}));
client.terminate();
});
this.wss?.close();
/* istanbul ignore else */
if (this.server) {
return new Promise((cb: () => void) => this.server.close(cb));
}
this.wss.close();
return new Promise((cb: () => void) => this.server.close(cb));
}
@bind private onRequest(request: http.IncomingMessage, response: http.ServerResponse): void {
+9 -2
View File
@@ -142,6 +142,7 @@ export default class Groups extends Extension {
const groupsToPublish: Set<Group> = new Set();
for (const member of entity.zh.members) {
const device = this.zigbee.resolveEntity(member.getDevice()) as Device;
if (device.options.disabled) continue;
const exposes = device.exposes();
const memberPayload: KeyValue = {};
Object.keys(payload).forEach((key) => {
@@ -292,6 +293,7 @@ export default class Groups extends Extension {
groupKey, deviceKey, skipDisableReporting, resolvedEntityEndpoint,
} = parsed;
const message = utils.parseJSON(data.message, data.message);
let changedGroups: Group[] = [];
const responseData: KeyValue = {device: deviceKey};
if (groupKey) {
@@ -320,6 +322,7 @@ export default class Groups extends Extension {
logger.info(`Adding '${resolvedEntityDevice.name}' to '${resolvedEntityGroup.name}'`);
await resolvedEntityEndpoint.addToGroup(resolvedEntityGroup.zh);
settings.addDeviceToGroup(resolvedEntityGroup.ID.toString(), keys);
changedGroups.push(resolvedEntityGroup);
/* istanbul ignore else */
if (settings.get().advanced.legacy_api) {
@@ -333,6 +336,7 @@ export default class Groups extends Extension {
logger.info(`Removing '${resolvedEntityDevice.name}' from '${resolvedEntityGroup.name}'`);
await resolvedEntityEndpoint.removeFromGroup(resolvedEntityGroup.zh);
settings.removeDeviceFromGroup(resolvedEntityGroup.ID.toString(), keys);
changedGroups.push(resolvedEntityGroup);
/* istanbul ignore else */
if (settings.get().advanced.legacy_api) {
@@ -344,6 +348,7 @@ export default class Groups extends Extension {
}
} else { // remove_all
logger.info(`Removing '${resolvedEntityDevice.name}' from all groups`);
changedGroups = this.zigbee.groups().filter((g) => g.zh.members.includes(resolvedEntityEndpoint));
await resolvedEntityEndpoint.removeFromAllGroups();
for (const settingsGroup of settings.getGroups()) {
settings.removeDeviceFromGroup(settingsGroup.ID.toString(), keys);
@@ -372,8 +377,10 @@ export default class Groups extends Extension {
if (error) {
logger.error(error);
} else {
this.eventBus.emitGroupMembersChanged({
group: resolvedEntityGroup, action: type, endpoint: resolvedEntityEndpoint, skipDisableReporting});
for (const group of changedGroups) {
this.eventBus.emitGroupMembersChanged({
group, action: type, endpoint: resolvedEntityEndpoint, skipDisableReporting});
}
}
}
}
+163 -84
View File
@@ -111,7 +111,7 @@ export default class HomeAssistant extends Extension {
}
private exposeToConfig(exposes: zhc.DefinitionExpose[], entityType: 'device' | 'group',
definition?: zhc.Definition, definitionExposes?: zhc.DefinitionExpose[]): DiscoveryEntry[] {
allExposes: zhc.DefinitionExpose[], 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');
@@ -171,10 +171,11 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.min_mireds = min;
}
const effect = definitionExposes?.find((e) => e.type === 'enum' && e.name === 'effect');
if (effect) {
const effects = utils.arrayUnique(utils.flatten(
allExposes.filter((e) => e.type === 'enum' && e.name === 'effect').map((e) => e.values)));
if (effects.length) {
discoveryEntry.discovery_payload.effect = true;
discoveryEntry.discovery_payload.effect_list = effect.values;
discoveryEntry.discovery_payload.effect_list = effects;
}
discoveryEntries.push(discoveryEntry);
@@ -282,6 +283,15 @@ export default class HomeAssistant extends Extension {
discoveryEntry.discovery_payload.fan_mode_state_topic = true;
}
const swingMode = firstExpose.features.find((f) => f.name === 'swing_mode');
if (swingMode) {
discoveryEntry.discovery_payload.swing_modes = swingMode.values;
discoveryEntry.discovery_payload.swing_mode_command_topic = true;
discoveryEntry.discovery_payload.swing_mode_state_template =
`{{ value_json.${swingMode.property} }}`;
discoveryEntry.discovery_payload.swing_mode_state_topic = true;
}
const preset = firstExpose.features.find((f) => f.name === 'preset');
if (preset) {
discoveryEntry.discovery_payload.preset_modes = preset.values;
@@ -311,6 +321,9 @@ export default class HomeAssistant extends Extension {
if (tempCalibration.value_min != null) discoveryEntry.discovery_payload.min = tempCalibration.value_min;
if (tempCalibration.value_max != null) discoveryEntry.discovery_payload.max = tempCalibration.value_max;
if (tempCalibration.value_step != null) {
discoveryEntry.discovery_payload.step = tempCalibration.value_step;
}
discoveryEntries.push(discoveryEntry);
}
@@ -371,81 +384,83 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'cover') {
const position = exposes.find((expose) => expose.features.find((e) => e.name === 'position'));
const tilt = exposes.find((expose) => expose.features.find((e) => e.name === 'tilt'));
const motorState = definitionExposes?.find((e) => e.type === 'enum' && e.name === 'motor_state' &&
e.access === ACCESS_STATE);
const state = exposes.find((expose) => expose.features.find((e) => e.name === 'state'))
?.features.find((f) => f.name === 'state');
const position = exposes.find((expose) => expose.features.find((e) => e.name === 'position'))
?.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 running = allExposes?.find((e) => e.type === 'binary' && e.name === 'running');
const discoveryEntry: DiscoveryEntry = {
type: 'cover',
mockProperties: [],
mockProperties: [{property: state.property, value: null}],
object_id: endpoint ? `cover_${endpoint}` : 'cover',
discovery_payload: {
command_topic_prefix: endpoint,
command_topic: true,
state_topic: true,
state_topic_postfix: endpoint,
},
};
// For covers only supporting tilt don't discover the command/state_topic, otherwise
// HA does not correctly reflect the state
// - https://github.com/home-assistant/core/issues/51793
// - https://github.com/Koenkk/zigbee-herdsman-converters/pull/2663
if (!tilt || (tilt && position)) {
discoveryEntry.discovery_payload.command_topic = true;
discoveryEntry.discovery_payload.state_topic = !position;
discoveryEntry.discovery_payload.command_topic_prefix = endpoint;
// If curtains have `running` property, use this in discovery.
// The movement direction is calculated (assumed) in this case.
if (running) {
discoveryEntry.discovery_payload.value_template = `{% if "${running.property}" in value_json ` +
`and value_json.${running.property} %} {% if value_json.${position.property} > 0 %} closing ` +
`{% else %} opening {% endif %} {% else %} stopped {% endif %}`;
}
// For curtains that have `motor_state` lookup a possible state names and make this
// available for discovery. If the curtains only support the `running` value,
// then we use it anyway. The movement direction is calculated (assumed) in this case.
if (motorState) {
const openingLookup = ['opening', 'open', 'forward', 'up', 'rising'];
const closingLookup = ['closing', 'close', 'backward', 'back', 'reverse', 'down', 'declining'];
const stoppedLookup = ['stopped', 'stop', 'pause', 'paused'];
// If curtains have `motor_state` or `moving` property, lookup for possible
// state names to detect movement direction and use this in discovery.
if (motorState) {
const openingLookup = ['opening', 'open', 'forward', 'up', 'rising'];
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.toLowerCase()));
const closingState = motorState.values.find((s) => closingLookup.includes(s.toLowerCase()));
const stoppedState = motorState.values.find((s) => stoppedLookup.includes(s.toLowerCase()));
if (openingState && closingState && stoppedState) {
discoveryEntry.discovery_payload.state_topic = true;
discoveryEntry.discovery_payload.state_opening = openingState;
discoveryEntry.discovery_payload.state_closing = closingState;
discoveryEntry.discovery_payload.state_stopped = stoppedState;
discoveryEntry.discovery_payload.value_template = `{% if not value_json.motor_state %} ` +
`${stoppedState} {% else %} {{ value_json.motor_state }} {% endif %}`;
}
} else {
const running = definitionExposes?.find((e) => e.type === 'binary' && e.name === 'running');
if (running) {
discoveryEntry.discovery_payload.state_topic = true;
discoveryEntry.discovery_payload.value_template = `{% if not value_json.running %} ` +
`stopped {% else %} {% if value_json.position > 0 %} closing {% else %} ` +
`opening {% endif %} {% endif %}`;
}
if (openingState && closingState && stoppedState) {
discoveryEntry.discovery_payload.state_opening = openingState;
discoveryEntry.discovery_payload.state_closing = closingState;
discoveryEntry.discovery_payload.state_stopped = stoppedState;
discoveryEntry.discovery_payload.value_template = `{% if "${motorState.property}" in value_json ` +
`and value_json.${motorState.property} %} {{ value_json.${motorState.property} }} {% else %} ` +
`${stoppedState} {% endif %}`;
}
}
// If curtains do not have `running`, `motor_state` or `moving` properties.
if (!discoveryEntry.discovery_payload.value_template) {
discoveryEntry.discovery_payload.value_template =
`{{ value_json.${featurePropertyWithoutEndpoint(state)} }}`,
discoveryEntry.discovery_payload.state_open = 'OPEN';
discoveryEntry.discovery_payload.state_closed = 'CLOSE';
}
if (!position && !tilt) {
discoveryEntry.discovery_payload.optimistic = true;
}
if (position) {
const p = position.features.find((f) => f.name === 'position');
discoveryEntry.discovery_payload = {...discoveryEntry.discovery_payload,
position_template: `{{ value_json.${getProperty(p)} }}`,
set_position_template: `{ "${getProperty(p)}": {{ position }} }`,
position_template: `{{ value_json.${featurePropertyWithoutEndpoint(position)} }}`,
set_position_template: `{ "${getProperty(position)}": {{ position }} }`,
set_position_topic: true,
position_topic: true,
};
}
if (tilt) {
const t = tilt.features.find((f) => f.name === 'tilt');
discoveryEntry.discovery_payload = {...discoveryEntry.discovery_payload,
tilt_command_topic: true,
tilt_status_topic: true,
tilt_status_template: `{{ value_json.${getProperty(t)} }}`,
tilt_status_template: `{{ value_json.${featurePropertyWithoutEndpoint(tilt)} }}`,
};
}
@@ -529,10 +544,13 @@ export default class HomeAssistant extends Extension {
garage_door_contact: {device_class: 'garage_door', payload_on: false, payload_off: true},
eco_mode: {entity_category: 'config', icon: 'mdi:leaf'},
expose_pin: {entity_category: 'config', icon: 'mdi:pin'},
flip_indicator_light: {entity_category: 'config', icon: 'mdi:arrow-left-right'},
gas: {device_class: 'gas'},
indicator_mode: {entity_category: 'config', icon: 'mdi:led-on'},
invert_cover: {entity_category: 'config', icon: 'mdi:arrow-left-right'},
led_disabled_night: {entity_category: 'config', icon: 'mdi:led-off'},
led_indication: {entity_category: 'config', icon: 'mdi:led-on'},
led_enable: {entity_category: 'config', icon: 'mdi:led-on'},
legacy: {entity_category: 'config', icon: 'mdi:cog'},
motor_reversal: {entity_category: 'config', icon: 'mdi:arrow-left-right'},
moving: {device_class: 'moving'},
@@ -545,8 +563,10 @@ export default class HomeAssistant extends Extension {
tamper: {device_class: 'tamper'},
temperature_scale: {entity_category: 'config', icon: 'mdi:temperature-celsius'},
test: {entity_category: 'diagnostic', icon: 'mdi:test-tube'},
valve_state: {device_class: 'opening'},
vibration: {device_class: 'vibration'},
water_leak: {device_class: 'moisture'},
window: {device_class: 'window'},
};
/**
@@ -606,6 +626,8 @@ export default class HomeAssistant extends Extension {
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'},
boost_heating_countdown: {device_class: 'duration'},
boost_heating_countdown_time_set: {entity_category: 'config', icon: 'mdi:timer'},
boost_time: {entity_category: 'config', icon: 'mdi:timer'},
calibration: {entity_category: 'config', icon: 'mdi:wrench-clock'},
calibration_time: {entity_category: 'config', icon: 'mdi:wrench-clock'},
@@ -658,9 +680,10 @@ export default class HomeAssistant extends Extension {
state_class: 'measurement',
},
local_temperature: {device_class: 'temperature', state_class: 'measurement'},
max_temperature: {entity_category: 'config', icon: 'mdi:thermometer'},
max_temperature_limit: {entity_category: 'config', icon: 'mdi:thermometer'},
min_temperature: {entity_category: 'config', icon: 'mdi:thermometer'},
max_temperature: {entity_category: 'config', icon: 'mdi:thermometer-high'},
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'},
measurement_poll_interval: {entity_category: 'config', icon: 'mdi:clock-out'},
occupancy_timeout: {entity_category: 'config', icon: 'mdi:timer'},
pm10: {device_class: 'pm10', state_class: 'measurement'},
@@ -733,6 +756,14 @@ export default class HomeAssistant extends Extension {
...extraAttrs,
},
};
// When a device_class is set, unit_of_measurement must be set, otherwise warnings are generated.
// https://github.com/Koenkk/zigbee2mqtt/issues/15958#issuecomment-1377483202
if (discoveryEntry.discovery_payload.device_class &&
!discoveryEntry.discovery_payload.unit_of_measurement) {
delete discoveryEntry.discovery_payload.device_class;
}
discoveryEntries.push(discoveryEntry);
/**
@@ -751,6 +782,7 @@ export default class HomeAssistant extends Extension {
command_topic_prefix: endpoint,
command_topic_postfix: firstExpose.property,
...(firstExpose.unit && {unit_of_measurement: firstExpose.unit}),
...(firstExpose.value_step && {step: firstExpose.value_step}),
...lookup[firstExpose.name],
},
};
@@ -797,49 +829,54 @@ export default class HomeAssistant extends Extension {
sound_volume: {entity_category: 'config', icon: 'mdi:volume-high'},
status: {icon: 'mdi:state-machine'},
switch_type: {entity_category: 'config', icon: 'mdi:tune'},
temperature_sensor_select: {entity_category: 'config', icon: 'mdi:home-thermometer'},
thermostat_unit: {entity_category: 'config', icon: 'mdi:thermometer'},
volume: {entity_category: 'config', icon: 'mdi: volume-high'},
week: {entity_category: 'config', icon: 'mdi:calendar-clock'},
};
const valueTemplate = firstExpose.access & ACCESS_STATE ?
`{{ value_json.${firstExpose.property} }}` : undefined;
if (firstExpose.access & ACCESS_STATE) {
discoveryEntries.push({
type: 'sensor',
object_id: firstExpose.property,
mockProperties: [{property: firstExpose.property, value: null}],
discovery_payload: {
value_template: `{{ value_json.${firstExpose.property} }}`,
value_template: valueTemplate,
enabled_by_default: !(firstExpose.access & ACCESS_SET),
...lookup[firstExpose.name],
},
});
/**
* If enum attribute has SET access then expose as SELECT entity too.
* Note: currently both sensor and select are discovered, this is to avoid
* breaking changes for sensors already existing in HA (legacy).
*/
if ((firstExpose.access & ACCESS_SET)) {
discoveryEntries.push({
type: 'select',
object_id: firstExpose.property,
mockProperties: [{property: firstExpose.property, value: null}],
discovery_payload: {
value_template: `{{ value_json.${firstExpose.property} }}`,
state_topic: true,
command_topic_prefix: endpoint,
command_topic: true,
command_topic_postfix: firstExpose.property,
options: firstExpose.values.map((v) => v.toString()),
...lookup[firstExpose.name],
},
});
}
}
} else if (firstExpose.type === 'text' || firstExpose.type === 'composite') {
/**
* If enum attribute has SET access then expose as SELECT entity too.
* Note: currently both sensor and select are discovered, this is to avoid
* breaking changes for sensors already existing in HA (legacy).
*/
if ((firstExpose.access & ACCESS_SET)) {
discoveryEntries.push({
type: 'select',
object_id: firstExpose.property,
mockProperties: [], // Already mocked above in case access STATE is supported
discovery_payload: {
value_template: valueTemplate,
state_topic: !!(firstExpose.access & ACCESS_STATE),
command_topic_prefix: endpoint,
command_topic: true,
command_topic_postfix: firstExpose.property,
options: firstExpose.values.map((v) => v.toString()),
...lookup[firstExpose.name],
},
});
}
} else if (firstExpose.type === 'text' || firstExpose.type === 'composite' || firstExpose.type === 'list') {
if (firstExpose.access & ACCESS_STATE) {
const lookup: {[s: string]: KeyValue} = {
action: {icon: 'mdi:gesture-double-tap'},
programming_mode: {icon: 'mdi:calendar-clock'},
};
const discoveryEntry: DiscoveryEntry = {
@@ -885,7 +922,11 @@ export default class HomeAssistant extends Extension {
const entity = this.zigbee.resolveEntity(data.entity.name);
if (entity.isDevice() && this.discovered[entity.ieeeAddr]) {
for (const objectID of this.discovered[entity.ieeeAddr].objectIDs) {
const match = /light_(.*)/.exec(objectID);
const lightMatch = /light_(.*)/.exec(objectID);
const coverMatch = /cover_(.*)/.exec(objectID);
const match = lightMatch || coverMatch;
if (match) {
const endpoint = match[1];
const endpointRegExp = new RegExp(`(.*)_${endpoint}`);
@@ -968,7 +1009,7 @@ export default class HomeAssistant extends Extension {
if (isDevice) {
const exposes = entity.exposes(); // avoid calling it hundred of times/s
for (const expose of exposes) {
configs.push(...this.exposeToConfig([expose], 'device', entity.definition, exposes));
configs.push(...this.exposeToConfig([expose], 'device', exposes, entity.definition));
}
for (const mapping of legacyMapping) {
@@ -985,10 +1026,13 @@ export default class HomeAssistant extends Extension {
}
} else { // group
const exposesByType: {[s: string]: zhc.DefinitionExpose[]} = {};
const allExposes: zhc.DefinitionExpose[] = [];
entity.zh.members.map((e) => this.zigbee.resolveEntity(e.getDevice()) as Device)
.filter((d) => d.definition).forEach((device) => {
for (const expose of device.exposes().filter((e) => groupSupportedTypes.includes(e.type))) {
const exposes = device.exposes();
allExposes.push(...exposes);
for (const expose of exposes.filter((e) => groupSupportedTypes.includes(e.type))) {
let key = expose.type;
if (['switch', 'lock', 'cover'].includes(expose.type) && expose.endpoint) {
// A device can have multiple of these types which have to discovered seperately.
@@ -1003,7 +1047,7 @@ export default class HomeAssistant extends Extension {
});
configs = [].concat(...Object.values(exposesByType)
.map((exposes) => this.exposeToConfig(exposes, 'group')));
.map((exposes) => this.exposeToConfig(exposes, 'group', allExposes)));
}
if (isDevice && settings.get().advanced.last_seen !== 'disable') {
@@ -1031,7 +1075,7 @@ export default class HomeAssistant extends Extension {
const updateStateSensor: DiscoveryEntry = {
type: 'sensor',
object_id: 'update_state',
mockProperties: [{property: 'update', value: {state: null}}],
mockProperties: [], // update is mocked below with updateSensor
discovery_payload: {
icon: 'mdi:update',
value_template: `{{ value_json['update']['state'] }}`,
@@ -1049,12 +1093,28 @@ export default class HomeAssistant extends Extension {
payload_on: true,
payload_off: false,
value_template: `{{ value_json['update']['state'] == "available" }}`,
enabled_by_default: true,
enabled_by_default: false,
device_class: 'update',
entity_category: 'diagnostic',
},
};
configs.push(updateAvailableSensor);
const updateSensor: DiscoveryEntry = {
type: 'update',
object_id: 'update',
mockProperties: [{property: 'update', value: {state: null}}],
discovery_payload: {
entity_picture: 'https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png',
latest_version_topic: true,
state_topic: true,
device_class: 'firmware',
command_topic: `${settings.get().mqtt.base_topic}/bridge/request/device/ota_update/update`,
payload_install: `{"id": "${entity.ieeeAddr}"}`,
value_template: `{{ value_json['update']['installed_version'] }}`,
latest_version_template: `{{ value_json['update']['latest_version'] }}`,
},
};
configs.push(updateSensor);
}
if (isDevice && entity.options.hasOwnProperty('legacy') && !entity.options.legacy) {
@@ -1156,7 +1216,10 @@ export default class HomeAssistant extends Extension {
payload.availability.push({topic: `${baseTopic}/availability`});
}
if (!settings.get().advanced.legacy_availability_payload) {
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 }}');
}
@@ -1166,7 +1229,7 @@ export default class HomeAssistant extends Extension {
delete payload.command_topic_postfix;
const commandTopic = `${baseTopic}/${commandTopicPrefix}set${commandTopicPostfix}`;
if (payload.command_topic) {
if (payload.command_topic && typeof payload.command_topic !== 'string') {
payload.command_topic = commandTopic;
}
@@ -1221,10 +1284,22 @@ export default class HomeAssistant extends Extension {
payload.fan_mode_state_topic = stateTopic;
}
if (payload.latest_version_topic) {
payload.latest_version_topic = stateTopic;
}
if (payload.fan_mode_command_topic) {
payload.fan_mode_command_topic = `${baseTopic}/${commandTopicPrefix}set/fan_mode`;
}
if (payload.swing_mode_state_topic) {
payload.swing_mode_state_topic = stateTopic;
}
if (payload.swing_mode_command_topic) {
payload.swing_mode_command_topic = `${baseTopic}/${commandTopicPrefix}set/swing_mode`;
}
if (payload.percentage_state_topic) {
payload.percentage_state_topic = stateTopic;
}
@@ -1404,6 +1479,10 @@ export default class HomeAssistant extends Extension {
message.color.s = message.color.saturation;
}
}
if (entity.isDevice() && entity.definition?.ota && message.update?.latest_version == null) {
message.update = {...message.update, installed_version: -1, latest_version: -1};
}
}
private getEncodedBaseTopic(): string {
+1 -1
View File
@@ -214,7 +214,7 @@ export default class NetworkMap extends Extension {
async networkScan(includeRoutes: boolean): Promise<Topology> {
logger.info(`Starting network scan (includeRoutes '${includeRoutes}')`);
const devices = this.zigbee.devices().filter((d) => d.zh.type !== 'GreenPower');
const devices = this.zigbee.devices().filter((d) => d.zh.type !== 'GreenPower' && !d.options.disabled);
const lqis: Map<Device, zh.LQI> = new Map();
const routingTables: Map<Device, zh.RoutingTable> = new Map();
const failed: Map<Device, string[]> = new Map();
+36 -25
View File
@@ -24,8 +24,13 @@ function isValidUrl(url: string): boolean {
type UpdateState = 'updating' | 'idle' | 'available';
interface UpdatePayload {
update_available?: boolean
// eslint-disable-next-line camelcase
update: {progress?: number, remaining?: number, state: UpdateState}, update_available?: boolean}
update: {
progress?: number, remaining?: number, state: UpdateState,
installed_version: number | null, latest_version: number | null
}
}
const legacyTopicRegex = new RegExp(`^${settings.get().mqtt.base_topic}/bridge/ota_update/.+$`);
const topicRegex =
@@ -86,18 +91,18 @@ export default class OTAUpdate extends Extension {
if (!check) return;
this.lastChecked[data.device.ieeeAddr] = Date.now();
let available = false;
let availableResult: zhc.OtaUpdateAvailableResult = null;
try {
available = await data.device.definition.ota.isUpdateAvailable(data.device.zh, logger, data.data);
availableResult = await data.device.definition.ota.isUpdateAvailable(data.device.zh, logger, data.data);
} catch (e) {
supportsOTA = false;
logger.debug(`Failed to check if update available for '${data.device.name}' (${e.message})`);
}
const payload = this.getEntityPublishPayload(available ? 'available' : 'idle');
const payload = this.getEntityPublishPayload(data.device, availableResult ?? 'idle');
this.publishEntityState(data.device, payload);
if (available) {
if (availableResult?.available) {
const message = `Update available for '${data.device.name}'`;
logger.info(message);
@@ -112,14 +117,10 @@ export default class OTAUpdate extends Extension {
}
}
// Respond to the OTA request:
// - In case we don't support OTA: respond with NO_IMAGE_AVAILABLE (0x98) (so the client stops requesting OTAs)
// - In case we do support OTA: respond with ABORT (0x95) as we don't want to update now.
const endpoint = data.device.zh.endpoints.find((e) => e.supportsOutputCluster('genOta'));
if (endpoint) {
// Some devices send OTA requests without defining OTA cluster as input cluster.
await endpoint.commandResponse('genOta', 'queryNextImageResponse', {status: supportsOTA ? 0x95 : 0x98});
}
// Respond to the OTA request: respond with NO_IMAGE_AVAILABLE (0x98) (so the client stops requesting OTAs)
const endpoint = data.device.zh.endpoints.find((e) => e.supportsOutputCluster('genOta')) || data.endpoint;
await endpoint.commandResponse('genOta', 'queryNextImageResponse', {status: 0x98});
logger.debug(`Responded to OTA request of '${data.device.name}' with 'NO_IMAGE_AVAILABLE'`);
}
private async readSoftwareBuildIDAndDateCode(device: Device, sendWhen: 'active' | 'immediate'):
@@ -133,14 +134,22 @@ export default class OTAUpdate extends Extension {
}
}
private getEntityPublishPayload(state: UpdateState, progress: number=null, remaining: number=null): UpdatePayload {
const payload: UpdatePayload = {update: {state}};
private getEntityPublishPayload(device: Device, state: zhc.OtaUpdateAvailableResult | UpdateState,
progress: number=null, remaining: number=null): UpdatePayload {
const deviceUpdateState = this.state.get(device).update;
const payload: UpdatePayload = {update: {
state: typeof state === 'string' ? state : (state.available ? 'available' : 'idle'),
installed_version: typeof state === 'string' ?
deviceUpdateState?.installed_version : state.currentFileVersion,
latest_version: typeof state === 'string' ?
deviceUpdateState?.latest_version : state.otaFileVersion,
}};
if (progress !== null) payload.update.progress = progress;
if (remaining !== null) payload.update.remaining = Math.round(remaining);
/* istanbul ignore else */
if (this.legacyApi) {
payload.update_available = state === 'available';
payload.update_available = typeof state === 'string' ? state === 'available' : state.available;
}
return payload;
@@ -191,23 +200,24 @@ export default class OTAUpdate extends Extension {
}
try {
const available = await device.definition.ota.isUpdateAvailable(device.zh, logger);
const msg = `${available ? 'Update' : 'No update'} available for '${device.name}'`;
const availableResult = await device.definition.ota.isUpdateAvailable(device.zh, logger);
const msg = `${availableResult.available ? 'Update' : 'No update'} available for '${device.name}'`;
logger.info(msg);
/* istanbul ignore else */
if (settings.get().advanced.legacy_api) {
const meta = {status: available ? 'available' : 'not_available', device: device.name};
const meta = {
status: availableResult.available ? 'available' : 'not_available', device: device.name};
this.mqtt.publish(
'bridge/log',
stringify({type: `ota_update`, message: msg, meta}),
);
}
const payload = this.getEntityPublishPayload(available ? 'available' : 'idle');
const payload = this.getEntityPublishPayload(device, availableResult);
this.publishEntityState(device, payload);
this.lastChecked[device.ieeeAddr] = Date.now();
responseData.updateAvailable = available;
responseData.updateAvailable = availableResult.available;
} catch (e) {
error = `Failed to check if update available for '${device.name}' (${e.message})`;
errorStack = e.stack;
@@ -243,7 +253,7 @@ export default class OTAUpdate extends Extension {
logger.info(msg);
const payload = this.getEntityPublishPayload('updating', progress, remaining);
const payload = this.getEntityPublishPayload(device, 'updating', progress, remaining);
this.publishEntityState(device, payload);
/* istanbul ignore else */
@@ -254,11 +264,12 @@ export default class OTAUpdate extends Extension {
};
const from_ = await this.readSoftwareBuildIDAndDateCode(device, 'immediate');
await device.definition.ota.updateToLatest(device.zh, logger, onProgress);
const fileVersion = await device.definition.ota.updateToLatest(device.zh, logger, onProgress);
logger.info(`Finished update of '${device.name}'`);
this.eventBus.emitReconfigure({device});
this.removeProgressAndRemainingFromState(device);
const payload = this.getEntityPublishPayload('idle');
const payload = this.getEntityPublishPayload(device,
{available: false, currentFileVersion: fileVersion, otaFileVersion: fileVersion});
this.publishEntityState(device, payload);
const to = await this.readSoftwareBuildIDAndDateCode(device, 'active');
const [fromS, toS] = [stringify(from_), stringify(to)];
@@ -278,7 +289,7 @@ export default class OTAUpdate extends Extension {
errorStack = e.stack;
this.removeProgressAndRemainingFromState(device);
const payload = this.getEntityPublishPayload('available');
const payload = this.getEntityPublishPayload(device, 'available');
this.publishEntityState(device, payload);
/* istanbul ignore else */
+2 -1
View File
@@ -1,6 +1,7 @@
import * as settings from '../util/settings';
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
import philips from 'zigbee-herdsman-converters/lib/philips';
import logger from '../util/logger';
import utils from '../util/utils';
import Extension from './extension';
@@ -18,7 +19,7 @@ const sceneConverterKeys = ['scene_store', 'scene_add', 'scene_remove', 'scene_r
const defaultGroupConverters = [
zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness,
zigbeeHerdsmanConverters.toZigbeeConverters.light_color_colortemp,
zigbeeHerdsmanConverters.toZigbeeConverters.effect,
philips.tz.effect, // Support Hue effects for groups
zigbeeHerdsmanConverters.toZigbeeConverters.ignore_transition,
zigbeeHerdsmanConverters.toZigbeeConverters.cover_position_tilt,
zigbeeHerdsmanConverters.toZigbeeConverters.thermostat_occupied_heating_setpoint,
+6 -4
View File
@@ -83,7 +83,10 @@ export default class MQTT {
resolve();
});
this.client.on('error', (err) => reject(err));
this.client.on('error', (err) => {
logger.error(`MQTT error: ${err.message}`);
reject(err);
});
this.client.on('message', this.onMessage);
});
}
@@ -98,10 +101,9 @@ export default class MQTT {
}, utils.seconds(10));
logger.info('Connected to MQTT server');
await this.publishStateOnline();
if (this.initialConnect) {
await this.publishStateOnline();
} else {
if (!this.initialConnect) {
this.republishRetainedTimer = setTimeout(() => {
// Republish retained messages in case MQTT broker does not persist them.
// https://github.com/Koenkk/zigbee2mqtt/issues/9629
+7 -4
View File
@@ -17,10 +17,10 @@ class State {
private state: {[s: string | number]: KeyValue} = {};
private file = data.joinPath('state.json');
private timer: NodeJS.Timer = null;
private eventBus: EventBus;
constructor(eventBus: EventBus) {
constructor(private readonly eventBus: EventBus, private readonly zigbee: Zigbee) {
this.eventBus = eventBus;
this.zigbee = zigbee;
}
start(): void {
@@ -28,11 +28,14 @@ class State {
// Save the state on every interval
this.timer = setInterval(() => this.save(), saveInterval);
this.eventBus.onDeviceLeave(this, (data) => delete this.state[data.ieeeAddr]);
}
stop(): void {
this.eventBus.removeListeners(this);
// Remove any invalid states (ie when the device has left the network) when the system is stopped
Object.keys(this.state)
.filter((k) => typeof k === 'string' && !this.zigbee.resolveEntity(k)) // string key = ieeeAddr
.forEach((k) => delete this.state[k]);
clearTimeout(this.timer);
this.save();
}
+9 -3
View File
@@ -100,10 +100,12 @@ declare global {
interface DefinitionExpose {
type: string, name?: string, features?: DefinitionExposeFeature[],
endpoint?: string, values?: string[], value_off?: string, value_on?: string,
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[],
@@ -120,9 +122,10 @@ declare global {
onEvent?: (type: string, data: KeyValue, device: zh.Device,
settings: KeyValue, state: KeyValue) => Promise<void>;
ota?: {
isUpdateAvailable: (device: zh.Device, logger: Logger, data?: KeyValue) => Promise<boolean>;
isUpdateAvailable: (device: zh.Device, logger: Logger, data?: KeyValue)
=> Promise<OtaUpdateAvailableResult>;
updateToLatest: (device: zh.Device, logger: Logger,
onProgress: (progress: number, remaining: number) => void) => Promise<void>;
onProgress: (progress: number, remaining: number) => void) => Promise<number>;
}
}
@@ -233,6 +236,8 @@ declare global {
host?: string,
port?: number,
url?: string,
ssl_cert?: string,
ssl_key?: string,
},
devices?: {[s: string]: DeviceOptions},
groups?: {[s: string]: GroupOptions},
@@ -274,6 +279,7 @@ declare global {
interface DeviceOptions {
ID?: string,
disabled?: boolean,
retention?: number,
availability?: boolean | {timeout: number},
optimistic?: boolean,
+4
View File
@@ -16,3 +16,7 @@ declare module 'zigbee-herdsman-converters/lib/ota/zigbeeOTA' {
export function useIndexOverride(indexFileName: string): void;
export function setDataDir(dataDir: string): void;
}
declare module 'zigbee-herdsman-converters/lib/philips' {
export const tz: {[s: string]: zhc.ToZigbeeConverter};
}
+1 -1
View File
@@ -14,7 +14,7 @@ function load(): void {
load();
function joinPath(file: string): string {
return path.join(dataPath, file);
return path.resolve(dataPath, file);
}
function getPath(): string {
+21 -3
View File
@@ -388,6 +388,18 @@
"title": "URL",
"description": "URL on which the frontend can be reached, currently only used for the Home Assistant device configuration page",
"requiresRestart": true
},
"ssl_cert" : {
"type": ["string", "null"],
"title": "Certificate file path",
"description": "SSL Certificate file path for exposing HTTPS. The sibling property 'ssl_key' must be set for HTTPS to be activated.",
"requiresRestart": true
},
"ssl_key" : {
"type": ["string", "null"],
"title": "key file path",
"description": "SSL key file path for exposing HTTPS. The sibling property 'ssl_cert' must be set for HTTPS to be activated.",
"requiresRestart": true
}
}
}
@@ -499,13 +511,13 @@
"type": "number",
"title": "Port",
"description": "The port on the host that syslog is running on, defaults to syslogd's default port.",
"default": 123
"default": 514
},
"protocol": {
"type": "string",
"title": "Protocol",
"description": "The network protocol to log over (e.g. tcp4, udp4, tls4, unix, unix-connect, etc).",
"default": "tcp4",
"default": "udp4",
"examples": [
"udp4",
"tls4",
@@ -782,6 +794,12 @@
"title": "Retain",
"description": "Retain MQTT messages of this device"
},
"disabled": {
"type": "boolean",
"title": "Disabled",
"description": "Disables the device (excludes device from network scans, availability and group state updates)",
"requiresRestart": true
},
"retention": {
"type": "number",
"title": "Retention",
@@ -842,7 +860,7 @@
"icon": {
"type": "string",
"title": "Icon",
"description": "The user-defined device icon for the frontend. It can be a link to an image (not a path to a file) or base64 encoded data URL like: image/svg+xml;base64,PHN2ZyB3aW....R0aD"
"description": "The user-defined device icon for the frontend. It can be a full URL link to an image (e.g. https://SOME.SITE/MODEL123.jpg) (you cannot use a path to a local file) or base64 encoded data URL (e.g. image/svg+xml;base64,PHN2ZyB3aW....R0aD)"
},
"homeassistant": {
"type": ["object", "null"],
+35 -15
View File
@@ -3,7 +3,7 @@ import utils from './utils';
import objectAssignDeep from 'object-assign-deep';
import path from 'path';
import yaml from './yaml';
import Ajv from 'ajv';
import Ajv, {ValidateFunction} from 'ajv';
import schemaJson from './settings.schema.json';
export let schema = schemaJson;
// @ts-ignore
@@ -31,7 +31,10 @@ const file = process.env.ZIGBEE2MQTT_CONFIG ?? data.joinPath('configuration.yaml
const ajvSetting = new Ajv({allErrors: true}).addKeyword('requiresRestart').compile(schemaJson);
const ajvRestartRequired = new Ajv({allErrors: true})
.addKeyword({keyword: 'requiresRestart', validate: (s: unknown) => !s}).compile(schemaJson);
const ajvRestartRequiredDeviceOptions = new Ajv({allErrors: true})
.addKeyword({keyword: 'requiresRestart', validate: (s: unknown) => !s}).compile(schemaJson.definitions.device);
const ajvRestartRequiredGroupOptions = new Ajv({allErrors: true})
.addKeyword({keyword: 'requiresRestart', validate: (s: unknown) => !s}).compile(schemaJson.definitions.group);
const defaults: RecursivePartial<Settings> = {
permit_join: false,
external_converters: [],
@@ -187,6 +190,20 @@ function loadSettingsWithDefaults(): void {
_settingsWithDefaults.whitelist && _settingsWithDefaults.passlist.push(..._settingsWithDefaults.whitelist);
}
function parseValueRef(text: string): {filename: string, key: string} | null {
const match = /!(.*) (.*)/g.exec(text);
if (match) {
let filename = match[1];
// This is mainly for backward compatibility.
if (!filename.endsWith('.yaml') && !filename.endsWith('.yml')) {
filename += '.yaml';
}
return {filename, key: match[2]};
} else {
return null;
}
}
function write(): void {
const settings = getInternalSettings();
const toWrite: KeyValue = objectAssignDeep({}, settings);
@@ -203,9 +220,9 @@ function write(): void {
['frontend', 'auth_token'],
]) {
if (actual[path[0]] && actual[path[0]][path[1]]) {
const match = /!(.*) (.*)/g.exec(actual[path[0]][path[1]]);
if (match) {
yaml.updateIfChanged(data.joinPath(`${match[1]}.yaml`), match[2], toWrite[path[0]][path[1]]);
const ref = parseValueRef(actual[path[0]][path[1]]);
if (ref) {
yaml.updateIfChanged(data.joinPath(ref.filename), ref.key, toWrite[path[0]][path[1]]);
toWrite[path[0]][path[1]] = actual[path[0]][path[1]];
}
}
@@ -213,7 +230,7 @@ function write(): void {
// Write devices/groups to separate file if required.
const writeDevicesOrGroups = (type: 'devices' | 'groups'): void => {
if (typeof actual[type] === 'string' || Array.isArray(actual[type])) {
if (typeof actual[type] === 'string' || (Array.isArray(actual[type]) && actual[type].length > 0)) {
const fileToWrite = Array.isArray(actual[type]) ? actual[type][0] : actual[type];
const content = objectAssignDeep({}, settings[type]);
@@ -309,16 +326,14 @@ export function validate(): string[] {
function read(): Settings {
const s = yaml.read(file) as Settings;
applyEnvironmentVariables(s);
// Read !secret MQTT username and password if set
// eslint-disable-next-line
const interpetValue = (value: any): any => {
const re = /!(.*) (.*)/g;
const match = re.exec(value);
if (match) {
const file = data.joinPath(`${match[1]}.yaml`);
const key = match[2];
return yaml.read(file)[key];
const ref = parseValueRef(value);
if (ref) {
return yaml.read(data.joinPath(ref.filename))[ref.key];
} else {
return value;
}
@@ -346,7 +361,7 @@ function read(): Settings {
// Read devices/groups configuration from separate file if specified.
const readDevicesOrGroups = (type: 'devices' | 'groups'): void => {
if (typeof s[type] === 'string' || Array.isArray(s[type])) {
if (typeof s[type] === 'string' || (Array.isArray(s[type]) && Array(s[type]).length > 0)) {
/* eslint-disable-line */ // @ts-ignore
const files: string[] = Array.isArray(s[type]) ? s[type] : [s[type]];
s[type] = {};
@@ -416,7 +431,6 @@ function applyEnvironmentVariables(settings: Partial<Settings>): void {
function getInternalSettings(): Partial<Settings> {
if (!_settings) {
_settings = read();
applyEnvironmentVariables(_settings);
}
return _settings;
@@ -656,21 +670,27 @@ export function removeGroup(IDorName: string | number): void {
write();
}
export function changeEntityOptions(IDorName: string, newOptions: KeyValue): void {
export function changeEntityOptions(IDorName: string, newOptions: KeyValue): boolean {
const settings = getInternalSettings();
delete newOptions.friendly_name;
delete newOptions.devices;
let validator: ValidateFunction;
if (getDevice(IDorName)) {
objectAssignDeep(settings.devices[getDevice(IDorName).ID], newOptions);
utils.removeNullPropertiesFromObject(settings.devices[getDevice(IDorName).ID]);
validator = ajvRestartRequiredDeviceOptions;
} else if (getGroup(IDorName)) {
objectAssignDeep(settings.groups[getGroup(IDorName).ID], newOptions);
utils.removeNullPropertiesFromObject(settings.groups[getGroup(IDorName).ID]);
validator = ajvRestartRequiredGroupOptions;
} else {
throw new Error(`Device or group '${IDorName}' does not exist`);
}
write();
validator(newOptions);
const restartRequired = validator.errors && !!validator.errors.find((e) => e.keyword === 'requiresRestart');
return restartRequired;
}
export function changeFriendlyName(IDorName: string, newName: string): void {
+53 -4
View File
@@ -4,6 +4,8 @@ import data from './data';
import vm from 'vm';
import fs from 'fs';
import path from 'path';
import {detailedDiff} from 'deep-object-diff';
import objectAssignDeep from 'object-assign-deep';
// construct a local ISO8601 string (instead of UTC-based)
// Example:
@@ -77,7 +79,7 @@ async function getZigbee2MQTTVersion(includeCommitHash=true): Promise<{commitHas
}
async function getDependencyVersion(depend: string): Promise<{version: string}> {
const packageJSON = await import(path.join(__dirname, '..', '..', 'node_modules', depend, 'package.json'));
const packageJSON = await import(path.join(require.resolve(depend), '..', '..', 'package.json'));
const version = packageJSON.version;
return {version};
}
@@ -132,8 +134,8 @@ function parseJSON(value: string, fallback: string): KeyValue | string {
}
}
function loadModuleFromText(moduleCode: string): unknown {
const moduleFakePath = path.join(__dirname, 'externally-loaded.js');
function loadModuleFromText(moduleCode: string, name?: string): unknown {
const moduleFakePath = path.join(__dirname, '..', '..', 'data', 'extension', name || 'externally-loaded.js');
const sandbox = {
require: require,
module: {},
@@ -295,6 +297,8 @@ function isAvailabilityEnabledForEntity(entity: Device | Group, settings: Settin
const enabledGlobal = settings.advanced.availability_timeout || settings.availability;
if (!enabledGlobal) return false;
if (entity.isDevice() && entity.options.disabled) return false;
const passlist = settings.advanced.availability_passlist.concat(settings.advanced.availability_whitelist);
if (passlist.length > 0) {
return passlist.includes(entity.name) || passlist.includes(entity.ieeeAddr);
@@ -314,6 +318,14 @@ function isEndpoint(obj: unknown): obj is zh.Endpoint {
return obj.constructor.name.toLowerCase() === 'endpoint';
}
function flatten<Type>(arr: Type[][]): Type[] {
return [].concat(...arr);
}
function arrayUnique<Type>(arr: Type[]): Type[] {
return [...new Set(arr)];
}
function isZHGroup(obj: unknown): obj is zh.Group {
return obj.constructor.name.toLowerCase() === 'group';
}
@@ -351,11 +363,48 @@ function filterProperties(filter: string[], data: KeyValue): void {
}
}
function clone(obj: KeyValue): KeyValue {
return JSON.parse(JSON.stringify(obj));
}
function computeSettingsToChange(current: KeyValue, new_: KeyValue): KeyValue {
const diff: KeyValue = detailedDiff(current, new_);
// Remove any settings that are in the deleted.diff but not in the passed options
const cleanupDeleted = (options: KeyValue, deleted: KeyValue): void => {
for (const key of Object.keys(deleted)) {
if (!(key in options)) {
delete deleted[key];
} else if (!Array.isArray(options[key])) {
cleanupDeleted(options[key], deleted[key]);
}
}
};
cleanupDeleted(new_, diff.deleted);
// objectAssignDeep requires object prototype which is missing from detailedDiff, therefore clone
const newSettings = objectAssignDeep({}, clone(diff.added), clone(diff.updated), clone(diff.deleted));
// deep-object-diff converts arrays to objects, set original array back here
const convertBackArray = (before: KeyValue, after: KeyValue): void => {
for (const [key, afterValue] of Object.entries(after)) {
const beforeValue = before[key];
if (Array.isArray(beforeValue)) {
after[key] = beforeValue;
} else if (afterValue && typeof beforeValue === 'object') {
convertBackArray(beforeValue, afterValue);
}
}
};
convertBackArray(new_, newSettings);
return newSettings;
}
export default {
endpointNames, capitalize, getZigbee2MQTTVersion, getDependencyVersion, formatDate, objectHasProperties,
equalsPartial, getObjectProperty, getResponse, parseJSON, loadModuleFromText, loadModuleFromFile,
getExternalConvertersDefinitions, removeNullPropertiesFromObject, toNetworkAddressHex, toSnakeCase,
parseEntityID, isEndpoint, isZHGroup, hours, minutes, seconds, validateFriendlyName, sleep,
sanitizeImageParameter, isAvailabilityEnabledForEntity, publishLastSeen, availabilityPayload,
getAllFiles, filterProperties,
getAllFiles, filterProperties, flatten, arrayUnique, clone, computeSettingsToChange,
};
+4
View File
@@ -310,6 +310,10 @@ export default class Zigbee {
return this.herdsman.touchlinkFactoryReset(ieeeAddr, channel);
}
async addInstallCode(installCode: string): Promise<void> {
await this.herdsman.addInstallCode(installCode);
}
async touchlinkIdentify(ieeeAddr: string, channel: number): Promise<void> {
await this.herdsman.touchlinkIdentify(ieeeAddr, channel);
}
+2420 -3800
View File
File diff suppressed because it is too large Load Diff
+28 -29
View File
@@ -1,6 +1,6 @@
{
"name": "zigbee2mqtt",
"version": "1.27.0",
"version": "1.30.2",
"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": "^14 || ^16 || ^18"
"node": "^14 || ^16 || ^18 || ^19"
},
"keywords": [
"xiaomi",
@@ -35,57 +35,56 @@
},
"homepage": "https://koenkk.github.io/zigbee2mqtt",
"dependencies": {
"ajv": "^8.11.0",
"ajv": "^8.12.0",
"bind-decorator": "^1.0.11",
"connect-gzip-static": "2.1.1",
"core-js": "^3.24.1",
"debounce": "^1.2.1",
"deep-object-diff": "^1.1.7",
"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.27.2",
"humanize-duration": "^3.28.0",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"jszip": "^3.10.0",
"jszip": "^3.10.1",
"mkdir-recursive": "^0.4.0",
"moment": "^2.29.4",
"mqtt": "4.3.7",
"object-assign-deep": "^0.4.0",
"rimraf": "^3.0.2",
"semver": "^7.3.7",
"rimraf": "^4.1.2",
"semver": "^7.3.8",
"source-map-support": "^0.5.21",
"uri-js": "^4.4.1",
"winston": "^3.8.1",
"winston-syslog": "^2.6.0",
"winston": "^3.8.2",
"winston-syslog": "^2.7.0",
"winston-transport": "^4.5.0",
"ws": "^8.8.1",
"zigbee-herdsman": "0.14.46",
"zigbee-herdsman-converters": "14.0.583",
"zigbee2mqtt-frontend": "0.6.107"
"ws": "^8.12.1",
"zigbee-herdsman": "0.14.96",
"zigbee-herdsman-converters": "15.0.58",
"zigbee2mqtt-frontend": "0.6.125"
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@babel/plugin-proposal-decorators": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@babel/preset-typescript": "^7.18.6",
"@babel/core": "^7.21.0",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.21.0",
"@types/debounce": "^1.2.1",
"@types/finalhandler": "^1.1.1",
"@types/finalhandler": "^1.2.0",
"@types/humanize-duration": "^3.27.1",
"@types/jest": "^28.1.6",
"@types/jest": "^29.4.0",
"@types/js-yaml": "^4.0.5",
"@types/object-assign-deep": "^0.4.0",
"@types/rimraf": "^3.0.2",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"babel-jest": "^28.1.3",
"eslint": "^8.20.0",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"babel-jest": "^29.4.3",
"eslint": "^8.34.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jest": "^26.7.0",
"jest": "^28.1.3",
"eslint-plugin-jest": "^27.2.1",
"jest": "^29.4.3",
"tmp": "^0.2.1",
"typescript": "^4.7.4"
"typescript": "^4.9.5"
},
"jest": {
"coverageThreshold": {
+3 -2
View File
@@ -5,7 +5,8 @@ const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
for (const line of text.split('\n')) {
const model = zigbeeHerdsmanConverters.devices.find((d) => d.model === line);
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(`- \`${line}\` ${model.vendor} ${model.description}`);
console.log(`- \`${modelNumber}\` ${model.vendor} ${model.description} (${user})`);
}
+22
View File
@@ -0,0 +1,22 @@
const assert = require('assert');
const vm = require('vm');
const fs = require('fs');
const path = require('path');
const filename = process.argv[2];
const moduleCode = fs.readFileSync(filename);
const moduleFakePath = path.join(__dirname, 'externally-loaded.js');
const sandbox = {
require: require,
module: {},
console,
setTimeout,
clearTimeout,
setInterval,
clearInterval,
setImmediate,
clearImmediate,
};
vm.runInNewContext(moduleCode, sandbox, moduleFakePath);
const converter = sandbox.module.exports;
assert(!converter.toZigbee.includes(undefined));
assert(!converter.fromZigbee.includes(undefined));
+31
View File
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIUU70Q1tbGP071yeQ8EcHd/0rxtnwwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjEyMDMwMDA1MTBaFw0yMzAx
MDIwMDA1MTBaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQDR6bYQPgkfWlGQq19U2nMsAo0RZR7wSUuFS0MFpbQS
2Rr5x/4FwwKhTMOlfr6H2Xo/5pQvGOlhFE69j1HxQRooWDAswnscMv/9pb+BUqoE
7J29SEndIpmCaI0c3ejZsu4Nq8DxGod/RsQhJdbDU+hkw8qARJ0JjnTb+aN1KH8g
J3KeSMTOL3guBVZQujO0Unbjv47yBIFwi0IihR18aoRaxinb94Aqf92HcjZN++WU
gq7/2Qlm3tF5uJwuNtG/DmzReSblRcUgzPri7qIhb9z51gFNdNX6cTH3yNoF/KtT
XwEArvvsAyMCYuC6w8KI7WNmPI6yxSksgHdcNPlUVZYquLD+z2kYAdIByiyHmIpm
OH3jVN7lRJ6xITOGmyNktfRuSUi2GzECAOWIGpDD/5/gK1pacbOXpJWqVrTjUIAN
BrQf496CbabVgwaQEvq1QJJbuMbpma21/IlS6NpZS7vm/q1ojNsbEB6PYkSsBTzP
iZiiaomjhV2w5yIp5Zn8xyMFVKLb+SEDQBtZZ6CErmbgqp4B3U2b4k5LippLmZZK
pSk7BOuMpsZK8FIGS4KlANFfGVs79y6N+Jxue2IO9pRcpcpbqOXty4662BsPKInw
dKxKTr6TcTe0gEq1fpf1npYwcZ9t36LMJ7L51TbaaJ5sEsXe5QNOOOUgSwPqWmrE
lwIDAQABo1MwUTAdBgNVHQ4EFgQUYD/x9cCuGJgLUPkYLIVa8uvseBkwHwYDVR0j
BBgwFoAUYD/x9cCuGJgLUPkYLIVa8uvseBkwDwYDVR0TAQH/BAUwAwEB/zANBgkq
hkiG9w0BAQsFAAOCAgEAI+gp+8qqO4anj8NHgjJvXhrETLPJIeLuBp/cjF9HA2IL
oAd5rXWPnQ6qgh3q/HazILgIHwI0wSrhVtRlprgGIxNa59cD3RcZCtqFSWIqhAqZ
JnAye3bnGU/KahazQX3oP+y564b/QZvwpJDKC1EoMv1wdpXND2NVn4HwaBc7Tu/d
SX/Tr6k+e32K8mwE+00/yf2rLrmWmNjWtP0f7zRmH3j1+ovktk7UoVhjKXfhqMUE
pWdhPZIXQJ65JNMGKdeFI2ULQY9IbXHeWQUgBCyhTciMvm2XZzopk7rxrh9NZopS
pAlCrWBkOZrs6hfZrus9FOzwSkeIEY7NnhNk05kslERJxjkoFytp7mDd4mTKCVW0
dKc7G1hZWYfO3oe0Zjxi0ragyReNKtyL1BqMbDKJmxHl91iPbdueWix1xxhNFakH
l3eOzfa/DEixvzxy3hzCcvagNb5RsXFVMQXQTgnIW/5GcG5VVB2/o7KidPL3XtqR
Hc/0ebQvloGXgqJbyTXG9EInkwB35wXDQuHgwt1PhwzP1yfp2BCvDsQWrR3IxnBT
DO1o2RpsurgCgUpd0vcW17DePLNfprrhhU2uTPn2bNcWdT/rZmEImkNaA29Rku+3
SZQJZWIx4s2FMdVdAv6ZauROStTY/WayudfcFfP+hYvJ5/ccQ9Gkb7vrGUssFRw=
-----END CERTIFICATE-----
+54
View File
@@ -0,0 +1,54 @@
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIJnDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIrNH7wPLdpbUCAggA
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECN97bYsRcF6xBIIJSLVWpqTzdlNO
5J7kOrNcdbbg+SSEYbtT+G9gtwtkI8KO+xzYQZ/fdqmXgNqf9AQmikwDWQkoS4gC
qq6S+iKYn7Y8ZNZ/xu7gWW6L6uNZ3LTe/vkpenU6kmZrDysFTW5b7iH2VmMc/2h/
J3o3unxeMLMVSaoDG3MG08qj53yTmetTkZZZc4fgf6vK9/4fTJhdXu6n+1COBLBI
KbqbTRKnai3CNiYzz3UHyp9CGx1nX06beTJW8bYJUld9cJz+ozLNSV78oCkcUfwG
yR7p/6+86cWor5SwYG1wEm6w2bXrIJILTUdT92gXC8fhc/B6Id8hcuLIHcvFQ/CP
31y4Qwea3vY6b1TeRbqS4/fYOYajsiZi9ps0Meg55qMJj/UuNW2iLlR7PVsDXmPO
33X6cpEVyIlNCJzRREotzSoGmcXjQ5Dgd1LkxZPb163NGkRoJT4GcKCtQxYIyIzy
qyU0YF7I5LPKtNt1IPURHHerW42jM2jFlISxUixgl5Pj3WrmXeEmXq7htItn6X/q
tVEVUf6srs3aos2Ohx7Ji9PVDNuMGGGKxleCM6fU9ax/gYuk5r6PMYGPsD26xuZ0
A9WbFFFI6N1V+M3YsJJdxevZRV1NB3RymYGwFoZFDOKLb5DYJmPP3VVN/DsMNPkw
qaue7rinxBdLi8J6Itusiscg5pCyYQaujXtkK/bi6c1HCld4RvWCDgeU52SWRdJ9
2Np2629AeBvBfHP1/DsaUsyQPJAgDJk0HXoJyqstoALkRZ6ICoi1833LW/JGIWOv
xnl3JZ2q12aqb2OWxiBUKspnt2y5C2KpQJdmuEL68lAKLg+fzLi/jhJG1bwzWo79
I5G+QeV9+kI3vAIYHu331a+Yevs2p84sIumDGFSCSHAaWMmsrizJ4eKl5NnwZHS+
xUvcW+ISRKNRm4DWAL/nlwBJWMhCz+nsTKYvE1JO/IH2P5xxtD6bTjJ3YkVAHkBZ
wfApCBxdiQurEiabj06C4OCcNRkqJ/GwLrdxiwTCAt2hd7Dn+ttLo3Fi6iPRae8c
ZtWsCWaFObZ1QBeu7lKm+ev/Ab2SHtp6QMfrArNsrdIxSH1+Sm4DgfHmTmte2Tse
KFHy5Rwokst+Y18zjp3auJ3+NTTr9D1x2JCdQ6wkh66Pyd2FBLqRrMI1fHq9t9P+
r4DQm9I6FbgALm9yJ2QxV4ytwFGsowAye3vF+hfO5OjAScrG5DrxASRXlnp59zpd
+vMLk6rzcfiHzaJzYc/SOU9ubKN93aJmlL0Zgf1gg54oGnmPbEJeqQzeKVBtisro
FrNUPEFx5QOaqjVipPOpZfpTb0oaUpBdp4RpeI7W3Gb/dsmsRj7ItxvM6QxFdd5e
XfDZEYaUJRwSG3lHg9URWwSmfRWV81BhEuwvji4rNIEQ32VMsi2WWWPLOYYKGIw/
yE56xWBw7K78XwVx/b5yoNHBNjVNyjpNZ7jXkx6zdOjbqEpXJP+WfgVkYwlhlvAq
cCDbrF7jVWFqTV9tZNxlbaFlS8f17vld8DmmJ29Lo+WecsOo3M9n2Z6i79u7Xg2O
ip0V2Textq8rrKOwC1TLCRoQLypENO/cwdaF5amVkoXYDlY0rQtxf65Xe9bnJLrM
1G+tG8NZQu/bvW0mgrm0XHt2i6yfjn6sXEOY5VEC2+gRUriQ+GCETgzMe6ukb26/
VT38Va10SIu+xXwf/GXTwLskOO0AyWLBopTpL5q6faM4o/USX+Xl98sQVNQurHMS
xSQtpL6YPhQrmW7q5Q57OVWy70kEU8RpOJx6I7uyoUDz2g3bjmpIPpQX55vhofXK
3Xn76Ce9TyiVol71mPtBT1tYzi3ytZh/EYm2Wq3lEhbMT7zjw3T1Ypb4+q12VdCy
0Y9swKsQdhRCT6FwcCFSpCc2TzCCJCR6mChTe+z6rNm5BS2M6BaYcrX8PP82rZ8k
L0l3ymSLqSJ3J6Q+fdKhRq8EbCq6ngi31Q/l7fPHkW5VAJyowPRayD7UM09n6ou+
sg/kfQB8nh46uVxRRDpyUsrfhtIEQec2xrU17NmCr2VlAeOjWBn8lE/J1Gfn8WyV
05mY1aDGcRk/x02+74UujyuozYMfIVDXHpxp8YteTnBfiKVrRq+Aa9zVX9bkyagp
SJUTpF7lqMmiuvyZnG2xfLDfILR/zTRIRrm+ZIJLHeVQJtibOJ1llxE6kRvKx6zp
La47YCHKH+rLDTlNgrE5K/JtQgOKc+7bGQ6SCszf8OZWi5B2+Z+Ht36c3xQk9IOW
cjNpvjZxpiw6L1MhlQPE/wxz2JkOlKjJN0MmLscIyu15X+W/BvHwB8d11CRKUUiE
pV7OUoW2Ol1IgFHrEY33IhxwtyKtAKfQCiORarnwk/GvcD3TqmnzUeQdscdww4BI
wsO3c3aGr+wvU3P/8oFAoffD1KRihtoZ6CB347JcnaeEPlOS13a28JsJCOtjMxy9
wBH6UgzTwo04lDAStST+aIT4TaU4dlWmsAEQTpE8sa4DjpFtzK/ll+Wg2sA/SYaA
uAugsAOnTb1pkgk43GoYfc2fZCu1g9b/L3mZrE62W8HDfm67PWT65XMJziy/hcCy
DbXMAWfohLdePKDG7J0QQI8xcTN9TT5q3ZCglI9Xf7PE/qrHROdRgF8c8zyvB9dG
AVx96Z7akBoveqlFS44MnxIOGI0AzV8MrVbN51W6RHNyg/6UTL50/8zHmRWZj+iO
tfqiW+CtSHacYPy+Tcuft30PWZZkQDGphbRxaBRB00Fb+Bo57epDw4JS+4wRru33
2RHaVzQmnXwR6kP85x4uAR53UdgMgfK4cyylnFqGDlLFrHZfauFHg3kMIwqgVIVA
uMRrWC9XXU11j6NnP9J6Y64uSrjsh6eZOrtJIwA16U2r3PMMbn1hIdADrKu1MsPt
bkNsnPQUKJyX8DbRX45kje5ssUerbkxhvewvHQJlTyDxtgk/pGHOyKXoT+5vQEj9
pwHOrXi+QWidzi2vfRoNQJ0wXJr39dDTn0hVdsgFo2PsTh98W9cocVQfJnCL4Djs
Zlsp/BJOwlb2e3Q28E6pNyT+N63ZYEO9zLV/WmCB/eV2uMVoKibX3KszYkn0jAs0
RBytgnB8YW3n9RyorShchCKJzdjzR7nw79/lSLgDFE6W6Xh3VaGM07hz0vYWfaui
yvytkM9LPan2/GJM4zLFeA==
-----END ENCRYPTED PRIVATE KEY-----
+9
View File
@@ -179,6 +179,15 @@ describe('Availability', () => {
expect(devices.bulb_color.ping).toHaveBeenCalledTimes(1);
});
it('Should not ping disabled devices', async () => {
settings.set(['devices', devices.bulb_color.ieeeAddr, 'disabled'], true);
await resetExtension();
MQTT.publish.mockClear();
await advancedTime(utils.minutes(15));
expect(devices.bulb_color.ping).toHaveBeenCalledTimes(0);
});
it('Should allow to change availability timeout via avaiability options', async () => {
settings.set(['availability'], {active: {timeout: 30}});
await resetExtension();
+76 -7
View File
File diff suppressed because one or more lines are too long
+14 -1
View File
@@ -65,6 +65,7 @@ describe('Configure', () => {
jest.useFakeTimers();
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
await jest.runOnlyPendingTimers();
await flushPromises();
});
@@ -72,8 +73,9 @@ describe('Configure', () => {
data.writeDefaultConfiguration();
settings.reRead();
mocksClear.forEach((m) => m.mockClear());
coordinatorEndpoint = zigbeeHerdsman.devices.coordinator.getEndpoint(1);
coordinatorEndpoint = zigbeeHerdsman.devices.coordinator.getEndpoint(1);
await resetExtension();
await jest.runOnlyPendingTimers();
});
afterAll(async () => {
@@ -100,6 +102,17 @@ describe('Configure', () => {
expectBulbConfigured();
});
it('Should not re-configure disabled devices', async () => {
expectBulbConfigured();
const device = zigbeeHerdsman.devices.bulb;
await flushPromises();
mockClear(device);
settings.set(['devices', device.ieeeAddr, 'disabled'], true);
zigbeeHerdsman.events.deviceJoined({device});
await flushPromises();
expectBulbNotConfigured();
});
it('Should reconfigure reporting on reconfigure event', async () => {
expectBulbConfigured();
const device = controller.zigbee.resolveEntity(zigbeeHerdsman.devices.bulb);
+14 -4
View File
@@ -147,7 +147,6 @@ describe('Controller', () => {
logger.error.mockClear();
controller.mqtt.client.reconnecting = true;
jest.advanceTimersByTime(11 * 1000);
await flushPromises();
expect(logger.error).toHaveBeenCalledWith("Not connected to MQTT server!");
controller.mqtt.client.reconnecting = false;
});
@@ -202,7 +201,8 @@ describe('Controller', () => {
});
await controller.start();
await flushPromises();
expect(logger.error).toHaveBeenCalledWith('MQTT failed to connect: addr not found');
expect(logger.error).toHaveBeenCalledWith('MQTT error: addr not found');
expect(logger.error).toHaveBeenCalledWith('MQTT failed to connect, exiting...');
expect(mockExit).toHaveBeenCalledTimes(1);
expect(mockExit).toHaveBeenCalledWith(1, false);
});
@@ -651,7 +651,7 @@ describe('Controller', () => {
MQTT.events['connect']();
await flushPromises();
jest.runOnlyPendingTimers();
expect(MQTT.publish).toHaveBeenCalledTimes(12);
expect(MQTT.publish).toHaveBeenCalledTimes(13);
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/info', expect.any(String), { retain: true, qos: 0 }, expect.any(Function));
});
@@ -662,7 +662,8 @@ describe('Controller', () => {
await flushPromises();
await MQTT.events.message('zigbee2mqtt/bridge/state', 'online');
jest.runOnlyPendingTimers();
expect(MQTT.publish).toHaveBeenCalledTimes(0);
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/state', expect.any(String), { retain: true, qos: 0 }, expect.any(Function));
});
it('Should prevent any message being published with retain flag when force_disable_retain is set', async () => {
@@ -717,4 +718,13 @@ describe('Controller', () => {
await flushPromises();
expect(logger.debug).toHaveBeenCalledWith(`Received Zigbee message from 'Coordinator', type 'attributeReport', cluster 'genBasic', data '{"modelId":null}' from endpoint 1, ignoring since it is from coordinator`);
});
it('Should remove state of removed device when stopped', async () => {
await controller.start();
const device = controller.zigbee.resolveEntity('bulb');
expect(controller.state.state[device.ieeeAddr]).toStrictEqual({"brightness":50,"color_temp":370,"linkquality":99,"state":"ON"});
device.zh.isDeleted = true;
await controller.stop();
expect(controller.state.state[device.ieeeAddr]).toStrictEqual(undefined);
});
});
+1
View File
@@ -19,6 +19,7 @@ describe('Data', () => {
const actual = data.getPath();
expect(actual).toBe(expected);
expect(data.joinPath('test')).toStrictEqual(path.join(expected, 'test'));
expect(data.joinPath('/test')).toStrictEqual(path.resolve(expected, '/test'));
delete process.env.ZIGBEE2MQTT_DATA;
data.testingOnlyReload();
});
+6 -1
View File
@@ -84,7 +84,12 @@ describe('User extensions', () => {
MQTT.events.message('zigbee2mqtt/bridge/request/extension/save', stringify({"name": "foo.js", "code": extensionCode}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/response/extension/save', stringify({"data":{},"error":"Unexpected identifier","status":"error"}), { retain: false, qos: 0 }, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/response/extension/save', expect.any(String), { retain: false, qos: 0 }, expect.any(Function));
const payload = JSON.parse(MQTT.publish.mock.calls[0][1]);
expect(payload).toEqual(
expect.objectContaining({"data":{},"status":"error"})
);
expect(payload.error).toMatch("Unexpected identifier");
});
it('Removes user extension', async () => {
+60 -3
View File
@@ -7,6 +7,7 @@ const Controller = require('../lib/controller');
const stringify = require('json-stable-stringify-without-jsonify');
const flushPromises = require('./lib/flushPromises');
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
const path = require("path");
jest.spyOn(process, 'exit').mockImplementation(() => {});
const mockHTTP = {
@@ -19,6 +20,16 @@ const mockHTTP = {
events: {},
};
const mockHTTPS = {
implementation: {
listen: jest.fn(),
on: (event, handler) => {mockHTTPS.events[event] = handler},
close: jest.fn().mockImplementation((cb) => cb()),
},
variables: {},
events: {},
};
const mockWSocket = {
close: jest.fn(),
};
@@ -50,6 +61,13 @@ jest.mock('http', () => ({
}),
}));
jest.mock('https', () => ({
createServer: jest.fn().mockImplementation((onRequest) => {
mockHTTPS.variables.onRequest = onRequest;
return mockHTTPS.implementation;
}),
}));
jest.mock("connect-gzip-static", () =>
jest.fn().mockImplementation((path) => {
mockNodeStatic.variables.path = path
@@ -98,7 +116,6 @@ describe('Frontend', () => {
await controller.start();
expect(mockNodeStatic.variables.path).toBe("my/dummy/path");
expect(mockHTTP.implementation.listen).toHaveBeenCalledWith(8081, "127.0.0.1");
const mockWSClient = {
implementation: {
terminate: jest.fn(),
@@ -111,6 +128,46 @@ describe('Frontend', () => {
expect(mockWSClient.implementation.terminate).toHaveBeenCalledTimes(1);
expect(mockHTTP.implementation.close).toHaveBeenCalledTimes(1);
expect(mockWS.implementation.close).toHaveBeenCalledTimes(1);
mockHTTP.implementation.listen.mockClear();
mockHTTPS.implementation.listen.mockClear();
});
it('Start/stop HTTPS valid', async () => {
settings.set(['frontend','ssl_cert'], path.join(__dirname,'assets','certs','dummy.crt'));
settings.set(['frontend','ssl_key'], path.join(__dirname,'assets','certs','dummy.key'));
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
expect(mockHTTP.implementation.listen).not.toHaveBeenCalledWith(8081, "127.0.0.1");
expect(mockHTTPS.implementation.listen).toHaveBeenCalledWith(8081, "127.0.0.1");
await controller.stop();
mockHTTP.implementation.listen.mockClear();
mockHTTPS.implementation.listen.mockClear();
});
it('Start/stop HTTPS invalid : missing config', async () => {
settings.set(['frontend','ssl_cert'], path.join(__dirname,'assets','certs','dummy.crt'));
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
expect(mockHTTP.implementation.listen).toHaveBeenCalledWith(8081, "127.0.0.1");
expect(mockHTTPS.implementation.listen).not.toHaveBeenCalledWith(8081, "127.0.0.1");
await controller.stop();
mockHTTP.implementation.listen.mockClear();
mockHTTPS.implementation.listen.mockClear();
});
it('Start/stop HTTPS invalid : missing file', async () => {
settings.set(['frontend','ssl_cert'], 'filesNotExists.crt');
settings.set(['frontend','ssl_key'], path.join(__dirname,'assets','certs','dummy.key'));
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
expect(mockHTTP.implementation.listen).toHaveBeenCalledWith(8081, "127.0.0.1");
expect(mockHTTPS.implementation.listen).not.toHaveBeenCalledWith(8081, "127.0.0.1");
await controller.stop();
mockHTTP.implementation.listen.mockClear();
mockHTTPS.implementation.listen.mockClear();
});
it('Websocket interaction', async () => {
@@ -140,7 +197,7 @@ describe('Frontend', () => {
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb_color',
stringify({state: 'ON', linkquality: null, update_available: null, update: {state: null}}),
stringify({state: 'ON', power_on_behavior:null, linkquality: null, update_available: null, update: {state: null, installed_version: -1, latest_version: -1}}),
{ retain: false, qos: 0 },
expect.any(Function)
);
@@ -151,7 +208,7 @@ describe('Frontend', () => {
// Received message on socket
expect(mockWSClient.implementation.send).toHaveBeenCalledTimes(1);
expect(mockWSClient.implementation.send).toHaveBeenCalledWith(stringify({topic: 'bulb_color', payload: {state: 'ON', linkquality: null, update_available: null, update: {state: null}}}));
expect(mockWSClient.implementation.send).toHaveBeenCalledWith(stringify({topic: 'bulb_color', payload: {state: 'ON', power_on_behavior:null, linkquality: null, update_available: null, update: {state: null, installed_version: -1, latest_version: -1}}}));
// Shouldnt set when not ready
mockWSClient.implementation.send.mockClear();
+16
View File
@@ -334,6 +334,22 @@ describe('Groups', () => {
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/group_1", stringify({"state":"ON"}), {"retain": false, qos: 0}, expect.any(Function));
});
it('Should not publish state change when group changes state and device is disabled', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
const endpoint = device.getEndpoint(1);
const group = zigbeeHerdsman.groups.group_1;
group.members.push(endpoint);
settings.set(['devices', device.ieeeAddr, 'disabled'], true);
settings.set(['groups'], {'1': {friendly_name: 'group_1', retain: false, devices: [device.ieeeAddr]}});
await resetExtension();
MQTT.publish.mockClear();
await MQTT.events.message('zigbee2mqtt/group_1/set', stringify({state: 'ON'}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/group_1", stringify({"state":"ON"}), {"retain": false, qos: 0}, expect.any(Function));
});
it('Should publish state change for group when members state change', async () => {
// Created for https://github.com/Koenkk/zigbee2mqtt/issues/5725
const device = zigbeeHerdsman.devices.bulb_color;
+153 -9
View File
@@ -98,6 +98,19 @@ describe('HomeAssistant extension', () => {
"xy",
"color_temp"
],
"effect":true,
"effect_list":[
"blink",
"breathe",
"okay",
"channel_change",
"candle",
"fireplace",
"colorloop",
"finish_effect",
"stop_effect",
"stop_hue_effect",
],
"unique_id":"9_light_zigbee2mqtt"
};
@@ -770,7 +783,8 @@ describe('HomeAssistant extension', () => {
"boost",
"complex",
"comfort",
"eco"
"eco",
"away"
],
"preset_mode_value_template":"{{ value_json.preset }}",
"preset_mode_state_topic":"zigbee2mqtt/TS0601_thermostat",
@@ -811,6 +825,10 @@ describe('HomeAssistant extension', () => {
set_position_topic: 'zigbee2mqtt/smart vent/set',
set_position_template: '{ "position": {{ position }} }',
position_template: '{{ value_json.position }}',
state_topic: 'zigbee2mqtt/smart vent',
value_template: `{{ value_json.state }}`,
state_open: 'OPEN',
state_closed: 'CLOSE',
json_attributes_topic: 'zigbee2mqtt/smart vent',
name: 'smart vent',
unique_id: '0x0017880104e45551_cover_zigbee2mqtt',
@@ -831,6 +849,39 @@ describe('HomeAssistant extension', () => {
{ retain: true, qos: 0 },
expect.any(Function),
);
payload = {
"availability": [{ "topic": "zigbee2mqtt/bridge/state" }],
"command_topic": "zigbee2mqtt/zigfred_plus/l6/set",
"device": {
"identifiers": ["zigbee2mqtt_0xf4ce368a38be56a1"],
"manufacturer": "Siglis",
"model": "zigfred plus smart in-wall switch (ZFP-1A-CH)",
"name": "zigfred_plus",
"sw_version": null
},
"json_attributes_topic": "zigbee2mqtt/zigfred_plus/l6",
"name": "zigfred_plus_l6",
"position_template": "{{ value_json.position }}",
"position_topic": "zigbee2mqtt/zigfred_plus/l6",
"set_position_template": "{ \"position_l6\": {{ position }} }",
"set_position_topic": "zigbee2mqtt/zigfred_plus/l6/set",
"state_closed": "CLOSE",
"state_open": "OPEN",
"state_topic": "zigbee2mqtt/zigfred_plus/l6",
"tilt_command_topic": "zigbee2mqtt/zigfred_plus/l6/set/tilt",
"tilt_status_template": "{{ value_json.tilt }}",
"tilt_status_topic": "zigbee2mqtt/zigfred_plus/l6",
"unique_id": "0xf4ce368a38be56a1_cover_l6_zigbee2mqtt",
"value_template": "{{ value_json.state }}"
}
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/cover/0xf4ce368a38be56a1/cover_l6/config',
stringify(payload),
{ retain: true, qos: 0 },
expect.any(Function),
);
});
it('Should discover devices with custom homeassistant_discovery_topic', async () => {
@@ -909,7 +960,7 @@ describe('HomeAssistant extension', () => {
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb_color',
stringify({"color":{"hue": 0, "saturation": 100, "h": 0, "s": 100}, "color_mode": "hs", "linkquality": null, "state": null, "update_available": null, "update": {"state": null}}),
stringify({"color":{"hue": 0, "saturation": 100, "h": 0, "s": 100}, "color_mode": "hs", "linkquality": null, "state": null, "update_available": null, "power_on_behavior":null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: false, qos: 0 },
expect.any(Function),
);
@@ -925,7 +976,7 @@ describe('HomeAssistant extension', () => {
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb_color',
stringify({"color": {"x": 0.4576,"y": 0.41}, "color_mode": "xy", "linkquality": null,"state": null, "update_available": null, "update": {"state": null}}),
stringify({"color": {"x": 0.4576,"y": 0.41}, "color_mode": "xy", "linkquality": null,"state": null, "update_available": null, "power_on_behavior":null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: false, qos: 0 },
expect.any(Function),
);
@@ -941,7 +992,7 @@ describe('HomeAssistant extension', () => {
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb_color',
stringify({"linkquality": null,"state": "ON", "update_available": null, "update": {"state": null}}),
stringify({"linkquality": null,"state": "ON", "update_available": null, "power_on_behavior": null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: false, qos: 0 },
expect.any(Function),
);
@@ -1029,13 +1080,13 @@ describe('HomeAssistant extension', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"state":"ON","brightness":50,"color_temp":370,"linkquality":99,"power_on_behavior":null, "update_available": null, "update": {"state": null}}),
stringify({"state":"ON","brightness":50,"color_temp":370,"linkquality":99,"power_on_behavior":null, "update_available": null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: true, qos: 0 },
expect.any(Function)
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/remote',
stringify({"action":null,"action_duration":null,"battery":null,"brightness":255,"linkquality":null, "update_available": null, "update": {"state": null}}),
stringify({"action":null,"action_duration":null,"battery":null,"brightness":255,"linkquality":null, "update_available": null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: true, qos: 0 },
expect.any(Function)
);
@@ -1059,13 +1110,13 @@ describe('HomeAssistant extension', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"state":"ON","brightness":50,"color_temp":370,"linkquality":99,"power_on_behavior":null, "update_available": null, "update": {"state": null}}),
stringify({"state":"ON","brightness":50,"color_temp":370,"linkquality":99,"power_on_behavior":null, "update_available": null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: true, qos: 0 },
expect.any(Function)
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/remote',
stringify({"action":null,"action_duration":null,"battery":null,"brightness":255,"linkquality":null, "update_available": null, "update": {"state": null}}),
stringify({"action":null,"action_duration":null,"battery":null,"brightness":255,"linkquality":null, "update_available": null, "update": {"state": null, "installed_version": -1, "latest_version": -1}}),
{ retain: true, qos: 0 },
expect.any(Function)
);
@@ -1269,6 +1320,19 @@ describe('HomeAssistant extension', () => {
"xy",
"color_temp"
],
"effect":true,
"effect_list":[
"blink",
"breathe",
"okay",
"channel_change",
"candle",
"fireplace",
"colorloop",
"finish_effect",
"stop_effect",
"stop_hue_effect",
],
"unique_id":"9_light_zigbee2mqtt"
};
@@ -1332,7 +1396,7 @@ describe('HomeAssistant extension', () => {
"payload_on":true,
"payload_off":false,
"value_template":`{{ value_json['update']['state'] == "available" }}`,
"enabled_by_default": true,
"enabled_by_default": false,
"state_topic":"zigbee2mqtt/bulb",
"json_attributes_topic":"zigbee2mqtt/bulb",
"name":"bulb update available",
@@ -1785,6 +1849,19 @@ describe('HomeAssistant extension', () => {
"xy",
"color_temp"
],
"effect":true,
"effect_list":[
"blink",
"breathe",
"okay",
"channel_change",
"candle",
"fireplace",
"colorloop",
"finish_effect",
"stop_effect",
"stop_hue_effect",
],
"unique_id":"9_light_zigbee2mqtt"
};
@@ -1821,6 +1898,19 @@ describe('HomeAssistant extension', () => {
"xy",
"color_temp"
],
"effect":true,
"effect_list":[
"blink",
"breathe",
"okay",
"channel_change",
"candle",
"fireplace",
"colorloop",
"finish_effect",
"stop_effect",
"stop_hue_effect",
],
"unique_id":"9_light_zigbee2mqtt"
};
@@ -1832,6 +1922,60 @@ describe('HomeAssistant extension', () => {
);
});
it('Should discover with availability offline when device is disabled', async () => {
settings.set(['devices', '0x000b57fffec6a5b2', 'disabled'], true);
await resetExtension();
const payload = {
"availability":[
{
"topic":"zigbee2mqtt/bridge/state",
"value_template": `{{ "offline" }}`,
}
],
"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)",
"name":"bulb",
"sw_version":null
},
"effect":true,
"effect_list":[
"blink",
"breathe",
"okay",
"channel_change",
"finish_effect",
"stop_effect"
],
"json_attributes_topic":"zigbee2mqtt/bulb",
"max_mireds":454,
"min_mireds":250,
"name":"bulb",
"schema":"json",
"state_topic":"zigbee2mqtt/bulb",
"supported_color_modes":[
"color_temp"
],
"unique_id":"0x000b57fffec6a5b2_light_zigbee2mqtt"
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/light/0x000b57fffec6a5b2/light/config',
stringify(payload),
{ retain: true, qos: 0 },
expect.any(Function),
);
});
it('Should discover last_seen when enabled', async () => {
settings.set(['advanced', 'last_seen'], 'ISO_8601');
await resetExtension();
+17 -2
View File
@@ -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, 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), 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 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, 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"}]};
expect(JSON.parse(call[1])).toStrictEqual(expected);
/**
@@ -276,7 +276,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":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, 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), 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 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, 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 actual = JSON.parse(call[1]);
expect(actual).toStrictEqual(expected);
});
@@ -292,4 +292,19 @@ describe('Networkmap', () => {
{retain: false, qos: 0}, expect.any(Function)
);
});
it('Should exclude disabled devices from networkmap', async () => {
settings.set(['devices', '0x000b57fffec6a5b2', 'disabled'], true);
mock();
MQTT.publish.mockClear();
MQTT.events.message('zigbee2mqtt/bridge/request/networkmap', stringify({type: 'raw', routes: true}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
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 actual = JSON.parse(call[1]);
expect(actual).toStrictEqual(expected);
});
});
+19 -16
View File
@@ -36,6 +36,7 @@ describe('OTA update', () => {
jest.useFakeTimers();
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
await jest.runOnlyPendingTimers();
await flushPromises();
});
@@ -71,6 +72,7 @@ describe('OTA update', () => {
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
onUpdate(0, null);
onUpdate(10, 3600.2123);
return 90;
});
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/update', 'bulb');
@@ -98,7 +100,7 @@ describe('OTA update', () => {
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"update_available":false,"update":{"state":"idle"}}),
stringify({"update_available":false,"update":{"state":"idle","installed_version":90,"latest_version":90}}),
{retain: true, qos: 0}, expect.any(Function)
);
expect(MQTT.publish).toHaveBeenCalledWith(
@@ -144,7 +146,7 @@ describe('OTA update', () => {
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce(false);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 10, otaFileVersion: 10});
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/check', "bulb");
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
@@ -156,7 +158,7 @@ describe('OTA update', () => {
);
MQTT.publish.mockClear();
mapped.ota.isUpdateAvailable.mockReturnValueOnce(true);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 10, otaFileVersion: 12});
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/check', "bulb");
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(2);
@@ -249,7 +251,7 @@ describe('OTA update', () => {
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce(true);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 10, otaFileVersion: 12});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10};
logger.info.mockClear();
await zigbeeHerdsman.events.message(payload);
@@ -258,7 +260,7 @@ describe('OTA update', () => {
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"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": 0x95});
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x98});
// Should not request again when device asks again after a short time
await zigbeeHerdsman.events.message(payload);
@@ -266,13 +268,13 @@ describe('OTA update', () => {
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
logger.info.mockClear();
mapped.ota.isUpdateAvailable.mockReturnValueOnce(false);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 10, otaFileVersion: 10});
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(logger.info).not.toHaveBeenCalledWith(`Update available for 'bulb'`);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"update_available":true,"update":{"state":"available"}}),
stringify({"update_available":true,"update":{"state":"available","installed_version":10,"latest_version":12}}),
{retain: true, qos: 0}, expect.any(Function)
);
});
@@ -305,7 +307,7 @@ describe('OTA update', () => {
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce(false);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 13, otaFileVersion: 13});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10};
logger.info.mockClear();
await zigbeeHerdsman.events.message(payload);
@@ -313,10 +315,10 @@ describe('OTA update', () => {
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"imageType": 12382});
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x95});
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x98});
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bulb',
stringify({"update_available":false,"update":{"state":"idle"}}),
stringify({"update_available":false,"update":{"state":"idle","installed_version": 13, "latest_version": 13}}),
{retain: true, qos: 0}, expect.any(Function)
);
});
@@ -327,7 +329,7 @@ describe('OTA update', () => {
const data = {imageType: 12382};
const mapped = zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);
mapped.ota.isUpdateAvailable.mockReturnValueOnce(true);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 10, otaFileVersion: 13});
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10};
logger.info.mockClear();
await zigbeeHerdsman.events.message(payload);
@@ -345,15 +347,15 @@ describe('OTA update', () => {
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 152});
});
it('Shouldnt respond with NO_IMAGE_AVAILABLE when not supporting OTA and device has no OTA endpoint', async () => {
it('Should respond with NO_IMAGE_AVAILABLE when not supporting OTA and device has no OTA endpoint to standard endpoint', async () => {
const device = zigbeeHerdsman.devices.SV01;
const data = {imageType: 12382};
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10};
logger.error.mockClear();
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(0);
expect(logger.error).toHaveBeenCalledTimes(0);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 152});
});
it('Legacy api: Should OTA update a device', async () => {
@@ -372,6 +374,7 @@ describe('OTA update', () => {
mapped.ota.updateToLatest.mockImplementationOnce((a, b, onUpdate) => {
onUpdate(0, null);
onUpdate(10, 3600);
return 91;
});
MQTT.events.message('zigbee2mqtt/bridge/ota_update/update', 'bulb');
@@ -414,7 +417,7 @@ describe('OTA update', () => {
mockClear(mapped);
logger.info.mockClear();
mapped.ota.isUpdateAvailable.mockReturnValueOnce(false);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 13, otaFileVersion: 13});
MQTT.events.message('zigbee2mqtt/bridge/ota_update/check', 'bulb');
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
@@ -422,7 +425,7 @@ describe('OTA update', () => {
expect(logger.info).toHaveBeenCalledWith(`No update available for 'bulb'`);
logger.info.mockClear();
mapped.ota.isUpdateAvailable.mockReturnValueOnce(true);
mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: true, currentFileVersion: 13, otaFileVersion: 15});
MQTT.events.message('zigbee2mqtt/bridge/ota_update/check', 'bulb');
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(2);
+12
View File
@@ -507,6 +507,18 @@ describe('Publish', () => {
expect(endpoint3.read).toHaveBeenCalledWith('genOnOff', ['onOff']);
});
it('Should handle get with multiple cover endpoints', async () => {
const device = zigbeeHerdsman.devices.zigfred_plus;
const endpoint11 = device.getEndpoint(11);
const endpoint12 = device.getEndpoint(12);
await MQTT.events.message('zigbee2mqtt/zigfred_plus/get', stringify({state_l6: '', state_l7: ''}));
await flushPromises();
expect(endpoint11.read).toHaveBeenCalledTimes(1);
expect(endpoint11.read).toHaveBeenCalledWith('closuresWindowCovering', ['currentPositionLiftPercentage']);
expect(endpoint12.read).toHaveBeenCalledTimes(1);
expect(endpoint12.read).toHaveBeenCalledWith('closuresWindowCovering', ['currentPositionLiftPercentage']);
});
it('Should log error when device has no such endpoint (via topic)', async () => {
const device = zigbeeHerdsman.devices.QBKG03LM;
const endpoint2 = device.getEndpoint(2);
+10 -8
View File
@@ -16,6 +16,8 @@ describe('Receive', () => {
jest.useFakeTimers();
controller = new Controller(jest.fn(), jest.fn());
await controller.start();
await jest.runOnlyPendingTimers();
await flushPromises();
});
beforeEach(async () => {
@@ -84,7 +86,7 @@ describe('Receive', () => {
await zigbeeHerdsman.events.message({data: {currentPositionLiftPercentage: 90, currentPositionTiltPercentage: 80}, cluster: 'closuresWindowCovering', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10});
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/J1_cover', stringify({position: 10, tilt: 20}), {retain: false, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/J1_cover', stringify({position: 10, tilt: 20, state: 'OPEN'}), {retain: false, qos: 0}, expect.any(Function));
// Inverted
MQTT.publish.mockClear();
@@ -92,7 +94,7 @@ describe('Receive', () => {
await zigbeeHerdsman.events.message({data: {currentPositionLiftPercentage: 90, currentPositionTiltPercentage: 80}, cluster: 'closuresWindowCovering', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10});
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/J1_cover', stringify({position: 90, tilt: 80}), {retain: false, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/J1_cover', stringify({position: 90, tilt: 80, state: 'OPEN'}), {retain: false, qos: 0}, expect.any(Function));
});
it('Should allow to disable the legacy integration', async () => {
@@ -242,15 +244,15 @@ describe('Receive', () => {
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 1, "retain": false});
});
it('Should handle a zigbee message with voltage 3010', async () => {
it('Should handle a zigbee message with voltage 2990', async () => {
const device = zigbeeHerdsman.devices.WXKG02LM_rev1;
const data = {'65281': {'1': 3010}}
const data = {'65281': {'1': 2990}}
const payload = {data, cluster: 'genBasic', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/button_double_key');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({battery: 46, voltage: 3010});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({battery: 93, voltage: 2990});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
@@ -262,7 +264,7 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/occupancy_sensor');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'battery': 56, 'illuminance': 381, "illuminance_lux": 381, 'voltage': 3045, 'device_temperature': 19, 'power_outage_count': 34});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'battery': 100, 'illuminance': 381, "illuminance_lux": 381, 'voltage': 3045, 'device_temperature': 19, 'power_outage_count': 34});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
@@ -419,7 +421,7 @@ describe('Receive', () => {
const data = {instantaneousDemand:496,currentSummDelivered:[0,6648]}
const SP600_NEW = zigbeeHerdsman.devices.SP600_NEW;
await zigbeeHerdsman.events.message({data, cluster: 'seMetering', device: SP600_NEW, endpoint: SP600_NEW.getEndpoint(1), type: 'attributeReport', linkquality: 10});
await zigbeeHerdsman.events.message({data, cluster: 'seMetering', device: SP600_NEW, endpoint: SP600_NEW.getEndpoint(1), type: 'attributeReport', linkquality: 10, meta: {zclTransactionSequenceNumber: 1}});
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/SP600_NEW');
@@ -427,7 +429,7 @@ describe('Receive', () => {
MQTT.publish.mockClear();
const SP600_OLD = zigbeeHerdsman.devices.SP600_OLD;
await zigbeeHerdsman.events.message({data, cluster: 'seMetering', device: SP600_OLD, endpoint: SP600_OLD.getEndpoint(1), type: 'attributeReport', linkquality: 10});
await zigbeeHerdsman.events.message({data, cluster: 'seMetering', device: SP600_OLD, endpoint: SP600_OLD.getEndpoint(1), type: 'attributeReport', linkquality: 10, meta: {zclTransactionSequenceNumber: 2}});
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/SP600_OLD');
+47 -11
View File
@@ -67,21 +67,41 @@ describe('Settings', () => {
it('Should apply environment variables', () => {
process.env['ZIGBEE2MQTT_CONFIG_SERIAL_DISABLE_LED'] = 'true';
process.env['ZIGBEE2MQTT_CONFIG_ADVANCED_SOFT_RESET_TIMEOUT'] = 1;
process.env['ZIGBEE2MQTT_CONFIG_ADVANCED_OUTPUT'] = 'csvtest';
process.env['ZIGBEE2MQTT_CONFIG_ADVANCED_OUTPUT'] = 'attribute_and_json';
process.env['ZIGBEE2MQTT_CONFIG_ADVANCED_LOG_OUTPUT'] = '["console"]';
process.env['ZIGBEE2MQTT_CONFIG_MAP_OPTIONS_GRAPHVIZ_COLORS_FILL'] = '{"enddevice": "#ff0000", "coordinator": "#00ff00", "router": "#0000ff"}';
process.env['ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC'] = 'testtopic';
process.env['ZIGBEE2MQTT_CONFIG_MQTT_SERVER'] = 'testserver';
process.env['ZIGBEE2MQTT_CONFIG_ADVANCED_NETWORK_KEY'] = 'GENERATE';
process.env['ZIGBEE2MQTT_CONFIG_DEVICES'] = 'devices.yaml';
const contentDevices = {
'0x00158d00018255df': {
friendly_name: '0x00158d00018255df',
retain: false,
},
};
write(configurationFile, {});
write(devicesFile, contentDevices);
expect(settings.validate()).toStrictEqual([]);
const s = settings.get();
const expected = objectAssignDeep.noMutate({}, settings.testing.defaults);
expected.devices = {};
expected.devices = {
'0x00158d00018255df': {
friendly_name: '0x00158d00018255df',
retain: false,
},
};
expected.groups = {};
expected.serial.disable_led = true;
expected.advanced.soft_reset_timeout = 1;
expected.advanced.output = 'csvtest';
expected.advanced.log_output = ["console"];
expected.advanced.output = 'attribute_and_json';
expected.map_options.graphviz.colors.fill = {enddevice: '#ff0000', coordinator: '#00ff00', router: '#0000ff'};
expected.mqtt.base_topic = 'testtopic';
expected.mqtt.server = 'testserver';
expected.advanced.network_key = 'GENERATE';
expect(s).toStrictEqual(expected);
@@ -103,6 +123,22 @@ describe('Settings', () => {
expect(actual).toStrictEqual(expected);
});
it('Should add devices even when devices exist empty', () => {
write(configurationFile, {devices: []});
settings.addDevice('0x12345678');
const actual = read(configurationFile);
const expected = {
devices: {
'0x12345678': {
friendly_name: '0x12345678',
},
},
};
expect(actual).toStrictEqual(expected);
});
it('Should read devices', () => {
const content = {
devices: {
@@ -179,7 +215,7 @@ describe('Settings', () => {
mqtt: {
server: '!secret server',
user: '!secret username',
password: '!secret password',
password: '!secret.yaml password',
},
advanced: {
network_key: '!secret network_key',
@@ -884,7 +920,7 @@ describe('Settings', () => {
it('Frontend config', () => {
write(configurationFile, {...minimalConfig,
frontend: true,
frontend: true,
});
settings.reRead();
@@ -893,7 +929,7 @@ describe('Settings', () => {
it('Baudrate config', () => {
write(configurationFile, {...minimalConfig,
advanced: {baudrate: 20},
advanced: {baudrate: 20},
});
settings.reRead();
@@ -902,7 +938,7 @@ describe('Settings', () => {
it('ikea_ota_use_test_url config', () => {
write(configurationFile, {...minimalConfig,
advanced: {ikea_ota_use_test_url: true},
advanced: {ikea_ota_use_test_url: true},
});
settings.reRead();
@@ -911,7 +947,7 @@ describe('Settings', () => {
it('transmit_power config', () => {
write(configurationFile, {...minimalConfig,
experimental: {transmit_power: 1337},
experimental: {transmit_power: 1337},
});
settings.reRead();
@@ -920,7 +956,7 @@ describe('Settings', () => {
it('output config', () => {
write(configurationFile, {...minimalConfig,
experimental: {output: 'json'},
experimental: {output: 'json'},
});
settings.reRead();
@@ -929,7 +965,7 @@ describe('Settings', () => {
it('Baudrartsctste config', () => {
write(configurationFile, {...minimalConfig,
advanced: {rtscts: true},
advanced: {rtscts: true},
});
settings.reRead();
@@ -938,7 +974,7 @@ describe('Settings', () => {
it('Deprecated: Home Assistant config', () => {
write(configurationFile, {...minimalConfig,
homeassistant: {discovery_topic: 'new'},
homeassistant: {discovery_topic: 'new'},
advanced: {homeassistant_discovery_topic: 'old', homeassistant_status_topic: 'olds'},
});
+17
View File
@@ -153,6 +153,23 @@ function writeDefaultConfiguration() {
'0x0017880104e43559': {
friendly_name: 'U202DST600ZB'
},
'0xf4ce368a38be56a1': {
retain: false,
friendly_name: 'zigfred_plus',
front_surface_enabled: 'true',
dimmer_1_enabled: 'true',
dimmer_1_dimming_enabled: 'true',
dimmer_2_enabled: 'true',
dimmer_2_dimming_enabled: 'true',
dimmer_3_enabled: 'true',
dimmer_3_dimming_enabled: 'true',
dimmer_4_enabled: 'true',
dimmer_4_dimming_enabled: 'true',
cover_1_enabled: 'true',
cover_1_tilt_enabled: 'true',
cover_2_enabled: 'true',
cover_2_tilt_enabled: 'true',
},
'0x0017880104e44559': {
friendly_name: '3157100_thermostat',
},
+4 -1
View File
@@ -137,6 +137,7 @@ const TS0601_thermostat = new Device('EndDevice', '0x0017882104a44559', 6544,41
const ZNCZ02LM = new Device('Router', '0x0017880104e45524', 6540,4151, [new Endpoint(1, [0], [], '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');
const groups = {
'group_1': new Group(1, []),
@@ -192,6 +193,7 @@ const devices = {
'MKS-CM-W5': new Device('Router', '0x90fd9ffffe4b64ac', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {})], true, "Mains (single phase)", "qnazj70", false),
'GL-S-007ZS': new Device('Router', '0x0017880104e45526', 6540,4151, [new Endpoint(1, [0], [], '0x0017880104e45526')], true, "Mains (single phase)", 'GL-S-007ZS'),
'U202DST600ZB': new Device('Router', '0x0017880104e43559', 6540,4151, [new Endpoint(10, [0, 6], [], '0x0017880104e43559'), new Endpoint(11, [0, 6], [], '0x0017880104e43559')], true, "Mains (single phase)", 'U202DST600ZB'),
'zigfred_plus': zigfred_plus,
'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,
@@ -201,7 +203,7 @@ const devices = {
'temperature_sensor': new Device('EndDevice', '0x0017880104e45561', 6544,4151, [new Endpoint(1, [0,3,4,1026], [])], true, "Battery", "temperature.sensor"),
'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'),
}
const mock = {
@@ -214,6 +216,7 @@ const mock = {
backup: jest.fn(),
isStopping: jest.fn(),
permitJoin: jest.fn(),
addInstallCode: jest.fn(),
getCoordinatorVersion: jest.fn().mockReturnValue({type: 'z-Stack', meta: {version: 1, revision: 20190425}}),
getNetworkParameters: jest.fn().mockReturnValue({panID: 0x162a, extendedPanID: [0, 11, 22], channel: 15}),
on: (type, handler) => {