Compare commits

..
342 Commits
Author SHA1 Message Date
Koenkk ae41b7bc43 Push correct docker tags. 2018-07-03 19:17:47 +02:00
Koenkk 50b12a757c Fix docker.sh 2018-07-03 19:11:20 +02:00
Koenkk 9e933ea1ab Debug docker.sh 2018-07-03 19:07:15 +02:00
Koenkk 713263c428 Run with bash. 2018-07-03 19:04:21 +02:00
Koenkk 74e7c7d73a 0.1.0 2018-07-03 18:57:39 +02:00
Koenkk bf2d733c0e Add .npmrc 2018-07-03 18:57:36 +02:00
Koenkk 6be6472fa3 Prepare for v0.1 2018-07-03 18:22:45 +02:00
Koenkk 7cec5f2d96 Update zigbee-shepherd-converters to 2.0.20. 2018-06-30 23:47:51 +02:00
Koen Kanters ca59993863 Merge pull request #168 from matchett808/feat/home-assistant-config-for-nanoleaf-bulb
feat: home assistant nanoleaf mapping
2018-06-30 23:44:12 +02:00
Koen Kanters c1f9f630b1 Merge branch 'master' into feat/home-assistant-config-for-nanoleaf-bulb 2018-06-30 23:38:49 +02:00
iain fef68c122f feat: home assistant nanoleaf mapping 2018-06-30 18:56:13 +01:00
Koenkk 8f45de6a3f Stale bot use stale label. 2018-06-30 09:55:13 +02:00
Koenkk a15dcf8345 Add stale bot. 2018-06-30 09:54:23 +02:00
Koenkk f2ec895ec0 Update zigbee-shepherd-converters to 2.0.19. https://github.com/Koenkk/zigbee2mqtt/issues/154#issuecomment-401495951 2018-06-30 09:48:21 +02:00
Koenkk 52c51b687d And instructions on how to (soft) reset stick. #156 2018-06-28 19:49:16 +02:00
Koenkk a1cb4ca214 Update zigbee-shepherd-converters to 2.0.18. 2018-06-27 21:31:00 +02:00
Koen Kanters 2ba2864f87 Merge pull request #152 from Koenkk/issue_138
Homeassistant: dont set unique_id when friendlyName set. #138
2018-06-26 21:36:14 +02:00
Koen Kanters 420171e060 Add '9290011370' to homeassistant.js 2018-06-25 22:06:11 +02:00
Koenkk 8a2e9075bf Update zigbee-shepherd-converters to 2.0.17. 2018-06-25 22:00:43 +02:00
Koenkk 4f7328fe60 Update zigbee-shepherd-converters to 2.0.16. 2018-06-25 20:19:23 +02:00
Koenkk f03ade2775 Don't log 'Connecting with device' when device is already known. 2018-06-25 20:18:50 +02:00
Koenkk 094c288c3c Update zigbee-shepherd-converters. #142 2018-06-24 19:40:43 +02:00
Koenkk 19f6d5f72a Homeassistant: dont set unique_id when friendlyName set. #138 2018-06-24 14:21:56 +02:00
Koen Kanters 01a26adefd Merge pull request #137 from keesschollaart81/patch-2
Show why we have an error during initialization
2018-06-21 20:24:57 +02:00
Kees Schollaart a43e3969ed Show why we have an error during initialization 2018-06-21 20:11:08 +02:00
Koenkk 9dbdfc0a2e Set send cached state for home assistant to 20 seconds. #105 2018-06-20 22:02:29 +02:00
Koenkk bf6cc8fee3 Update zigbee-shepherd-converters. 2018-06-20 21:10:09 +02:00
Koenkk 7d2474060a Update zigbee-shepherd-converters. 2018-06-20 20:17:42 +02:00
Koenkk 4c4fcd7216 Update zigbee-shepherd-converters. 2018-06-17 17:15:43 +02:00
Koenkk 8bd08910a4 Docker write hash to correct file. 2018-06-17 16:38:11 +02:00
Koenkk 6985ee1b6e Fix arm32v6 Dockerfile 2018-06-17 11:40:59 +02:00
Koenkk 026fb1bd78 Fix homeassistant docgen, set command_topic_prefix in command_topic. #117 2018-06-17 01:35:44 +02:00
Koenkk b5a3fa67d9 Fix commit variable arm docker images. 2018-06-16 22:53:33 +02:00
Koenkk d980d0abcc Update zigbee-shepherd-converters. 2018-06-16 22:17:01 +02:00
Koenkk 0d6c001f2c Fix report on/off for devices with multiple states (e.g. state_left/state_right). #117 2018-06-16 20:38:44 +02:00
Koenkk 95db22e12b Update zigbee-shepherd-converters. 2018-06-16 01:43:51 +02:00
Koenkk 9f120826c1 Dockerfile fix quotes. 2018-06-16 01:32:54 +02:00
Koenkk 885f50839c Docker build fix exec format error. 2018-06-16 01:15:35 +02:00
Koenkk d1993e81da Travis: don't push hassio images. 2018-06-16 01:08:57 +02:00
Koenkk df99c7edf5 Log zigbee message data on one line. 2018-06-16 01:04:32 +02:00
Koen Kanters c372618eac Merge pull request #125 from ciotlosm/add_version_support
Add support for version numbers and hash
2018-06-16 00:15:36 +02:00
Koenkk deab0004f2 Set version to 0.0.0 2018-06-16 00:12:38 +02:00
Koenkk d69111f577 Add .hash.json for Docker. 2018-06-16 00:10:08 +02:00
Koenkk 96191a2836 Update log version on startup 2018-06-15 17:49:15 +02:00
Koen Kanters c6592029ea Merge pull request #123 from ciotlosm/allow_port_speed
Port speed for cc2530 models
2018-06-15 17:17:56 +02:00
Marius Ciotlos b6aabcca64 Add support for version numbers and hash 2018-06-15 14:02:40 +03:00
Marius Ciotlos 01effab24c Fixes #97 2018-06-14 22:48:25 +03:00
Koen Kanters 3591f4f976 Merge pull request #110 from ciotlosm/add_log_level
Added loging level through mqtt
2018-06-14 20:31:25 +02:00
Koenkk ae9f071ffc Update logger.js 2018-06-14 20:27:43 +02:00
Koenkk b12d868866 Update npm-shrinkwrap.json 2018-06-14 20:27:29 +02:00
Marius Ciotlos 949d236697 Removed dependency 2018-06-14 20:11:08 +02:00
Marius Ciotlos 4cb98b6257 Added debug for mqtt message as well 2018-06-14 20:11:08 +02:00
Marius Ciotlos 7fe9d6731a Force debug on logger if DEBUG is set 2018-06-14 20:09:43 +02:00
Marius Ciotlos 15fca170ad Fixed travis error from lint 2018-06-14 20:09:43 +02:00
Marius Ciotlos 2071b0f69f Added possibility to update log_level from configuration 2018-06-14 20:09:43 +02:00
Marius Ciotlos 2b4fc21585 Updated debug and moved message to info 2018-06-14 20:09:43 +02:00
Marius Ciotlos f40de00d32 Rollback of debug as it doesn't cover dependencies this way 2018-06-14 20:09:43 +02:00
Marius Ciotlos 1d49f349b9 Added message data logging in debug mode 2018-06-14 20:09:43 +02:00
Marius Ciotlos e29d5f70ae Added allowed levels when setting level fails 2018-06-14 20:09:43 +02:00
Marius Ciotlos dc5a090d44 Corrections @c727 suggestions 2018-06-14 20:09:43 +02:00
Marius Ciotlos 06142115af Fixed lint problems 2018-06-14 20:09:43 +02:00
Marius Ciotlos c1b597c02f Added loging level through mqtt 2018-06-14 20:09:43 +02:00
Koenkk 744444ceb9 logger.debug incoming MQTT messages. #105 #110 2018-06-14 20:06:35 +02:00
Koenkk 7a13626da7 Fix crash on MQTT message device model not known. 2018-06-14 20:00:57 +02:00
Koenkk d86aa10875 Xiaomi devices: check if exsist. #116 2018-06-14 18:19:54 +02:00
Koenkk 85e86dbdc2 Fix homeassistant docgen. 2018-06-14 18:14:58 +02:00
Koenkk b0cdcf2e21 Update docgen for homeassistant. 2018-06-13 20:28:35 +02:00
Koenkk b3108a26d0 Update zigbee-shepherd-converters to 2.0.6. 2018-06-13 20:23:26 +02:00
Koenkk 3196c0a974 Send all cached status on hass/status:online. #105 2018-06-13 19:51:40 +02:00
Koenkk 7041637e5b Update zigbee-shepherd-converters to 2.0.5. 2018-06-12 21:02:24 +02:00
Koen Kanters 501b9652b8 Add ciotlosm to contributors 2018-06-11 20:40:14 +02:00
Koenkk 3c062a330d Resend cached states on MQTT reconnect. #105 2018-06-11 20:31:05 +02:00
Koenkk cd13286ca7 Homeassisant: rediscover devices on MQTT reconnect. #105 2018-06-11 20:20:18 +02:00
Koen Kanters b7252379b9 Merge pull request #99 from ciotlosm/add_device_remove
Add device remove
2018-06-10 17:41:25 +02:00
Koenkk cbc1b3ab39 removed_device -> device_removed 2018-06-10 17:37:16 +02:00
Koenkk db0d8c1cdd Best effort remove device 2018-06-10 17:35:14 +02:00
Koenkk 3b1b9db992 Update dependencies 2018-06-10 08:05:50 +02:00
Koenkk 7bf5b2fd76 Update dependencies 2018-06-09 18:19:50 +02:00
Koen Kanters e7ba350770 Use forked zcl-packet. 2018-06-09 18:19:15 +02:00
Koenkk 884e3aa475 Refactor remove device & remove from home assistant 2018-06-09 12:33:40 +02:00
Koenkk aec871cd27 Add zcl-packet dependency 2018-06-09 11:29:28 +02:00
Koenkk 7d706b8ff4 Update dependencies 2018-06-08 20:43:49 +02:00
Koenkk 63c0a962ae Add ICTC-G-1 homeassistant mapping. 2018-06-08 20:34:34 +02:00
Koenkk cf3775e0b8 Update zigbee-shepherd-converters to 2.0.0. 2018-06-08 20:20:35 +02:00
Marius Ciotlos 7c53e9bb15 Added settings removal and bug fixes 2018-06-07 20:41:11 +03:00
Marius Ciotlos 9bc87b765a Formatting 2018-06-06 22:19:50 +03:00
Marius Ciotlos 0f2f7462a5 Added force remove 2018-06-06 22:13:32 +03:00
tb-killa 34feef6cf4 Update controller.js
ADD "remove" MQTT Topic with "message" - Check
2018-06-06 21:45:36 +03:00
tb-killa 0328ad7cb6 Update zigbee.js
Add "removedevice" Function into zigbee.js
2018-06-06 21:45:36 +03:00
Koen Kanters ca27f9faf2 Add homeassistant mappings 2018-06-05 20:27:36 +02:00
Koenkk 125f15b61f Update dependencies 2018-06-05 20:22:44 +02:00
Koen Kanters fb1feca3ca Merge pull request #95 from ciotlosm/master
Added unique id for easier renaming of sensors in HA
2018-06-05 00:32:54 +02:00
Marius Ciotlos 584a5f1b19 Added unique id for easier renamig of sensors in HA 2018-06-04 23:05:34 +03:00
Koenkk a976c1db93 Update zigbee-shepherd-converters to 1.0.1. #36 #62 2018-06-04 21:36:51 +02:00
Koenkk eae8a80588 Update zigbee-shepherd-converters to 1.0.0. 2018-06-04 20:03:53 +02:00
Koenkk bb9b6dd550 Update zigbee-shepherd-converters to 0.2.0. 2018-06-04 19:23:23 +02:00
Koen Kanters d15cbe0a29 Merge pull request #94 from ciotlosm/master
Spell check
2018-06-04 18:26:19 +02:00
Marius Ciotlos 324180c292 Spell check :( 2018-06-04 19:24:26 +03:00
Koen Kanters d243f08f17 Merge pull request #93 from ciotlosm/master
Improved getting started
2018-06-04 18:23:21 +02:00
Marius Ciotlos 977d26eeda Improved getting started
Added terminology
2018-06-04 19:17:01 +03:00
Koenkk b7c525de65 Increase recovery timeout. #79 2018-06-04 17:36:46 +02:00
Koen Kanters 49685cb681 Fix typo in docgen.js 2018-06-04 17:26:59 +02:00
Koen Kanters 7334d50fbf Merge pull request #91 from ciotlosm/master
Updated documentation
2018-06-04 17:25:55 +02:00
Koen Kanters eab7665726 Update README.md 2018-06-04 17:25:39 +02:00
Koen Kanters 54342f6fe9 Update README.md 2018-06-04 17:23:47 +02:00
Marius Ciotlos 95f9bc2535 Updated documentation 2018-06-04 14:46:24 +03:00
Koen Kanters b5661d297b Merge pull request #89 from keesschollaart81/patch-1
Mention the hassio addon
2018-06-04 08:01:11 +02:00
Kees Schollaart 4fee0ff501 Mention the hassio addon
I did not know about the hassio addon for this project and it's not mention anywhere other than in a closed issue so I thought it made sense to reference it here.
2018-06-03 15:09:50 +02:00
Koenkk 8ada85e1ce Log to MQTT when pairing with device. #85 2018-06-03 00:50:30 +02:00
Koenkk a8dca627d9 Allow spaces in MQTT device commands (for friendly names with spaces in it). #86 2018-06-03 00:42:15 +02:00
Koenkk 95f21947fc Update zigbee-shepherd-converters 2018-06-02 19:56:52 +02:00
Koenkk ab64d079aa Don't mutate stateCache. #82 2018-06-02 19:11:49 +02:00
Koenkk 898081fcb4 Remove firmware. #83 2018-06-01 23:54:57 +02:00
Koenkk 993908eb19 Update zigbee-shepherd-converters to 0.1.11 2018-06-01 22:05:49 +02:00
Koenkk f0b19cc696 Try to recover in zigbee-shepherd start failure. #79 2018-06-01 21:04:48 +02:00
Koenkk 811cf2943f Allow DEBUG in Docker. #70 2018-06-01 19:29:03 +02:00
Koenkk 3377853dab Update zigbee-shepherd-converters to 0.1.10. 2018-05-31 19:21:31 +02:00
Koenkk d6c7e75e22 Trigger danielwelch/hassio-zigbee2mqtt rebuild. https://github.com/danielwelch/hassio-zigbee2mqtt/issues/19 2018-05-31 19:11:28 +02:00
Koenkk ffa6012079 Support light transitions. #72 2018-05-30 22:28:08 +02:00
Koenkk 7b2763a053 Log devices to bridge/log. #77 2018-05-30 18:09:24 +02:00
Koenkk 77f344198c MQTT publish log message when new device connects. #77 2018-05-30 18:00:08 +02:00
Koenkk 6d73dd143c Add endpoint to request connected devices. #77 2018-05-30 17:52:46 +02:00
Koenkk 625b6c51d8 Update zigbee-shepherd-converters to 0.1.7 2018-05-29 19:12:45 +02:00
Koenkk 9396bde1f3 Add cache_state option to configuration.yaml. #70 2018-05-28 21:10:58 +02:00
Koenkk ae01f30f71 Log device type on startup. #26 2018-05-28 20:40:30 +02:00
Koenkk b8fb13043b Add AB3257001NJ. #62 2018-05-28 20:01:28 +02:00
Koenkk 2d7a6ecaf3 homeassistant discovery: fix crash when not in configuration.yaml. #63 2018-05-28 19:41:27 +02:00
Koenkk 7801493a7a Update zigbee-shepherd-converters to 0.1.5. #71 2018-05-28 19:33:29 +02:00
Koenkk 5666a59524 Add Hive active light bulb (HALIGHTDIMWWE27). #68 2018-05-27 17:16:01 +02:00
Koenkk 995649d0da Update zigbee-shepherd-converters to 0.1.3 2018-05-26 16:12:11 +02:00
Koenkk fd894a9ce3 Add homeassistant configuration for AA70155 and AA69697 2018-05-26 11:00:56 +02:00
Koenkk 9c249328e3 Update zigbee-shepherd-converters to 0.1.2. 2018-05-26 10:58:38 +02:00
Koenkk 0bc6cf7a69 Update zcl-packet. #42 2018-05-25 19:51:05 +02:00
Koenkk 08f3f96d73 Use js-yaml as yaml parser instead of yawn-yaml. #64 2018-05-25 16:42:29 +02:00
Koenkk 312ed033db Dont add advanced configuration by default. 2018-05-24 20:19:04 +02:00
Koenkk fb27bd292f Use zigbee-shepherd-converters. #45 2018-05-24 13:09:58 +02:00
Koenkk 06f6329241 Docgen: replace all instances. 2018-05-24 12:50:54 +02:00
Koenkk 92d0e44184 Update docgen. 2018-05-24 12:36:26 +02:00
Koenkk ad4f77b5ce Link to How to support new devices page. 2018-05-24 12:09:36 +02:00
Koenkk f25e6a50b9 Refactor mqtt2zigbee to toZigbee and add convertes move devices. #45 2018-05-23 18:23:51 +02:00
Koenkk 5be2c412c1 Parsers -> converters. 2018-05-23 17:57:45 +02:00
Koenkk 3fdfc6f57f Move converters to devices.js. #45 2018-05-23 17:55:30 +02:00
Koenkk bc4dff65ff Remove disableCache. #45 2018-05-22 19:10:16 +02:00
Koenkk bcbe3eb075 Update docs 2018-05-22 18:25:09 +02:00
Diogo Gomes 567bdca276 Edp redy - Power Plug (#53)
* fixed json

* added mqtt commands

* added endpoints

* support battery status

* added firmware for CC2531 USB Stick with maximum number of possible devices (48)

* support aqara magnet

* added support for wall switch

* update regex

* Update README.md

* added automatic chip selection

* fix reconnect

* Update README.md

* added missing dependency

* fix magnets

* fix topic

* support for aqara button

* yaml based configuration

* restore project defaults

* save bridgeID

* default values

Don’t change the configured bridgeID (backward compatible with bridgeID
= “bridge”)

* personal configuration

* added EDP RE:DY

* don't mess remote

* don't mess remote

* don't mess remote

* fix

* clean

* lint

* generic

* lint

* Update devices.js

* Update zigbee2mqtt.js

* lint

* Refactor configure reports.

* Fix lint.
2018-05-21 13:21:18 +02:00
Koen Kanters b912386786 Merge pull request #50 from ptvoinfo/master
Some improvements
2018-05-21 12:03:36 +02:00
Koenkk b38eb76274 Change comment in controller.js 2018-05-21 12:00:35 +02:00
Koenkk 02818ddaf5 Refactor softResetTimeout 2018-05-21 11:59:01 +02:00
Koenkk 78c4f43496 Update controller.js 2018-05-21 11:52:16 +02:00
Koenkk 26f378237f Update sensor_power. 2018-05-21 11:50:14 +02:00
Koenkk f886259f92 Refactor controller.js. 2018-05-21 11:49:02 +02:00
Koenkk 2f607c4cad Support LED1536G5 E12 version. #57 2018-05-21 11:17:28 +02:00
Koenkk 1b111c1250 Support LED1622G12. #56 2018-05-21 11:11:24 +02:00
Koenkk f58b0fa4f2 Add voltage to homeassisant power sensor. 2018-05-17 18:41:03 +02:00
Koenkk 8207321c30 Update ZNCZ02LM converters. 2018-05-17 18:33:32 +02:00
Koenkk 7f5865aaf9 Update lumi.router device specification. 2018-05-17 18:03:54 +02:00
Koenkk 0fdec7c225 Refactor zigbee.js 2018-05-17 17:48:41 +02:00
ptvoinfo 55a1709103 Added polling for routers (prevents deep sleep mode of Xiaomi routers)
Added more parsers for Xiaomi Power Plug
Added a custom router
2018-05-17 17:39:01 +02:00
Koenkk c5cb60e998 Enforce code style. #45 2018-05-17 17:20:46 +02:00
Koenkk 5a95e2fc8c Add 'WXKG02LM' and 'WXKG03LM' to battery parser. #43 2018-05-16 20:21:22 +02:00
Koenkk f750bb34f9 Support JTYJ-GD-01LM/BW. #4 2018-05-16 20:15:50 +02:00
Koenkk 5ee79b28d9 Add homeassistant configuration for F7C033. #40 2018-05-16 19:52:44 +02:00
Koenkk a70bccd2b6 Update .tavis.yml 2018-05-16 19:50:13 +02:00
Koenkk efd2fba1b5 Support Belkin WeMo smart LED bulb (F7C033). #40 2018-05-16 19:44:38 +02:00
Koenkk 9d82ad32d0 battery -> battery3V. #45 2018-05-16 19:40:21 +02:00
Koenkk 8559ea2301 Refactor homeassistant configuration out of devices.js. #45 2018-05-16 19:40:05 +02:00
Koenkk ca40cf622a Move logging devices on startup to controller.js. #45 2018-05-16 19:29:47 +02:00
Koenkk e3c9448656 cId -> cid. #45 2018-05-16 19:22:47 +02:00
Koenkk 2521af7d78 Allow device specific QoS configuration. #47 2018-05-15 18:42:26 +02:00
Koenkk debc96c232 Allow to set device specific occupancy_timeout. #27 2018-05-15 18:06:16 +02:00
Koenkk 17aba009af Set default occupancy timeout to 60 seconds. #27 2018-05-15 18:00:06 +02:00
Koenkk ff61f24b74 Make panID configurable. #34 2018-05-12 15:54:02 +02:00
Koen Kanters 604fa925e4 Merge pull request #39 from danielwelch/master
configure datapath with env variable
2018-05-12 15:31:23 +02:00
Koenkk b01b1a07bb Add support for TRADFRI bulb E27 W opal 1000lm. #21 2018-05-12 15:05:18 +02:00
Koenkk 44002ed1c3 Update configure data path code 2018-05-12 10:58:06 +02:00
Koen Kanters d3f271f984 Update description of LED1536G5 2018-05-12 09:21:36 +02:00
Daniel Welch d0306aedea missing semicolon 2018-05-11 23:16:37 -04:00
Daniel Welch 03123fb783 configure datapath with env variable 2018-05-11 23:04:15 -04:00
Koen Kanters d583a61c9f Merge pull request #37 from marcusaram/led1536g5-2
Add support for IKEA TRADFRI bulb E14 WS opal 400lm
2018-05-11 20:39:50 +02:00
Marcus Aram 8d0623f24e Add support for IKEA TRADFRI bulb E14 WS opal 400lm 2018-05-11 20:19:47 +02:00
Koenkk 0d92109323 Fix docgen 2018-05-11 20:05:33 +02:00
Koenkk aa08151049 Merge branch 'dev' 2018-05-11 19:40:19 +02:00
Koenkk 1efe6867ed Prepare for merge to master. 2018-05-11 19:36:43 +02:00
Koenkk e01a4ec5b2 Update documentation for Home Assistant integration. #21. 2018-05-11 19:20:32 +02:00
Koenkk 1a688cf363 Add disableCache option and remove disablePublish option for converters. #32 2018-05-11 19:14:18 +02:00
Koen Kanters 624f1ced68 Merge pull request #23 from ciotlosm/add_cube
Added xiaomi cube
2018-05-11 19:03:24 +02:00
Marius Ciotlos 54f3843a03 Fixed TODO in devices.js 2018-05-11 09:25:33 +03:00
Marius Ciotlos 8b8604dbf4 Add battery support for cube 2018-05-10 11:36:21 +03:00
Koenkk 02a747066a Move MFKZQ01LM ignore parsers to end. 2018-05-10 11:34:56 +03:00
Koenkk c8df9747ad Refactor MFKZQ01LM converters to use homeassistant.sensor_action 2018-05-10 11:34:56 +03:00
Koenkk b41cacd992 Add homeassistant sensor_action 2018-05-10 11:34:56 +03:00
Marius Ciotlos 06fb89da3a Added credits and corrected comment to reflect code 2018-05-10 11:34:56 +03:00
Marius Ciotlos 50103e381c Added xiaomi cube 2018-05-10 11:34:56 +03:00
Koen Kanters 080feddf28 Merge pull request #30 from marcusaram/led1650r5
Add support for IKEA TRADFRI bulb GU10 W 400lm
2018-05-10 09:37:06 +02:00
Marcus Aram 4e214a0686 Support for IKEA TRADFRI bulb GU10 W 400lm 2018-05-10 09:25:33 +02:00
Koenkk 80149c3579 Travis: push hass.io addon images. #22 2018-05-09 22:56:18 +02:00
Koenkk 896a7a097c Use alpine as base image. #22 2018-05-09 22:15:59 +02:00
Koenkk 41ad606137 Use @oskarn97 CC2531 firmware which support upto 48 devices. #26 2018-05-08 20:51:01 +02:00
Koenkk 4fc4c7b83a Add ssIasZone parser for SJCGQ11LM to directly detect water_leak. #17 2018-05-08 20:47:33 +02:00
Koenkk 8436768dc0 Use @kirovilya zigbee-shepherd fork. #17 2018-05-08 20:46:52 +02:00
Koenkk beb2c5efb0 Rename sensor_button to sensor_click to keep naming for sensors consistent. #23 2018-05-08 20:13:01 +02:00
Koenkk b3257c714a Add debug logging for incoming zigbee messages. #25 2018-05-08 19:57:50 +02:00
Koenkk 6b1570b259 Docker ignore more files. #22 2018-05-07 17:46:58 +02:00
Koenkk e371fcae30 Use nodejs 8 (LTS) because nodejs 10 is not supported. 2018-05-07 17:35:26 +02:00
Koenkk 8523aa61b0 Support LED1623G12. #21 2018-05-06 18:08:10 +02:00
Koenkk 8ad1d49870 Also log to file. #16 2018-05-04 23:01:02 +02:00
Koenkk f55ec62c6c Update README.md 2018-05-01 19:18:34 +02:00
Koenkk 254c0e9fa5 Link to How to support new devices. 2018-05-01 18:51:38 +02:00
Koenkk 17cb59b958 Support QBKG03LM. #4 2018-04-29 14:09:49 +02:00
Koenkk 78b0e00d14 Support QBKG04LM. #4 2018-04-27 23:58:46 +02:00
Koenkk 0ee1d27099 Support QBCZ11LM. #4 2018-04-27 14:10:13 +02:00
Koenkk ce370750c0 Swap badge 2018-04-26 21:15:13 +02:00
Koenkk f36a23ce7b Fix .travis/wiki.sh when there are no updates 2018-04-26 20:54:36 +02:00
Koen Kanters 640ce11e34 Travis set docker username. 2018-04-26 20:41:08 +02:00
Koen Kanters 03af9da97d Travis build docker images. 2018-04-26 20:35:07 +02:00
Koen Kanters 97bca73ba2 Travis now updates wiki automatically! :) 2018-04-26 20:02:14 +02:00
Koen Kanters 5d41c97655 Travis: commit stuff. 2018-04-26 20:00:23 +02:00
Koen Kanters 305fb70d78 Update travis 2018-04-26 19:56:00 +02:00
Koen Kanters 0a9f2d497a Update travis and check if it works. 2018-04-26 19:51:55 +02:00
Koen Kanters 6a90937cfa Improve travis 2018-04-26 19:46:00 +02:00
Koen Kanters 0bac4ba9bf Travis for generating wiki. 2018-04-26 19:40:44 +02:00
Koen Kanters 975bc741e2 Dockerize. #5 2018-04-26 19:37:07 +02:00
Koen Kanters c3ca0249c4 Improve color temp/xy and brightness level feedback. 2018-04-25 22:01:53 +02:00
Koen Kanters bc1e3d68f9 lightingColorCtrl parser support currentX/Y 2018-04-25 21:50:41 +02:00
Koen Kanters 875ca536e0 Fix homeassistant discover crash when device undefined. 2018-04-25 21:34:26 +02:00
Koen Kanters a13080f399 Refactor & remove home assistant pair switch discovery. 2018-04-25 20:54:41 +02:00
Koen Kanters d20012e4d8 Update docgen. 2018-04-25 19:41:20 +02:00
Koen Kanters 87fb513758 Simplify YAML configuration. 2018-04-25 19:29:03 +02:00
Koen Kanters 3322d6cb20 Allow settings permit_join via home assistant switch. 2018-04-24 19:30:56 +02:00
Koen Kanters e0feacea0b Improve MQTT switch support. 2018-04-24 19:03:09 +02:00
Koen Kanters 8673fa27e2 Improve naming of configuration 2018-04-24 18:04:36 +02:00
Koen Kanters 97f54facde Update docgen. 2018-04-23 22:41:33 +02:00
Koen Kanters df797617f5 Move planned to support to issue #4 2018-04-23 22:39:24 +02:00
Koen Kanters 7a6cc080d4 Support ZNCZ02LM. #4 2018-04-23 22:36:30 +02:00
Koen Kanters 1543373b7f Improve support current supported devices. 2018-04-23 21:44:06 +02:00
Koen Kanters 59f16f76f1 Refactor devices.js 2018-04-23 18:29:35 +02:00
Koen Kanters 500bce2418 Perform home assistant MQTT discovery on startup. 2018-04-23 18:17:47 +02:00
Koen Kanters 41b2fb3fc9 Emojis! 2018-04-23 18:00:49 +02:00
Koen Kanters df819e3318 Add architecture 2018-04-23 17:55:44 +02:00
Koen Kanters b29a5a9c1b Support WXKG03LM. #4 2018-04-22 21:36:04 +02:00
Koen Kanters b80d16c4b3 Support SJCGQ11LM. #4 2018-04-22 21:23:35 +02:00
Koen Kanters 8109bf68e7 Add home assistant MQTT discovery for missing devices. #9 2018-04-21 23:05:53 +02:00
Koen Kanters f584b5dcca Add respond to button clicks example. 2018-04-21 23:01:52 +02:00
Koen Kanters 2e20798aef Fix command_topic 2018-04-21 22:46:52 +02:00
Koen Kanters 1319f8087c Docgen update for home assistant discovery. #9 2018-04-21 22:41:27 +02:00
Koen Kanters 2e579b66ad Docgen specify directory. 2018-04-21 19:19:51 +02:00
Koen Kanters d71fadd73f Homeassistant discovery for WXKG11LM. #9 2018-04-21 18:14:34 +02:00
Koen Kanters 5fa8ce9913 Support LED1535R6 2018-04-21 17:51:38 +02:00
Koen Kanters 4d3d15f5b9 Support WXKG02LM. #4 2018-04-21 13:01:57 +02:00
Koen Kanters 5b52defe9e Add more logging 2018-04-21 12:45:22 +02:00
Koen Kanters fc9a0be1e9 Support WSDCGQ11LM. #4 2018-04-21 12:20:47 +02:00
Koen Kanters 65ad81a7b6 Support discovering multiple homeassistant sensors of same type. #9 2018-04-21 12:15:00 +02:00
Koen Kanters 79d405afe9 Support RTCGQ11LM. #4 2018-04-21 09:14:18 +02:00
Koen Kanters bc3fca9d68 Homeassistant discovery: allow multiple homeassistant sensor/devics per device. #9 2018-04-21 09:13:14 +02:00
Koen Kanters 14f14e909d Hue go rgb -> xy 2018-04-21 00:16:50 +02:00
Koen Kanters 679182d2d4 Update header. #8 2018-04-21 00:10:20 +02:00
Koen Kanters 823a9ea248 Support light devices MQTT discovery. #9 2018-04-20 23:58:03 +02:00
Koen Kanters aebce9099b Support settings colors. #7 2018-04-20 23:40:17 +02:00
Koen Kanters e6e558eae7 Improve homeassistant discovery. #8 2018-04-20 23:39:20 +02:00
Koen Kanters b9552f8ab3 Support homeassistant discovery for MCCGQ11LM. #9 2018-04-20 19:54:12 +02:00
Koen Kanters 7cd8e74a7e Implement homeasisstant MQTT discovery. #9 2018-04-20 19:53:40 +02:00
Koen Kanters f9860f5b9d Dont handle messages without cid. 2018-04-19 23:15:09 +02:00
Koen Kanters 21575673b3 Support MCCGQ11LM. #4 2018-04-19 23:00:07 +02:00
Koen Kanters 6499b78108 Move WXKG11LM 2018-04-19 22:46:59 +02:00
Koen Kanters c49b3f4ae3 Support WXKG11LM. #4 2018-04-19 22:45:53 +02:00
Koen Kanters 3133cb7dae Docgen: log per vendor. 2018-04-18 22:27:44 +02:00
Koen Kanters eb063efeb4 Update Hue Go documentation. #7 2018-04-18 22:17:03 +02:00
Koen Kanters 0771e2c5a0 Support Hue Go. #7 2018-04-18 22:11:00 +02:00
Koen Kanters 69736a883e Use device retain setting. 2018-04-18 22:07:18 +02:00
Koen Kanters 31c6d794a9 Select endpoint dynamically needed for Hue support. #7 2018-04-18 21:57:39 +02:00
Koen Kanters 90cc4ad0e1 Improve robustness. 2018-04-18 21:55:00 +02:00
Koen Kanters 3b068daa12 Log vendor on startup. 2018-04-18 21:01:42 +02:00
Koen Kanters 3b317535d3 Fixes & improvements. #8 2018-04-18 20:53:22 +02:00
Koen Kanters dec470fb51 Add eslint & fixes. #8 2018-04-18 19:10:33 +02:00
Koen Kanters 3872d58561 Update README.md 2018-04-18 18:48:35 +02:00
Koenkk abe9655bc1 Update package.json 2018-04-18 18:42:38 +02:00
Koen Kanters d06522d488 Refactor and rename. #8 2018-04-18 18:26:13 +02:00
Koen Kanters bc52e11693 Dimming -> brightness for TRADFRI bulb. 2018-04-16 21:57:40 +02:00
Koen Kanters 0a73511609 Make parser type specific. 2018-04-16 21:49:25 +02:00
Koen Kanters 7057b2f9d7 Support tradfri light bulbs. 2018-04-16 21:41:24 +02:00
Koen Kanters 49f37047cc Return if device is not supported. 2018-04-16 20:08:38 +02:00
Koen Kanters dd6d6cd407 Cache all states. 2018-04-15 21:52:58 +02:00
Koen Kanters 8d9911b4b5 Move mqtt bridge state. 2018-04-15 21:23:49 +02:00
Koen Kanters fa61d17f0b Better battery status parsing. 2018-04-15 01:26:04 +02:00
Koen Kanters 8356fda183 Make retain device specific. 2018-04-15 01:14:43 +02:00
Koen Kanters 39600b394e Switch to json based messages. 2018-04-15 01:11:37 +02:00
Koen Kanters 905feb3701 Add option to retain MQTT messages. 2018-04-14 19:20:34 +02:00
Koen Kanters 6290f6beec Move arm32v7 Docker. 2018-04-14 15:25:57 +00:00
Koen Kanters 6c8f1733d4 Rename dockerfile. 2018-04-14 17:00:05 +02:00
Koen Kanters fbb6b27b44 Add arm32v7 docker. 2018-04-14 16:56:28 +02:00
Koen Kanters d7031d259b Use winston logger. 2018-04-14 16:17:25 +02:00
Koen Kanters 4c2948145a Support battery level. #3 2018-04-14 15:46:36 +02:00
Koen Kanters 5c8da2d36a Allow multiple parsers for one message. 2018-04-14 15:29:07 +02:00
Koen Kanters dd7388c802 Update doc gen. 2018-04-13 19:29:17 +02:00
Koen Kanters 7026f42db3 Add planned to support. 2018-04-13 19:00:17 +02:00
Koen Kanters f5aa448ec0 Merge branch 'master' of https://github.com/Koenkk/xiaomi-zb2mqtt 2018-04-12 17:01:18 +02:00
Koen Kanters 93624ddaca Update WXKG01LM documentation. 2018-04-12 16:58:33 +02:00
Koen Kanters c7fc392c5f Update README.md 2018-04-11 22:06:12 +02:00
Koen Kanters 0055302bdc Support MQTT authentication. #2 2018-04-11 21:09:19 +02:00
Koen Kanters 2cfd078b2d Add npm start again. #2 2018-04-11 20:59:18 +02:00
Koen Kanters 3d3a8d6e95 Automatically generated docs. #2 2018-04-11 20:54:22 +02:00
Koen Kanters dc211027ed More robust MQTT handling. #2 2018-04-11 20:14:12 +02:00
Koen Kanters 4c6ab0ee49 Fix yaml read exception. #2 2018-04-11 20:00:18 +02:00
Koen Kanters a8bbd85b15 Use Xiaomi model ids. #2 2018-04-11 19:55:54 +02:00
Koen Kanters 1b6365b136 Start via npm start. 2018-04-11 19:01:44 +02:00
Koen Kanters ecae4d1c3b Add some happy and sad faces. 2018-04-09 22:17:24 +02:00
Koen Kanters 7dae18c6b5 Add firmware. 2018-04-09 21:32:13 +02:00
Koen Kanters 808370307b Update readme and package.json. 2018-04-09 20:48:30 +02:00
Koen Kanters 26027bfb85 Perfy is nice but we dont need it :(. #2 2018-04-09 20:27:32 +02:00
Koen Kanters d6b26239a1 Force documentation consistency. #2 2018-04-09 20:21:23 +02:00
Koen Kanters 3ee7c54e22 Support more sensor. #2 2018-04-09 20:01:49 +02:00
Koen Kanters e56162d222 Switch: support single, double, triple, quadruple and long clicks. #2 2018-04-09 18:36:32 +02:00
Koen Kanters 3f5dda0c51 .gitkeep is not needed anymore. 2018-04-09 17:56:04 +02:00
Koen Kanters 1ca19a792d Use base_topic from configuration.yaml. 2018-04-09 17:47:26 +02:00
Koen Kanters 43f45f5860 Move join parameter to configuration.yaml. 2018-04-09 17:45:02 +02:00
Koen Kanters e17f2c30c0 YAML configuration. 2018-04-09 17:37:21 +02:00
Koen Kanters 63a05fc443 Refactor message parsing. 2018-04-09 17:09:52 +02:00
Koen Kanters 366b5be765 Add config file. 2018-04-08 17:25:28 +02:00
Koen Kanters 3f4fc31835 Change location of database. 2018-04-08 16:41:42 +02:00
Koen Kanters 658b3624ac Refactor. 2018-04-08 16:32:28 +02:00
Koen Kanters 55e1657c80 Add --join parameter 2018-04-08 15:51:33 +02:00
Koen Kanters bc40911f2f Quit zigbee-shepherd friendly. 2018-04-08 15:33:47 +02:00
Koen Kanters 3f37c439c9 Add more logging. 2018-04-08 15:28:59 +02:00
Koen Kanters fb60982077 Refactor. 2018-04-08 15:00:36 +02:00
Koen Kanters fd68c243a8 Allow to set device and mqtt url with CLI arguments. 2018-04-08 14:46:20 +02:00
Koen Kanters c516973b4a Unlock version in package.json because we have npm-shrinkwrap.json now. 2018-04-08 14:15:34 +02:00
Koen Kanters c8c51e0118 Add npm shrinkwrap 2018-04-08 14:11:31 +02:00
Koen Kanters 2b843781e0 Fix package.json. 2018-04-08 14:09:17 +02:00
Andrew Linden 4eda443b3f updated readme 2018-01-01 11:37:03 +02:00
Andrew Linden d160efbde6 At startup list all currently joined deviced and set them to be "online" so shepherd wont try to query them for info (that would fail, because the devices go to sleep) 2017-12-24 22:41:01 +02:00
Andrew Linden 59926ffeea Added support for occupancy sensor and door sensor.
Changed the temp and humidity sensor topic for humidity from relative_humidity to just humidity
2017-12-08 11:29:34 +02:00
Andrew Linden c446539c95 Bugfixes and switch to upstream zigbee-shepherd 2017-11-28 12:38:12 +02:00
Andrew Linden 2aa7366a82 fix errors introduced by previous merge 2017-11-26 14:33:32 +02:00
Andrew Linden 91799d6d96 Merge pull request #1 from jpbarraca/master
Added support for Xiaomi Aqara Temperature Humidity Sensor
2017-11-18 12:19:38 +02:00
João Paulo Barraca 3fcc8278d8 Fixed bug 2017-09-27 23:08:29 +01:00
João Paulo Barraca 0b1a4f772e Updated readme 2017-09-27 22:59:15 +01:00
João Paulo Barraca aa5db1624a Added support for Xiaomi Aqara Temperature Humidity Sensor 2017-09-27 22:56:21 +01:00
Andrew Linden 42722b78e6 fix 2017-09-27 21:37:33 +03:00
Andrew Linden e44636eb4c info about config 2017-09-27 21:16:52 +03:00
Andrew Linden 22e73009da what kind of clicks each switch supports 2017-09-27 20:03:55 +03:00
Andrew Linden b52bd61e34 Initial commit 2017-09-27 19:39:10 +03:00
Andrew Linden d7cb4b5b4f Initial commit 2017-09-27 16:38:22 +03:00
106 changed files with 5806 additions and 3180 deletions
+7
View File
@@ -0,0 +1,7 @@
node_modules
.travis*
.git
.gitignore
*.png
firmware
docker/Dockerfile*
+2
View File
@@ -0,0 +1,2 @@
node_modules/*
support/*
+17
View File
@@ -0,0 +1,17 @@
{
"env": {
"node": true
},
"extends": ["eslint:recommended", "google"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"rules": {
"require-jsdoc": "off",
"indent": ["error", 4],
"max-len": ["error", { "code": 120 }]
}
}
+17
View File
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- enhancement
- bug
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+63
View File
@@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# data
data/database.db
data/config.json
data/log*.txt
+2
View File
@@ -0,0 +1,2 @@
tag-version-prefix=""
+28
View File
@@ -0,0 +1,28 @@
language: node_js
sudo: required
services:
- docker
node_js:
- "8"
install:
- npm install
script:
- npm run verify-homeassistant-mapping
- npm run eslint
after_success:
- ".travis/docker.sh"
- ".travis/wiki.sh"
- ".travis/trigger-downstream.sh"
env:
global:
- DOCKER_USERNAME=koenkk
- secure: q5W9+mHz13PslLkTxuYNXivOau+N5OyB53sqgb+krOCPlbN9+gvi2Av9SribVd5jp2yx2O9rV/mr8eS0M2ykvBJ3UsIsCXiFL1dEPmsz1wlFAnW3kbD2EGhGFEV0dWRflSlA+5iQtcMPvbYu2PAOChUUoY7NNlhcz2EC+XXUapvvvaDwA1oSdtX+m61qyREshZb8B57DyXhziy6i/xjhFa84C0mR/iGFRWpZgcxmrNFH+/XDhSIpdq2KshhDWhjyag3ukAsTxTpqzLh1rFRlczjJEn0CcHG4WHsWHUFn9KK2lvT/YCDP8w0URnR1bCr8nyxGZJ2DLW6AzxZtJfWjvbeZYjO2R3WeHpzp6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x0iWbaclxOrzI727XZOk5HquMTKKTI430lT6OjU01+YJqwyq+k650YiX5PImsgJXGhFzBKeUcB3A53kKijfr9aEV00YiXRsKoKAn+Bl09m/9O+melBbTwO/YAQyt6EoUt21Yk0BoqpW2CTMPAgsU5tm6Ra3bbJ+IaUYVMYBtuHqtGiKg8jgTHqRhwKejDyV7+1dDxX8q51bK2Kb6PujbI1SS5wsJEpkU/eoPs7MuprmlYarYtBt1fDXSK1EOjcfpyEFRlrNLewIKiFEo3dkTOEtW2a4t3tcAiXOj8Hcvp+6RsjTfnjYmZweHVh/JKDhujjHBMviyTjwp4RnPaQSFou0iVIB5+Mo34hUhFDXc30SBzaux+lyR3rGoEu5pubZNjG5CkKIpw3IyduNKtIrlbCnfg+WDU3jrXmk0fzmwyriyXhx9BAzM+hyFiElZ+3xoXAlmDlwvaRZyJuQQNslwGPbZyX9EByIUkECjYPf92QPyD0mjbn8C32IphgQ515Up+15g2meDniugzowLJkDe3W86M5fB1kPQiDq5oT4M6TgAPRElLN6/ibyfOzDAtOdZgUiQvFnUQb1s9LunZqrc57AKzuzl2xG9Ok/cUkZFSOjrFr40jXgS2Lw=
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash -e
login() {
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
}
tag_push() {
docker tag $DOCKER_USERNAME/zigbee2mqtt:$1 $DOCKER_USERNAME/zigbee2mqtt:$2
docker push $DOCKER_USERNAME/zigbee2mqtt:$2
}
build_and_push() {
docker build --build-arg COMMIT=$(git rev-parse --short HEAD) -t $DOCKER_USERNAME/zigbee2mqtt:$1 -f $2 .
docker push $DOCKER_USERNAME/zigbee2mqtt:$1
}
# Only update Docker images for:
# - dev branch
# - version release
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z ${TRAVIS_TAG+x} ]
then
echo "Updating docker images for master branch!"
login
# Push versioned images
build_and_push "$TRAVIS_TAG" docker/Dockerfile.amd64
build_and_push "$TRAVIS_TAG-arm32v6" docker/Dockerfile.arm32v6
build_and_push "$TRAVIS_TAG-arm64v8" docker/Dockerfile.arm64v8
# Push latest images.
tag_push "$TRAVIS_TAG-arm32v6" "arm32v6"
tag_push "$TRAVIS_TAG-arm64v8" "arm64v8"
tag_push "$TRAVIS_TAG" latest
elif [ "$TRAVIS_BRANCH" = "dev" -a "$TRAVIS_PULL_REQUEST" = "false" ]
then
echo "Updating docker images for dev branch!"
login
build_and_push latest-dev docker/Dockerfile.amd64
build_and_push arm32v6-dev docker/Dockerfile.arm32v6
build_and_push arm64v8-dev docker/Dockerfile.arm64v8
else
echo "Not updating docker images, triggered by pull request or not on master/dev branch"
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
function travis_trigger() {
local org=$1 && shift
local repo=$1 && shift
local branch=${1:-master} && shift
body="{
\"request\": {
\"branch\": \"${branch}\"
}
}"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_TOKEN" \
-d "$body" \
"https://api.travis-ci.org/repo/${org}%2F${repo}/requests"
}
# Only trigger downstream if on master branch and not pull request
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]
then
echo "Triggering build of downstream projects!"
travis_trigger "danielwelch" "hassio-zigbee2mqtt" "master"
else
echo "Not triggering build of downstream projects, triggered by pull request or not on master branch"
fi
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh -e
setup_git() {
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis CI"
}
update_wiki() {
rm -rf zigbee2mqtt.wiki
git clone https://${GH_TOKEN}@github.com/Koenkk/zigbee2mqtt.wiki.git
npm run docgen zigbee2mqtt.wiki
cd zigbee2mqtt.wiki
git add -A
git diff-index --quiet HEAD || git commit -m "Travis CI: update wiki"
git push origin
cd ..
rm -rf zigbee2mqtt.wiki
}
# Only update wiki if on master branch and not pull request
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]
then
echo "Updating wiki!"
setup_git
update_wiki
else
echo "Not updating wiki, triggered by pull request or not on master branch"
fi
+44
View File
@@ -0,0 +1,44 @@
[![Travis](https://img.shields.io/travis/Koenkk/zigbee2mqtt.svg)](https://api.travis-ci.org/Koenkk/zigbee2mqtt.svg)
# zigbee2mqtt :bridge_at_night: :honeybee:
![Thumbs up or down?](header.png)
<img align="right" height="40px" src="https://user-images.githubusercontent.com/7738048/40915536-1993dd32-6805-11e8-9f22-4dfca52133c0.png">
Allows you to use your Zigbee devices **without** the vendors (Xiaomi/TRADFRI/Hue) bridge or gateway.
It bridges events and allows you to control your Zigbee devices via MQTT. In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.
## [Getting started](https://github.com/Koenkk/zigbee2mqtt/wiki/Getting-started)
The [wiki](https://github.com/Koenkk/zigbee2mqtt/wiki) provides you all the information needed to get up and running! Make sure you don't skip sections if this is your first visit, as there might be important details in there for you.
[The documentation](https://github.com/Koenkk/zigbee2mqtt/wiki) will provide information on how to prepare, configure and start **zigbee2mqtt**, but also on how to customize the setup to fit your needs.
If you aren't familiar with **zigbee** terminology make sure you [read this](https://github.com/Koenkk/zigbee2mqtt/wiki/ZigBee-network) to help you out.
## Integrations
Zigbee2mqtt integrates well with (almost) every home automation solution because it uses MQTT. However the following integrations are worth mentioning:
<img align="left" height="100px" width="100px" src="https://user-images.githubusercontent.com/7738048/40914297-49e6e560-6800-11e8-8904-36cce896e5a8.png">
### [Home Assistant](https://www.home-assistant.io/)
- [Hassio](https://www.home-assistant.io/hassio/): Using [the official addon](https://github.com/danielwelch/hassio-zigbee2mqtt) from [danielwelch](https://github.com/danielwelch)
- Generic install or Hassbian: Using instructions [here](https://github.com/Koenkk/zigbee2mqtt/wiki/Integrating-with-Home-Assistant)
## Architecture
![Architecture](architecture.png)
## Supported devices
See [Supported devices](https://github.com/Koenkk/zigbee2mqtt/wiki/Supported-devices) to check whether your device is supported. There is quite an extensive list, including devices from vendors like Xiaomi, Ikea, Philips, OSRAM and more.
If it's not listed in [Supported devices](https://github.com/Koenkk/zigbee2mqtt/wiki/Supported-devices), support can be added (fairly) easy, see [How to support new devices](https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices).
## Support & help
If you need assistance you can check [opened issues](https://github.com/Koenkk/zigbee2mqtt/issues). Feel free to help with Pull Requests when you were able to fix things or add new devices or just share the love on social media.
## Contributors
* [AndrewLinden](https://github.com/AndrewLinden)
* [oskarn97](https://github.com/oskarn97)
* [dgomes](https://github.com/dgomes)
* [Koenkk](https://github.com/Koenk)
* [kirovilya](https://github.com/kirovilya)
* [ciotlosm](https://github.com/ciotlosm)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

+20
View File
@@ -0,0 +1,20 @@
# Home Assistant integration (MQTT discovery)
homeassistant: false
# allow new devices to join
permit_join: true
# MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: zigbee2mqtt
# MQTT server URL
server: 'mqtt://localhost'
# MQTT server authentication, uncomment if required:
# user: my_user
# password: my_password
# Serial settings
serial:
# Location of CC2531 USB sniffer
port: /dev/ttyACM0
-30
View File
@@ -1,30 +0,0 @@
import EventBus from "./eventBus";
import type Extension from "./extension/extension";
import Mqtt, { type MqttPublishOptions } from "./mqtt";
import State from "./state";
import Zigbee from "./zigbee";
export declare class Controller {
#private;
readonly eventBus: EventBus;
readonly zigbee: Zigbee;
readonly state: State;
readonly mqtt: Mqtt;
private restartCallback;
private exitCallback;
readonly extensions: Set<Extension>;
readonly extensionArgs: ConstructorParameters<typeof Extension>;
private sdNotify;
constructor(restartCallback: () => Promise<void>, exitCallback: (code: number, restart: boolean) => Promise<void>);
start(): Promise<void>;
enableDisableExtension(enable: boolean, name: string): Promise<void>;
getExtension(name: string): Extension | undefined;
addExtension(extension: Extension): Promise<void>;
removeExtension(extension: Extension): Promise<void>;
private startExtension;
private stopExtension;
stop(restart?: boolean, code?: number, signal?: NodeJS.Signals | undefined): Promise<void>;
exit(code: number, restart?: boolean): Promise<void>;
publishEntityState(entity: Group | Device, payload: KeyValue, stateChangeReason?: StateChangeReason): Promise<void>;
iteratePayloadAttributeOutput(topicRoot: string, payload: KeyValue, options: Partial<MqttPublishOptions>): Promise<void>;
}
//# sourceMappingURL=controller.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../lib/controller.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAMlC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AAUnD,OAAO,IAAI,EAAE,EAAC,KAAK,kBAAkB,EAAC,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,MAAM,SAAS,CAAC;AAO5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,qBAAa,UAAU;;IAGnB,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,KAAK,EAAE,KAAK,CAAC;IAC7B,SAAgB,IAAI,EAAE,IAAI,CAAC;IAC3B,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,YAAY,CAAoD;IACxE,SAAgB,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3C,SAAgB,aAAa,EAAE,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC;IACvE,OAAO,CAAC,QAAQ,CAA2C;IAE3D,YAAY,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,EA4ChH;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA+H3B;IAEW,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkF/E;IAEM,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAMvD;IAEW,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5D;IAEK,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzD;YAEa,cAAc;YAQd,aAAa;IAQrB,IAAI,CAAC,OAAO,UAAQ,EAAE,IAAI,SAAI,EAAE,MAAM,GAAE,MAAM,CAAC,OAAO,GAAG,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCnG;IAEK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;IAEW,kBAAkB,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8E9H;IAEK,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B7H;CACJ"}
-69
View File
@@ -1,69 +0,0 @@
type ListenerKey = object;
type Stats = {
devices: Map<string, // IEEE address
{
lastSeenChanges?: {
messages: number;
first: number;
};
leaveCounts: number;
networkAddressChanges: number;
}>;
mqtt: {
published: number;
received: number;
};
};
export default class EventBus {
private callbacksByExtension;
private emitter;
readonly stats: Stats;
constructor();
emitAdapterDisconnected(): void;
onAdapterDisconnected(key: ListenerKey, callback: () => Promise<void>): void;
emitPermitJoinChanged(data: eventdata.PermitJoinChanged): void;
onPermitJoinChanged(key: ListenerKey, callback: (data: eventdata.PermitJoinChanged) => void): void;
emitEntityRenamed(data: eventdata.EntityRenamed): void;
onEntityRenamed(key: ListenerKey, callback: (data: eventdata.EntityRenamed) => void): void;
emitEntityRemoved(data: eventdata.EntityRemoved): void;
onEntityRemoved(key: ListenerKey, callback: (data: eventdata.EntityRemoved) => void): void;
emitLastSeenChanged(data: eventdata.LastSeenChanged): void;
onLastSeenChanged(key: ListenerKey, callback: (data: eventdata.LastSeenChanged) => void): void;
emitDeviceNetworkAddressChanged(data: eventdata.DeviceNetworkAddressChanged): void;
onDeviceNetworkAddressChanged(key: ListenerKey, callback: (data: eventdata.DeviceNetworkAddressChanged) => void): void;
emitDeviceAnnounce(data: eventdata.DeviceAnnounce): void;
onDeviceAnnounce(key: ListenerKey, callback: (data: eventdata.DeviceAnnounce) => void): void;
emitDeviceInterview(data: eventdata.DeviceInterview): void;
onDeviceInterview(key: ListenerKey, callback: (data: eventdata.DeviceInterview) => void): void;
emitDeviceJoined(data: eventdata.DeviceJoined): void;
onDeviceJoined(key: ListenerKey, callback: (data: eventdata.DeviceJoined) => void): void;
emitEntityOptionsChanged(data: eventdata.EntityOptionsChanged): void;
onEntityOptionsChanged(key: ListenerKey, callback: (data: eventdata.EntityOptionsChanged) => void): void;
emitExposesChanged(data: eventdata.ExposesChanged): void;
onExposesChanged(key: ListenerKey, callback: (data: eventdata.ExposesChanged) => void): void;
emitDeviceLeave(data: eventdata.DeviceLeave): void;
onDeviceLeave(key: ListenerKey, callback: (data: eventdata.DeviceLeave) => void): void;
emitDeviceMessage(data: eventdata.DeviceMessage): void;
onDeviceMessage(key: ListenerKey, callback: (data: eventdata.DeviceMessage) => void): void;
emitMQTTMessage(data: eventdata.MQTTMessage): void;
onMQTTMessage(key: ListenerKey, callback: (data: eventdata.MQTTMessage) => void): void;
emitMQTTMessagePublished(data: eventdata.MQTTMessagePublished): void;
onMQTTMessagePublished(key: ListenerKey, callback: (data: eventdata.MQTTMessagePublished) => void): void;
emitPublishEntityState(data: eventdata.PublishEntityState): void;
onPublishEntityState(key: ListenerKey, callback: (data: eventdata.PublishEntityState) => void): void;
emitGroupMembersChanged(data: eventdata.GroupMembersChanged): void;
onGroupMembersChanged(key: ListenerKey, callback: (data: eventdata.GroupMembersChanged) => void): void;
emitDevicesChanged(): void;
onDevicesChanged(key: ListenerKey, callback: () => void): void;
emitScenesChanged(data: eventdata.ScenesChanged): void;
onScenesChanged(key: ListenerKey, callback: (data: eventdata.ScenesChanged) => void): void;
emitReconfigure(data: eventdata.Reconfigure): void;
onReconfigure(key: ListenerKey, callback: (data: eventdata.Reconfigure) => void): void;
emitStateChange(data: eventdata.StateChange): void;
onStateChange(key: ListenerKey, callback: (data: eventdata.StateChange) => void): void;
emitExposesAndDevicesChanged(device: Device): void;
private on;
removeListeners(key: ListenerKey): void;
}
export {};
//# sourceMappingURL=eventBus.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../lib/eventBus.ts"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG,MAAM,CAAC;AAgC1B,KAAK,KAAK,GAAG;IACT,OAAO,EAAE,GAAG,CACR,MAAM,EAAE,eAAe;IACvB;QACI,eAAe,CAAC,EAAE;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,CAAC;QACpD,WAAW,EAAE,MAAM,CAAC;QACpB,qBAAqB,EAAE,MAAM,CAAC;KACjC,CACJ,CAAC;IACF,IAAI,EAAE;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;CACL,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAkG;IAC9H,OAAO,CAAC,OAAO,CAA0C;IACzD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAA2D;IAEhF,cAEC;IAEM,uBAAuB,IAAI,IAAI,CAErC;IACM,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAElF;IAEM,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,iB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AAS,CAAC,WAAW,KAAK,IAAI,GAAG,IAAI,CAE5F;IAEM,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGxD;IAED,OAAO,CAAC,EAAE;IAqBH,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAQ7C;CACJ"}
-34
View File
@@ -1,34 +0,0 @@
import Extension from "./extension";
export default class Availability extends Extension {
/** Mapped by IEEE address */
private readonly timers;
/** Mapped by IEEE address or Group ID */
private readonly lastPublishedAvailabilities;
/** Mapped by IEEE address */
private readonly pingBackoffs;
/** IEEE addresses, waiting for last seen changes to take them out of "availability sleep" */
private readonly backoffPausedDevices;
/** Mapped by IEEE address */
private readonly retrieveStateDebouncers;
private pingQueue;
private pingQueueExecuting;
private stopped;
private getTimeout;
private getMaxJitter;
private getBackoff;
private getPauseOnBackoffGt;
private isActiveDevice;
private isAvailable;
private resetTimer;
private clearTimer;
private addToPingQueue;
private removeFromPingQueue;
private pingQueueExecuteNext;
start(): Promise<void>;
private publishAvailabilityForAllEntities;
private publishAvailability;
private onLastSeenChanged;
stop(): Promise<void>;
private retrieveState;
}
//# sourceMappingURL=availability.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../lib/extension/availability.ts"],"names":[],"mappings":"AASA,OAAO,SAAS,MAAM,aAAa,CAAC;AAcpC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS;IAC/C,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAC5D,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAuC;IACnF,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAqB;IAC1D,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAiC;IACzE,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,UAAU;IAqClB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,mBAAmB;YAOb,oBAAoB;IA4DnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA+BpC;YAEa,iCAAiC;YAQjC,mBAAmB;YAoCb,iBAAiB;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CASnC;IAED,OAAO,CAAC,aAAa;CAoDxB"}
-15
View File
@@ -1,15 +0,0 @@
import Extension from "./extension";
export default class Bind extends Extension {
#private;
private pollDebouncers;
start(): Promise<void>;
private parseMQTTMessage;
private onMQTTMessage;
private publishResponse;
onGroupMembersChanged(data: eventdata.GroupMembersChanged): Promise<void>;
getSetupReportingEndpoints(bind: zh.Bind, coordinatorEp: zh.Endpoint): zh.Endpoint[];
setupReporting(binds: zh.Bind[]): Promise<void>;
disableUnnecessaryReportings(target: zh.Group | zh.Endpoint): Promise<void>;
poll(data: eventdata.DeviceMessage): Promise<void>;
}
//# sourceMappingURL=bind.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../lib/extension/bind.ts"],"names":[],"mappings":"AAaA,OAAO,SAAS,MAAM,aAAa,CAAC;AA4KpC,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAS;;IAEvC,OAAO,CAAC,cAAc,CAAiC;IAGxC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAIpC;IAED,OAAO,CAAC,gBAAgB;YAiFJ,aAAa;YA+InB,eAAe;IAcjB,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBpF;IAED,0BAA0B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAkBnF;IAEK,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCpD;IAEK,4BAA4B,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDhF;IAEW,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAwE7D;CACJ"}
-59
View File
@@ -1,59 +0,0 @@
import Device from "../model/device";
import type Group from "../model/group";
import type { Zigbee2MQTTDevice, Zigbee2MQTTResponse } from "../types/api";
import Extension from "./extension";
export default class Bridge extends Extension {
#private;
private zigbee2mqttVersion;
private zigbeeHerdsmanVersion;
private zigbeeHerdsmanConvertersVersion;
private coordinatorVersion;
private restartRequired;
private lastJoinedDeviceIeeeAddr?;
private lastBridgeLoggingPayload?;
private logTransport;
private requestLookup;
start(): Promise<void>;
stop(): Promise<void>;
onMQTTMessage(data: eventdata.MQTTMessage): Promise<void>;
/**
* Requests
*/
deviceOptions(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/device/options">>;
groupOptions(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/group/options">>;
bridgeOptions(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/options">>;
deviceRemove(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/remove">>;
groupRemove(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/group/remove">>;
healthCheck(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/health_check">>;
coordinatorCheck(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/coordinator_check">>;
groupAdd(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/group/add">>;
deviceRename(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/rename">>;
groupRename(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/group/rename">>;
restart(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/restart">>;
backup(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/backup">>;
installCodeAdd(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/install_code/add">>;
permitJoin(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/permit_join">>;
touchlinkIdentify(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/touchlink/identify">>;
touchlinkFactoryReset(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/touchlink/factory_reset">>;
touchlinkScan(message: KeyValue | string): Promise<Zigbee2MQTTResponse<"bridge/response/touchlink/scan">>;
/**
* Utils
*/
changeEntityOptions<T extends "device" | "group">(entityType: T, message: KeyValue | string): Promise<Zigbee2MQTTResponse<T extends "device" ? "bridge/response/device/options" : "bridge/response/group/options">>;
deviceReportingConfigure(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/reporting/configure">>;
deviceReportingRead(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/reporting/read">>;
deviceInterview(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/interview">>;
deviceGenerateExternalDefinition(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/device/generate_external_definition">>;
action(message: string | KeyValue): Promise<Zigbee2MQTTResponse<"bridge/response/action">>;
renameEntity<T extends "device" | "group">(entityType: T, message: string | KeyValue): Promise<Zigbee2MQTTResponse<T extends "device" ? "bridge/response/device/rename" : "bridge/response/group/rename">>;
removeEntity<T extends "device" | "group">(entityType: T, message: string | KeyValue): Promise<Zigbee2MQTTResponse<T extends "device" ? "bridge/response/device/remove" : "bridge/response/group/remove">>;
getEntity(type: "group", id: string): Group;
getEntity(type: "device", id: string): Device;
getEntity(type: "group" | "device", id: string): Device | Group;
publishInfo(): Promise<void>;
publishDevices(): Promise<void>;
publishGroups(): Promise<void>;
publishDefinitions(): Promise<void>;
getDefinitionPayload(device: Device): Zigbee2MQTTDevice["definition"] | undefined;
}
//# sourceMappingURL=bridge.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../lib/extension/bridge.ts"],"names":[],"mappings":"AASA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAiB,iBAAiB,EAAE,mBAAmB,EAA+B,MAAM,cAAc,CAAC;AAOvH,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS;;IAIzC,OAAO,CAAC,kBAAkB,CAA0C;IACpE,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,+BAA+B,CAAqB;IAC5D,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,wBAAwB,CAAC,CAAS;IAC1C,OAAO,CAAC,wBAAwB,CAAC,CAAS;IAC1C,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAyBnB;IAEa,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAyIpC;IAEc,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAGnC;IAEW,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBpE;IAED;;OAEG;IAES,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,gCAA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MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,wBAAwB,CAAC,CAAC,CAcrG;IAEK,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,OAAO,EAC3C,UAAU,EAAE,CAAC,EACb,OAAO,EAAE,MAAM,GAAG,QAAQ,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAAC,SAAS,QAAQ,GAAG,+BAA+B,GAAG,8BAA8B,CAAC,CAAC,CAoCrH;IAEK,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,OAAO,EAC3C,UAAU,EAAE,CAAC,EACb,OAAO,EAAE,MAAM,GAAG,QAAQ,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAAC,SAAS,QAAQ,GAAG,+BAA+B,GAAG,8BAA8B,CAAC,CAAC,CA+FrH;IAED,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5C,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAS1D,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAiCjC;IAEK,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA6DpC;IAEK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBnC;IAEK,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAYxC;IAED,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG,SAAS,CA6BhF;CACJ"}
-14
View File
@@ -1,14 +0,0 @@
import Extension from "./extension";
/**
* This extension calls the zigbee-herdsman-converters definition configure() method
*/
export default class Configure extends Extension {
private configuring;
private attempts;
private topic;
private onReconfigure;
private onMQTTMessage;
start(): Promise<void>;
private configure;
}
//# sourceMappingURL=configure.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../lib/extension/configure.ts"],"names":[],"mappings":"AAOA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS;IAC5C,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,KAAK,CAAuE;YAEhE,aAAa;YAUb,aAAa;IA8BxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA0B9B;YAEa,SAAS;CAqE1B"}
-34
View File
@@ -1,34 +0,0 @@
declare abstract class Extension {
protected zigbee: Zigbee;
protected mqtt: Mqtt;
protected state: State;
protected publishEntityState: PublishEntityState;
protected eventBus: EventBus;
protected enableDisableExtension: (enable: boolean, name: string) => Promise<void>;
protected restartCallback: () => Promise<void>;
protected addExtension: (extension: Extension) => Promise<void>;
/**
* Besides initializing variables, the constructor should do nothing!
*
* @param {Zigbee} zigbee Zigbee controller
* @param {Mqtt} mqtt MQTT controller
* @param {State} state State controller
* @param {Function} publishEntityState Method to publish device state to MQTT.
* @param {EventBus} eventBus The event bus
* @param {enableDisableExtension} enableDisableExtension Enable/disable extension method
* @param {restartCallback} restartCallback Restart Zigbee2MQTT
* @param {addExtension} addExtension Add an extension
*/
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>);
/**
* Is called once the extension has to start
*/
start(): Promise<void>;
/**
* Is called once the extension has to stop
*/
stop(): Promise<void>;
adjustMessageBeforePublish(_entity: Group | Device, _message: KeyValue): void;
}
export default Extension;
//# sourceMappingURL=extension.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"extension.d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from "zigbee-herdsman-converters";
import ExternalJSExtension from "./externalJS";
type TModule = ExternalDefinitionWithExtend | ExternalDefinitionWithExtend[];
export default class ExternalConverters extends ExternalJSExtension<TModule> {
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>);
protected removeJS(name: string, _mod: TModule): Promise<void>;
protected loadJS(name: string, mod: TModule, newName?: string): Promise<void>;
}
export {};
//# sourceMappingURL=externalConverters.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"externalConverters.d.ts","sourceRoot":"","sources":["../../lib/extension/externalConverters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,4BAA4B,CAAC;AAK7E,OAAO,mBAAmB,MAAM,cAAc,CAAC;AAE/C,KAAK,OAAO,GAAG,4BAA4B,GAAG,4BAA4B,EAAE,CAAC;AAE7E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IACxE,YACI,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,QAAQ,EAClB,sBAAsB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACxE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACpC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,EAcxD;IAED,UAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAInE;IAED,UAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBlF;CACJ"}
-10
View File
@@ -1,10 +0,0 @@
import type Extension from "./extension";
import ExternalJSExtension from "./externalJS";
type TModule = new (...args: ConstructorParameters<typeof Extension>) => Extension;
export default class ExternalExtensions extends ExternalJSExtension<TModule> {
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>);
protected removeJS(_name: string, mod: TModule): Promise<void>;
protected loadJS(name: string, mod: TModule, newName?: string): Promise<void>;
}
export {};
//# sourceMappingURL=externalExtensions.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"externalExtensions.d.ts","sourceRoot":"","sources":["../../lib/extension/externalExtensions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,mBAAmB,MAAM,cAAc,CAAC;AAE/C,KAAK,OAAO,GAAG,KAAK,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,SAAS,CAAC,KAAK,SAAS,CAAC;AAEnF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IACxE,YACI,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,QAAQ,EAClB,sBAAsB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACxE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACpC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,EAcxD;IAED,UAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;IAED,UAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BlF;CACJ"}
-33
View File
@@ -1,33 +0,0 @@
import Extension from "./extension";
export default abstract class ExternalJSExtension<M> extends Extension {
protected folderName: string;
protected mqttTopic: string;
protected requestRegex: RegExp;
protected basePath: string;
protected nodeModulesSymlinked: boolean;
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>, mqttTopic: string, folderName: string);
/**
* In case the external JS is not in the Z2M install dir (e.g. when `ZIGBEE2MQTT_DATA` is used), the external
* JS cannot import from `node_modules`.
* To workaround this create a symlink to `node_modules` in the external JS dir.
* https://nodejs.org/api/esm.html#no-node_path
*/
private symlinkNodeModulesIfNecessary;
start(): Promise<void>;
stop(): Promise<void>;
private getFilePath;
protected getFileCode(name: string): string;
protected getFiles(): Generator<{
name: string;
code: string;
}>;
onMQTTMessage(data: eventdata.MQTTMessage): Promise<void>;
protected abstract removeJS(name: string, mod: M): Promise<void>;
protected abstract loadJS(name: string, mod: M, newName?: string): Promise<void>;
private remove;
private save;
private loadFiles;
private publishExternalJS;
private importFile;
}
//# sourceMappingURL=externalJS.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"externalJS.d.ts","sourceRoot":"","sources":["../../lib/extension/externalJS.ts"],"names":[],"mappings":"AAUA,OAAO,SAAS,MAAM,aAAa,CAAC;AAKpC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,mBAAmB,CAAC,CAAC,CAAE,SAAQ,SAAS;IAClE,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,SAAS,EAAE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CAAC,IAAI,CAAC,CAAC;YAE7D,MAAM;YAwBN,IAAI;YA+BV,SAAS;YAqBT,iBAAiB;YAQjB,UAAU;CAc3B"}
-18
View File
@@ -1,18 +0,0 @@
import Extension from "./extension";
/**
* This extension servers the frontend
*/
export declare class Frontend extends Extension {
private mqttBaseTopic;
private server;
private wss;
private baseUrl;
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>);
start(): Promise<void>;
stop(): Promise<void>;
private onUpgrade;
private onWebSocketConnection;
private onMQTTPublishMessageOrEntityState;
}
export default Frontend;
//# sourceMappingURL=frontend.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../lib/extension/frontend.ts"],"names":[],"mappings":"AAeA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC;;GAEG;AACH,qBAAa,QAAS,SAAQ,SAAS;IACnC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,GAAG,CAAoB;IAC/B,OAAO,CAAC,OAAO,CAAS;IAExB,YACI,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,QAAQ,EAClB,sBAAsB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACxE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACpC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,EAQxD;IAEc,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAqFpC;IAEc,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAanC;IAEK,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,qBAAqB;IAsC7B,OAAO,CAAC,iCAAiC;CA4BlD;eAEc,QAAQ"}
-13
View File
@@ -1,13 +0,0 @@
import Extension from "./extension";
export default class Groups extends Extension {
#private;
private lastOptimisticState;
start(): Promise<void>;
onStateChange(data: eventdata.StateChange): Promise<void>;
private shouldPublishPayloadForGroup;
private areAllMembersOffOrClosed;
private parseMQTTMessage;
private onMQTTMessage;
private publishResponse;
}
//# sourceMappingURL=groups.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../lib/extension/groups.ts"],"names":[],"mappings":"AAWA,OAAO,SAAS,MAAM,aAAa,CAAC;AA0BpC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS;;IAEzC,OAAO,CAAC,mBAAmB,CAA+B;IAG3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGpC;IAEW,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoGpE;IAED,OAAO,CAAC,4BAA4B;IASpC,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,gBAAgB;YAsEJ,aAAa;YA6DnB,eAAe;CAahC"}
-8
View File
@@ -1,8 +0,0 @@
import Extension from "./extension";
export default class Health extends Extension {
#private;
start(): Promise<void>;
stop(): Promise<void>;
clearStats(): void;
}
//# sourceMappingURL=health.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../lib/extension/health.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,aAAa,CAAC;AAOpC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS;;IAG1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAIpC;IAEc,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAGnC;IAED,UAAU,IAAI,IAAI,CAIjB;CA+CJ"}
-86
View File
@@ -1,86 +0,0 @@
import type { Zh } from "zigbee-herdsman-converters/lib/types";
import Extension from "./extension";
interface MockProperty {
property: string;
value: KeyValue | string | null;
}
interface DiscoveryEntry {
mockProperties: MockProperty[];
type: string;
object_id: string;
discovery_payload: KeyValue;
endpoint?: Zh.Endpoint;
}
interface ActionData {
action: string;
button?: string;
scene?: string;
region?: string;
}
/**
* This class handles the bridge entity configuration for Home Assistant Discovery.
*/
declare class Bridge {
private coordinatorIeeeAddress;
private coordinatorType;
private coordinatorFirmwareVersion;
private discoveryEntries;
readonly options: {
ID?: string;
homeassistant?: KeyValue;
};
get ID(): string;
get name(): string;
get hardwareVersion(): string;
get firmwareVersion(): string;
get configs(): DiscoveryEntry[];
constructor(ieeeAdress: string, version: zh.CoordinatorVersion, discovery: DiscoveryEntry[]);
isDevice(): this is Device;
isGroup(): this is Group;
}
/**
* This extensions handles integration with HomeAssistant
*/
export declare class HomeAssistant extends Extension {
private discovered;
private discoveryTopic;
private discoveryRegex;
private discoveryRegexWoTopic;
private groupMemberLookup;
private statusTopic;
private legacyActionSensor;
private experimentalEventEntities;
private zigbee2MQTTVersion;
private discoveryOrigin;
private bridge;
private bridgeIdentifier;
private actionValueTemplate;
constructor(zigbee: Zigbee, mqtt: Mqtt, state: State, publishEntityState: PublishEntityState, eventBus: EventBus, enableDisableExtension: (enable: boolean, name: string) => Promise<void>, restartCallback: () => Promise<void>, addExtension: (extension: Extension) => Promise<void>);
start(): Promise<void>;
private getDiscovered;
private exposeToConfig;
onEntityRemoved(data: eventdata.EntityRemoved): Promise<void>;
onGroupMembersChanged(data: eventdata.GroupMembersChanged): Promise<void>;
onPublishEntityState(data: eventdata.PublishEntityState): Promise<void>;
onEntityRenamed(data: eventdata.EntityRenamed): Promise<void>;
private getConfigs;
private discover;
private onMQTTMessage;
onZigbeeEvent(data: {
device: Device;
}): Promise<void>;
onScenesChanged(data: eventdata.ScenesChanged): Promise<void>;
private getDevicePayload;
adjustMessageBeforePublish(entity: Device | Group | Bridge, message: KeyValue): void;
private getEncodedBaseTopic;
private getDiscoveryTopic;
private publishDeviceTriggerDiscover;
private getBridgeEntity;
parseActionValue(action: string): ActionData;
private buildAction;
private prepareActionEventTypes;
private parseGroupsFromRegex;
private getActionValueTemplate;
}
export default HomeAssistant;
//# sourceMappingURL=homeassistant.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"homeassistant.d.ts","sourceRoot":"","sources":["../../lib/extension/homeassistant.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,sCAAsC,CAAC;AAK7D,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,UAAU,cAAc;IACpB,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;CAC1B;AASD,UAAU,UAAU;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAoZD;;GAEG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,0BAA0B,CAAS;IAC3C,OAAO,CAAC,gBAAgB,CAAmB;IAE3C,QAAQ,CAAC,OAAO,EAAE;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,aAAa,CAAC,EAAE,QAAQ,CAAC;KAC5B,CAAC;IAGF,IAAI,EAAE,IAAI,MAAM,CAEf;IACD,IAAI,IAAI,IAAI,MAA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AAC,cAAc;IAs3BV,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CASxE;IAEW,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF;IAEW,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkElF;IAEW,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BxE;IAED,OAAO,CAAC,UAAU;YA8HJ,QAAQ;YAuSF,aAAa;IAkErB,aAAa,CAAC,IAAI,EAAE;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D;IAEW,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBxE;IAED,OAAO,CAAC,gBAAgB;IAoDf,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAoB5F;IAED,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,iBAAiB;YAKX,4BAA4B;IA2C1C,OAAO,CAAC,eAAe;IA0IvB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAwB3C;IAED,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,sBAAsB;CA0BjC;eAEc,aAAa"}
-15
View File
@@ -1,15 +0,0 @@
import type { Zigbee2MQTTNetworkMap } from "../types/api";
import Extension from "./extension";
/**
* This extension creates a network map
*/
export default class NetworkMap extends Extension {
#private;
start(): Promise<void>;
onMQTTMessage(data: eventdata.MQTTMessage): Promise<void>;
raw(topology: Zigbee2MQTTNetworkMap): Zigbee2MQTTNetworkMap;
graphviz(topology: Zigbee2MQTTNetworkMap): string;
plantuml(topology: Zigbee2MQTTNetworkMap): string;
networkScan(includeRoutes: boolean): Promise<Zigbee2MQTTNetworkMap>;
}
//# sourceMappingURL=networkMap.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"networkMap.d.ts","sourceRoot":"","sources":["../../lib/extension/networkMap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAKxE,OAAO,SAAS,MAAM,aAAa,CAAC;AAIpC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS;;IAI9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;IAEW,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCpE;IAED,GAAG,CAAC,QAAQ,EAAE,qBAAqB,GAAG,qBAAqB,CAE1D;IAED,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAqEhD;IAED,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAmDhD;IAEK,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA8IxE;CACJ"}
-11
View File
@@ -1,11 +0,0 @@
import Extension from "./extension";
/**
* This extension calls the zigbee-herdsman-converters onEvent.
*/
export default class OnEvent extends Extension {
#private;
start(): Promise<void>;
stop(): Promise<void>;
private callOnEvent;
}
//# sourceMappingURL=onEvent.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"onEvent.d.ts","sourceRoot":"","sources":["../../lib/extension/onEvent.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;;IAW3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAuCpC;IAEc,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CASnC;YAEa,WAAW;CAmB5B"}
-22
View File
@@ -1,22 +0,0 @@
import Extension from "./extension";
type UpdateState = "updating" | "idle" | "available" | "scheduled";
export interface UpdatePayload {
update: {
progress?: number;
remaining?: number;
state: UpdateState;
installed_version: number | null;
latest_version: number | null;
latest_source: string | null;
latest_release_notes: string | null;
};
}
export default class OTAUpdate extends Extension {
#private;
start(): Promise<void>;
clearState(): void;
private onZigbeeEvent;
onMQTTMessage(data: eventdata.MQTTMessage): Promise<void>;
}
export {};
//# sourceMappingURL=otaUpdate.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"otaUpdate.d.ts","sourceRoot":"","sources":["../../lib/extension/otaUpdate.ts"],"names":[],"mappings":"AAaA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,KAAK,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;AAEnE,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,WAAW,CAAC;QACnB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;KACvC,CAAC;CACL;AAuBD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS;;IAS7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAepC;IAGD,UAAU,IAAI,IAAI,CAGjB;YAWmB,aAAa;IAmJrB,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsPpE;CAwDJ"}
-18
View File
@@ -1,18 +0,0 @@
import Extension from "./extension";
export declare const loadTopicGetSetRegex: () => void;
interface ParsedTopic {
ID: string;
endpoint: string | undefined;
attribute: string;
type: "get" | "set";
}
export default class Publish extends Extension {
start(): Promise<void>;
parseTopic(topic: string): ParsedTopic | undefined;
parseMessage(parsedTopic: ParsedTopic, data: eventdata.MQTTMessage): KeyValue | undefined;
updateMessageHomeAssistant(message: KeyValue, entityState: KeyValue): void;
onMQTTMessage(data: eventdata.MQTTMessage): Promise<void>;
private getDefinitionConverters;
}
export {};
//# sourceMappingURL=publish.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../lib/extension/publish.ts"],"names":[],"mappings":"AAQA,OAAO,SAAS,MAAM,aAAa,CAAC;AAKpC,eAAO,MAAM,oBAAoB,QAAO,IAEvC,CAAC;AAKF,UAAU,WAAW;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;IAE3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGpC;IAED,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAsBjD;IAED,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,QAAQ,GAAG,SAAS,CAcxF;IAED,0BAA0B,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,GAAG,IAAI,CAezE;IAEW,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqNpE;IAED,OAAO,CAAC,uBAAuB;CAOlC"}
-13
View File
@@ -1,13 +0,0 @@
import Extension from "./extension";
export default class Receive extends Extension {
private elapsed;
private debouncers;
private throttlers;
start(): Promise<void>;
onPublishEntityState(data: eventdata.PublishEntityState): void;
publishDebounce(device: Device, payload: KeyValue, time: number, debounceIgnore: string[] | undefined): void;
publishThrottle(device: Device, payload: KeyValue, time: number): Promise<void>;
isPayloadConflicted(newPayload: KeyValue, oldPayload: KeyValue, debounceIgnore: string[] | undefined): boolean;
onDeviceMessage(data: eventdata.DeviceMessage): Promise<void>;
}
//# sourceMappingURL=receive.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../lib/extension/receive.ts"],"names":[],"mappings":"AASA,OAAO,SAAS,MAAM,aAAa,CAAC;AAIpC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;IAE1C,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,UAAU,CAAqE;IACvF,OAAO,CAAC,UAAU,CAAoD;IAGvD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGpC;IAEK,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,GAAG,IAAI,CAgBnE;IAED,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CA0B3G;IAEK,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpF;IAMD,mBAAmB,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAU7G;IAEW,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFxE;CACJ"}
-28
View File
@@ -1,28 +0,0 @@
import type { OtaExtraMetas } from "zigbee-herdsman/dist/controller/tstype";
import type { CustomClusters } from "zigbee-herdsman/dist/zspec/zcl/definition/tstype";
import * as zhc from "zigbee-herdsman-converters";
export default class Device {
#private;
zh: zh.Device;
definition?: zhc.Definition;
private _definitionModelID?;
get ieeeAddr(): string;
get ID(): string;
get options(): DeviceOptionsWithId;
get name(): string;
get isSupported(): boolean;
get customClusters(): CustomClusters;
get otaExtraMetas(): OtaExtraMetas;
get interviewed(): boolean;
constructor(device: zh.Device);
exposes(): zhc.Expose[];
resolveDefinition(ignoreCache?: boolean): Promise<void>;
reInterview(eventBus: EventBus): Promise<void>;
ensureInSettings(): void;
endpoint(key?: string | number): zh.Endpoint | undefined;
endpointName(endpoint: zh.Endpoint): string | undefined;
getEndpointNames(): string[];
isDevice(): this is Device;
isGroup(): this is Group;
}
//# sourceMappingURL=device.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../lib/model/device.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,wCAAwC,CAAC;AAC1E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kDAAkD,CAAC;AACrF,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAYlD,MAAM,CAAC,OAAO,OAAO,MAAM;;IAChB,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IACnC,OAAO,CAAC,kBAAkB,CAAC,CAAS;IAGpC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,EAAE,IAAI,MAAM,CAEf;IACD,IAAI,OAAO,IAAI,mBAAmB,CAGjC;IACD,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,cAAc,IAAI,cAAc,CAEnC;IACD,IAAI,aAAa,IAAI,aAAa,CAEjC;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,YAAY,MAAM,EAAE,EAAE,CAAC,MAAM,EAE5B;IAED,OAAO,IAAI,GAAG,CAAC,MAAM,EAAE,CAWtB;IAEK,iBAAiB,CAAC,WAAW,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1D;IAEK,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAenD;IAED,gBAAgB,IAAI,IAAI,CAIvB;IAED,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,QAAQ,GAAG,SAAS,CAgBvD;IAED,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,MAAM,GAAG,SAAS,CAgBtD;IAED,gBAAgB,IAAI,MAAM,EAAE,CAY3B;IAED,QAAQ,IAAI,IAAI,IAAI,MAAM,CAEzB;IAED,OAAO,IAAI,IAAI,IAAI,KAAK,CAEvB;CACJ"}
-16
View File
@@ -1,16 +0,0 @@
import type * as zhc from "zigbee-herdsman-converters";
export default class Group {
zh: zh.Group;
private resolveDevice;
get ID(): number;
get options(): GroupOptions;
get name(): string;
constructor(group: zh.Group, resolveDevice: (ieeeAddr: string) => Device | undefined);
ensureInSettings(): void;
hasMember(device: Device): boolean;
membersDevices(): Generator<Device>;
membersDefinitions(): zhc.Definition[];
isDevice(): this is Device;
isGroup(): this is Group;
}
//# sourceMappingURL=group.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../lib/model/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAIvD,MAAM,CAAC,OAAO,OAAO,KAAK;IACf,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC;IACpB,OAAO,CAAC,aAAa,CAA2C;IAGhE,IAAI,EAAE,IAAI,MAAM,CAEf;IACD,IAAI,OAAO,IAAI,YAAY,CAG1B;IACD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,YAAY,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAGnF;IAED,gBAAgB,IAAI,IAAI,CAIvB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjC;IAEA,cAAc,IAAI,SAAS,CAAC,MAAM,CAAC,CAQnC;IAED,kBAAkB,IAAI,GAAG,CAAC,UAAU,EAAE,CAUrC;IAED,QAAQ,IAAI,IAAI,IAAI,MAAM,CAEzB;IACD,OAAO,IAAI,IAAI,IAAI,KAAK,CAEvB;CACJ"}
-43
View File
@@ -1,43 +0,0 @@
import type { IClientPublishOptions } from "mqtt";
export interface MqttPublishOptions {
clientOptions: IClientPublishOptions;
baseTopic: string;
skipLog: boolean;
skipReceive: boolean;
meta: {
isEntityState?: boolean;
};
}
export default class Mqtt {
private publishedTopics;
private connectionTimer?;
private client;
private eventBus;
private republishRetainedTimer?;
private defaultPublishOptions;
retainedMessages: {
[s: string]: {
topic: string;
payload: string;
options: MqttPublishOptions;
};
};
get info(): {
version: 3 | 4 | 5 | undefined;
server: string;
};
get stats(): {
connected: boolean;
queued: number;
};
constructor(eventBus: EventBus);
connect(): Promise<void>;
disconnect(): Promise<void>;
subscribe(topic: string): Promise<void>;
unsubscribe(topic: string): Promise<void>;
private onConnect;
onMessage(topic: string, message: Buffer): void;
isConnected(): boolean;
publish(topic: string, payload: string, options?: Partial<MqttPublishOptions>): Promise<void>;
}
//# sourceMappingURL=mqtt.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../lib/mqtt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,qBAAqB,EAAa,MAAM,MAAM,CAAC;AAU5E,MAAM,WAAW,kBAAkB;IAC/B,aAAa,EAAE,qBAAqB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,sBAAsB,CAAC,CAAiB;IAChD,OAAO,CAAC,qBAAqB,CAAqB;IAC3C,gBAAgB,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,kBAAkB,CAAA;SAAC,CAAA;KAAC,CAAM;IAE3G,IAAI,IAAI;QAEA,OAAO;QACP,MAAM;MAEb;IAED,IAAI,KAAK;QAED,SAAS;QACT,MAAM;MAEb;IAED,YAAY,QAAQ,EAAE,QAAQ,EAS7B;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAiG7B;IAEK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAchC;IAEK,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5C;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9C;YAEmB,SAAS;IAShB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAY3D;IAED,WAAW,IAAI,OAAO,CAErB;IAEK,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDtG;CACJ"}
-19
View File
@@ -1,19 +0,0 @@
declare class State {
private readonly eventBus;
private readonly zigbee;
private readonly state;
private readonly file;
private timer?;
constructor(eventBus: EventBus, zigbee: Zigbee);
start(): void;
stop(): void;
clear(): void;
private load;
private save;
exists(entity: Device | Group): boolean;
get(entity: Group | Device): KeyValue;
set(entity: Group | Device, update: KeyValue, reason?: string): KeyValue;
remove(id: string | number): boolean;
}
export default State;
//# sourceMappingURL=state.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../lib/state.ts"],"names":[],"mappings":"AA8BA,cAAM,KAAK;IAMH,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;IAC9D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+B;IACpD,OAAO,CAAC,KAAK,CAAC,CAAiB;IAE/B,YACqB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EAIlC;IAED,KAAK,IAAI,IAAI,CAKZ;IAED,IAAI,IAAI,IAAI,CAcX;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,OAAO,CAAC,IAAI;IAoBZ,OAAO,CAAC,IAAI;IAgBZ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAEtC;IAED,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAEpC;IAED,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAWvE;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAEnC;CACJ;eAEc,KAAK"}
-942
View File
@@ -1,942 +0,0 @@
import type * as zigbeeHerdsman from "zigbee-herdsman/dist";
import type { ZclPayload } from "zigbee-herdsman/dist/adapter/events";
import type { Eui64 } from "zigbee-herdsman/dist/zspec/tstypes";
import type { Cluster, ClusterName, CustomClusters } from "zigbee-herdsman/dist/zspec/zcl/definition/tstype";
import type { GenericZdoResponse, RoutingTableEntry } from "zigbee-herdsman/dist/zspec/zdo/definition/tstypes";
import type * as zigbeeHerdsmanConverter from "zigbee-herdsman-converters";
import type { Base } from "zigbee-herdsman-converters/lib/exposes";
export type * as ZSpec from "zigbee-herdsman/dist/zspec";
export type * as Zcl from "zigbee-herdsman/dist/zspec/zcl";
export type * as Zdo from "zigbee-herdsman/dist/zspec/zdo";
export type Zigbee2MQTTFeatures = {
base: Base;
switch: zigbeeHerdsmanConverter.Switch;
lock: zigbeeHerdsmanConverter.Lock;
binary: zigbeeHerdsmanConverter.Binary;
list: zigbeeHerdsmanConverter.List;
numeric: zigbeeHerdsmanConverter.Numeric;
enum: zigbeeHerdsmanConverter.Enum;
text: zigbeeHerdsmanConverter.Text;
composite: zigbeeHerdsmanConverter.Composite;
light: zigbeeHerdsmanConverter.Light;
cover: zigbeeHerdsmanConverter.Cover;
fan: zigbeeHerdsmanConverter.Fan;
climate: zigbeeHerdsmanConverter.Climate;
};
import type { UpdatePayload } from "../extension/otaUpdate";
import type { LogLevel, schemaJson } from "../util/settings";
type KeyValue = Record<string, any>;
export interface OnboardInitData {
page: "form";
settings: Zigbee2MQTTSettings;
settingsSchema: typeof schemaJson;
devices: {
name: string;
path: Zigbee2MQTTSettings["serial"]["port"];
adapter?: Zigbee2MQTTSettings["serial"]["adapter"];
baudRate?: Zigbee2MQTTSettings["serial"]["baudrate"];
rtscts?: Zigbee2MQTTSettings["serial"]["rtscts"];
}[];
}
export interface OnboardDoneData {
page: "done";
frontendUrl: string | null;
}
export interface OnboardFailureData {
page: "failure";
errors: string[];
}
export type OnboardData = OnboardInitData | OnboardDoneData | OnboardFailureData;
export type OnboardSubmitResponse = {
success: true;
frontendUrl: string | null;
} | {
success: false;
error: string;
};
export type Zigbee2MQTTDeviceOptions = {
disabled?: boolean;
retention?: number;
availability?: boolean | {
timeout: number;
max_jitter?: number;
backoff?: boolean;
pause_on_backoff_gt?: number;
};
optimistic?: boolean;
debounce?: number;
debounce_ignore?: string[];
throttle?: number;
filtered_attributes?: string[];
filtered_cache?: string[];
filtered_optimistic?: string[];
icon?: string;
homeassistant?: KeyValue;
friendly_name: string;
description?: string;
qos?: 0 | 1 | 2;
disable_automatic_update_check?: boolean;
};
export type Zigbee2MQTTGroupOptions = {
ID: number;
optimistic?: boolean;
off_state?: "all_members_off" | "last_member_state";
filtered_attributes?: string[];
filtered_cache?: string[];
filtered_optimistic?: string[];
homeassistant?: KeyValue;
friendly_name: string;
description?: string;
qos?: 0 | 1 | 2;
};
export type Zigbee2MQTTSettings = {
version?: number;
/** only used internally during startup, removed on successful Z2M start */
onboarding?: true;
homeassistant: {
enabled: boolean;
discovery_topic: string;
status_topic: string;
experimental_event_entities: boolean;
legacy_action_sensor: boolean;
};
availability: {
enabled: boolean;
active: {
timeout: number;
max_jitter: number;
backoff: boolean;
pause_on_backoff_gt: number;
};
passive: {
timeout: number;
};
};
mqtt: {
base_topic: string;
include_device_information: boolean;
force_disable_retain: boolean;
version?: 3 | 4 | 5;
user?: string;
password?: string;
server: string;
ca?: string;
keepalive?: number;
key?: string;
cert?: string;
client_id?: string;
reject_unauthorized?: boolean;
server_name?: string;
maximum_packet_size: number;
};
serial: {
disable_led: boolean;
port?: string;
adapter?: "deconz" | "zstack" | "ezsp" | "zigate" | "ember" | "zboss" | "zoh";
baudrate?: number;
rtscts?: boolean;
};
passlist: string[];
blocklist: string[];
map_options: {
graphviz: {
colors: {
fill: {
enddevice: string;
coordinator: string;
router: string;
};
font: {
coordinator: string;
router: string;
enddevice: string;
};
line: {
active: string;
inactive: string;
};
};
};
};
ota: {
update_check_interval: number;
disable_automatic_update_check: boolean;
zigbee_ota_override_index_location?: string;
image_block_request_timeout?: number;
image_block_response_delay?: number;
default_maximum_data_size?: number;
};
frontend: {
enabled: boolean;
package: "zigbee2mqtt-frontend" | "zigbee2mqtt-windfront";
auth_token?: string;
host?: string;
port: number;
base_url: string;
url?: string;
ssl_cert?: string;
ssl_key?: string;
notification_filter?: string[];
disable_ui_serving?: boolean;
};
devices: {
[s: string]: Zigbee2MQTTDeviceOptions;
};
groups: {
[s: string]: Omit<Zigbee2MQTTGroupOptions, "ID">;
};
device_options: KeyValue;
advanced: {
log_rotation: boolean;
log_console_json: boolean;
log_symlink_current: boolean;
log_output: ("console" | "file" | "syslog")[];
log_directory: string;
log_file: string;
log_level: LogLevel;
log_namespaced_levels: Record<string, LogLevel>;
log_syslog: KeyValue;
log_debug_to_mqtt_frontend: boolean;
log_debug_namespace_ignore: string;
log_directories_to_keep: number;
pan_id: number | "GENERATE";
ext_pan_id: number[] | "GENERATE";
channel: number;
adapter_concurrent?: number;
adapter_delay?: number;
cache_state: boolean;
cache_state_persistent: boolean;
cache_state_send_on_startup: boolean;
last_seen: "disable" | "ISO_8601" | "ISO_8601_local" | "epoch";
elapsed: boolean;
network_key: number[] | "GENERATE";
timestamp_format: string;
output: "json" | "attribute" | "attribute_and_json";
transmit_power?: number;
/** 3.0: default to false (JSON schema & settings `defaults`) */
enable_external_js: boolean;
};
health: {
/** in minutes */
interval: number;
reset_on_check: boolean;
};
};
export interface Zigbee2MQTTScene {
id: number;
name: string;
}
export interface Zigbee2MQTTDeviceEndpoint {
name?: string;
bindings: Zigbee2MQTTDeviceEndpointBinding[];
configured_reportings: Zigbee2MQTTDeviceEndpointConfiguredReporting[];
clusters: {
input: string[];
output: string[];
};
scenes: Zigbee2MQTTScene[];
}
export interface Zigbee2MQTTDeviceEndpointBinding {
cluster: string;
target: Zigbee2MQTTDeviceEndpointBindingTarget;
}
export type Zigbee2MQTTDeviceEndpointBindingTarget = {
type: "endpoint";
ieee_address: string;
endpoint: number;
} | {
type: "group";
id: number;
};
export interface Zigbee2MQTTDeviceEndpointConfiguredReporting {
cluster: string;
attribute: string | number;
minimum_report_interval: number;
maximum_report_interval: number;
reportable_change: number;
}
export interface Zigbee2MQTTDeviceDefinition {
source: "native" | "generated" | "external";
model: string;
vendor: string;
description: string;
exposes: zigbeeHerdsmanConverter.Expose[];
supports_ota: boolean;
options: zigbeeHerdsmanConverter.Option[];
version: `0.0.${number}`;
icon: string;
}
export interface Zigbee2MQTTDevice {
ieee_address: zigbeeHerdsman.Models.Device["ieeeAddr"];
type: zigbeeHerdsman.Models.Device["type"];
network_address: zigbeeHerdsman.Models.Device["networkAddress"];
supported: boolean;
friendly_name: string;
disabled: boolean;
description?: string;
definition?: Zigbee2MQTTDeviceDefinition;
power_source: zigbeeHerdsman.Models.Device["powerSource"];
software_build_id: zigbeeHerdsman.Models.Device["softwareBuildID"];
date_code: zigbeeHerdsman.Models.Device["dateCode"];
model_id: zigbeeHerdsman.Models.Device["modelID"];
interviewing: boolean;
interview_completed: boolean;
interview_state: zigbeeHerdsman.Models.Device["interviewState"];
manufacturer: zigbeeHerdsman.Models.Device["manufacturerName"];
endpoints: Record<number, Zigbee2MQTTDeviceEndpoint>;
}
export interface Zigbee2MQTTGroupMember {
ieee_address: zigbeeHerdsman.Models.Device["ieeeAddr"];
endpoint: number;
}
export interface Zigbee2MQTTGroup {
id: number;
friendly_name: "default_bind_group" | string;
description?: string;
scenes: Zigbee2MQTTScene[];
members: Zigbee2MQTTGroupMember[];
}
export interface Zigbee2MQTTNetworkMap {
nodes: {
ieeeAddr: string;
friendlyName: string;
type: string;
networkAddress: number;
manufacturerName?: string;
modelID?: string;
failed?: string[];
lastSeen?: number;
definition?: {
model: string;
vendor: string;
supports: string;
description: string;
};
}[];
links: {
source: {
ieeeAddr: string;
networkAddress: number;
};
target: {
ieeeAddr: string;
networkAddress: number;
};
deviceType: number;
rxOnWhenIdle: number;
relationship: number;
permitJoining: number;
depth: number;
lqi: number;
routes: RoutingTableEntry[];
/** @deprecated 3.0 */
linkquality: number;
/** @deprecated 3.0 */
sourceIeeeAddr: string;
/** @deprecated 3.0 */
targetIeeeAddr: string;
/** @deprecated 3.0 */
sourceNwkAddr: number;
}[];
}
/**
* Zigbee2MQTT state/request/response API endpoints
*/
export interface Zigbee2MQTTAPI {
"bridge/logging": {
message: string;
level: LogLevel;
namespace: string;
};
"bridge/state": {
state: "online" | "offline";
};
"bridge/definitions": {
clusters: Readonly<Record<ClusterName, Cluster>>;
custom_clusters: Record<string, CustomClusters>;
actions: string[];
};
"bridge/event": {
type: "device_leave" | "device_joined" | "device_announce";
data: {
friendly_name: string;
ieee_address: string;
};
} | {
type: "device_interview";
data: {
friendly_name: string;
ieee_address: string;
status: "started" | "failed";
} | {
friendly_name: string;
ieee_address: string;
status: "successful";
supported: boolean;
definition: Zigbee2MQTTDeviceDefinition | undefined;
};
};
"bridge/info": {
os: {
version: string;
node_version: string;
cpus: string;
memory_mb: number;
};
mqtt: {
version: number | undefined;
server: string;
};
version: string;
commit: string | undefined;
zigbee_herdsman_converters: {
version: string;
};
zigbee_herdsman: {
version: string;
};
coordinator: {
ieee_address: string;
type: string;
meta: {
[s: string]: number | string;
};
};
network: {
pan_id: number;
/** `0x${string}` 8-len */
extended_pan_id: string;
channel: number;
};
log_level: "debug" | "info" | "warning" | "error";
permit_join: boolean;
permit_join_end: number | undefined;
restart_required: boolean;
config: Zigbee2MQTTSettings;
config_schema: typeof schemaJson;
};
"bridge/health": {
/** time of message, msec from epoch, UTC */
response_time: number;
os: {
load_average: number[];
memory_used_mb: number;
memory_percent: number;
};
process: {
uptime_sec: number;
memory_used_mb: number;
memory_percent: number;
};
mqtt: {
connected: boolean;
queued: number;
received: number;
published: number;
};
devices: Record<string, {
messages: number;
messages_per_sec: number;
leave_count: number;
network_address_changes: number;
}>;
};
"bridge/devices": Zigbee2MQTTDevice[];
"bridge/groups": Zigbee2MQTTGroup[];
"bridge/converters": {
name: string;
code: string;
}[];
"bridge/extensions": {
name: string;
code: string;
}[];
"bridge/request/permit_join": {
/** [0-254], 0 meaning disable */
time: number;
device?: string;
} | `${number}`;
"bridge/response/permit_join": {
/** [0-254], 0 meaning disable */
time: number;
device?: string;
};
"bridge/request/health_check": "";
"bridge/response/health_check": {
/** XXX: currently always returns true */
healthy: boolean;
};
"bridge/request/coordinator_check": "";
"bridge/response/coordinator_check": {
missing_routers: {
ieee_address: string;
friendly_name: string;
}[];
};
"bridge/request/restart": "";
"bridge/response/restart": Record<string, never>;
"bridge/request/networkmap": {
type: "raw" | "graphviz" | "plantuml";
routes: boolean;
} | "raw" | "graphviz" | "plantuml";
"bridge/response/networkmap": {
type: "raw";
routes: boolean;
value: Zigbee2MQTTNetworkMap;
} | {
type: "graphviz" | "plantuml";
routes: boolean;
value: string;
};
"bridge/request/extension/save": {
name: string;
code: string;
};
"bridge/response/extension/save": Record<string, never>;
"bridge/request/extension/remove": {
name: string;
};
"bridge/response/extension/remove": Record<string, never>;
"bridge/request/converter/save": {
name: string;
code: string;
};
"bridge/response/converter/save": Record<string, never>;
"bridge/request/converter/remove": {
name: string;
};
"bridge/response/converter/remove": Record<string, never>;
"bridge/request/backup": "";
"bridge/response/backup": {
/** base64 encoded ZIP archive */
zip: string;
};
"bridge/request/install_code/add": {
value: string;
};
"bridge/response/install_code/add": {
value: string;
};
/**
* Applied on-the-fly:
* - newSettings.homeassistant
* - newSettings.advanced?.log_level
* - newSettings.advanced?.log_namespaced_levels
* - newSettings.advanced?.log_debug_namespace_ignore
*/
"bridge/request/options": {
options: Record<string, unknown>;
};
"bridge/response/options": {
restart_required: boolean;
};
"bridge/request/device/bind": {
from: string;
from_endpoint: string | number | "default";
to: string | number;
to_endpoint?: string | number;
clusters?: string[];
skip_disable_reporting?: boolean;
};
"bridge/response/device/bind": {
from: string;
from_endpoint: string | number;
to: string | number;
to_endpoint: string | number | undefined;
clusters: string[];
failed: string[];
};
"bridge/request/device/unbind": {
from: string;
from_endpoint: string | number | "default";
to: string | number;
to_endpoint?: string | number;
clusters?: string[];
skip_disable_reporting?: boolean;
};
"bridge/response/device/unbind": {
from: string;
from_endpoint: string | number;
to: string | number;
to_endpoint: string | number | undefined;
clusters: string[];
failed: string[];
};
"bridge/request/device/binds/clear": {
target: string;
ieee_list?: Eui64[];
};
"bridge/response/device/binds/clear": {
target: string;
ieee_list?: Eui64[];
};
"bridge/request/device/configure": {
id: string | number;
} | string;
"bridge/response/device/configure": {
id: string | number;
};
"bridge/request/device/remove": {
id: string;
block?: boolean;
force?: boolean;
keep_config?: boolean;
clear_cache?: boolean;
};
"bridge/response/device/remove": {
id: string;
block: boolean;
force: boolean;
keep_config: boolean;
clear_cache: boolean;
};
"bridge/request/device/ota_update/check": {
id: string;
/** expected to point to an index json if provided */
url?: string | null;
};
"bridge/request/device/ota_update/check/downgrade": {
id: string;
/** expected to point to an index json if provided */
url?: string | null;
};
"bridge/response/device/ota_update/check": {
id: string;
update_available: boolean;
downgrade?: boolean;
source?: string;
release_notes?: string;
};
"bridge/request/device/ota_update/update": {
id: string;
url?: string | null;
/**
* Full firmware file in hex form (expected compatible with `Buffer.from(hex, "hex")`)
* If file name supplied, will be used instead of <ieee_utc> to store firmware in data dir.
*/
hex?: {
data: string;
file_name?: string;
} | null;
image_block_request_timeout?: number | null;
image_block_response_delay?: number | null;
/** may be overridden internally to match specific device needs */
default_maximum_data_size?: number | null;
};
"bridge/request/device/ota_update/update/downgrade": {
id: string;
url?: string | null;
/**
* Full firmware file in hex form (expected compatible with `Buffer.from(hex, "hex")`)
* If file name supplied, will be used instead of <ieee_utc> to store firmware in data dir.
*/
hex?: {
data: string;
file_name?: string;
} | null;
image_block_request_timeout?: number | null;
image_block_response_delay?: number | null;
/** may be overridden internally to match specific device needs */
default_maximum_data_size?: number | null;
};
"bridge/request/device/ota_update/update/abort": {
id: string;
};
"bridge/response/device/ota_update/update/abort": {
id: string;
};
"bridge/response/device/ota_update/update": {
id: string;
from: {
file_version: number;
software_build_id?: string;
date_code?: string;
} | undefined;
to: {
file_version: number;
software_build_id?: string;
date_code?: string;
} | undefined;
};
"bridge/request/device/ota_update/schedule": {
id: string;
url?: string | null;
/**
* Full firmware file in hex form (expected compatible with `Buffer.from(hex, "hex")`)
* If file name supplied, will be used instead of <ieee_utc> to store firmware in data dir.
*/
hex?: {
data: string;
file_name?: string;
} | null;
};
"bridge/request/device/ota_update/schedule/downgrade": {
id: string;
url?: string | null;
/**
* Full firmware file in hex form (expected compatible with `Buffer.from(hex, "hex")`)
* If file name supplied, will be used instead of <ieee_utc> to store firmware in data dir.
*/
hex?: {
data: string;
file_name?: string;
} | null;
};
"bridge/response/device/ota_update/schedule": {
id: string;
url?: string;
};
"bridge/request/device/ota_update/unschedule": {
id: string;
};
"bridge/response/device/ota_update/unschedule": {
id: string;
};
"bridge/request/device/interview": {
id: string | number;
};
"bridge/response/device/interview": {
id: string | number;
};
"bridge/request/device/generate_external_definition": {
id: string | number;
};
"bridge/response/device/generate_external_definition": {
id: string | number;
source: string;
};
"bridge/request/device/options": {
id: string;
options: Record<string, unknown>;
};
"bridge/response/device/options": {
id: string;
from: Record<string, unknown>;
to: Record<string, unknown>;
restart_required: boolean;
};
"bridge/request/device/rename": {
last: true;
from?: string;
to: string;
homeassistant_rename?: boolean;
} | {
last: false | undefined;
from: string;
to: string;
homeassistant_rename?: boolean;
};
"bridge/response/device/rename": {
from: string;
to: string;
homeassistant_rename: boolean;
};
"bridge/request/device/reporting/configure": {
id: string;
endpoint: string | number;
cluster: string | number;
attribute: string | number | {
ID: number;
type: number;
};
minimum_report_interval: number;
maximum_report_interval: number;
reportable_change?: number;
option: Record<string, unknown>;
};
"bridge/response/device/reporting/configure": {
id: string;
endpoint: string | number;
cluster: string | number;
attribute: string | number | {
ID: number;
type: number;
};
minimum_report_interval: number;
maximum_report_interval: number;
reportable_change?: number;
};
"bridge/request/device/reporting/read": {
id: string;
endpoint: string | number;
cluster: string | number;
configs: {
direction?: number;
attribute: string | number | {
ID: number;
type: number;
};
}[];
manufacturer_code?: number;
};
"bridge/response/device/reporting/read": {
id: string;
endpoint: string | number;
cluster: string | number;
configs: zigbeeHerdsman.Zcl.ClustersTypes.TFoundation["readReportConfigRsp"];
manufacturer_code?: number;
};
"bridge/request/group/remove": {
id: string;
force?: boolean;
};
"bridge/response/group/remove": {
id: string;
force: boolean;
};
"bridge/request/group/add": {
friendly_name: string;
id?: string;
};
"bridge/response/group/add": {
friendly_name: string;
id: number;
};
"bridge/request/group/rename": {
from: string;
to: string;
homeassistant_rename?: boolean;
};
"bridge/response/group/rename": {
from: string;
to: string;
homeassistant_rename: boolean;
};
"bridge/request/group/options": {
id: string;
options: Record<string, unknown>;
};
"bridge/response/group/options": {
id: string;
from: Record<string, unknown>;
to: Record<string, unknown>;
restart_required: boolean;
};
"bridge/request/group/members/add": {
device: string;
group: string;
endpoint: string | number | "default";
skip_disable_reporting?: boolean;
};
"bridge/response/group/members/add": {
device: string;
group: string;
endpoint: string | number | "default";
};
"bridge/request/group/members/remove": {
device: string;
group: string;
endpoint: string | number | "default";
skip_disable_reporting?: boolean;
};
"bridge/response/group/members/remove": {
device: string;
group: string;
endpoint: string | number | "default";
};
"bridge/request/group/members/remove_all": {
device: string;
endpoint: string | number | "default";
skip_disable_reporting?: boolean;
};
"bridge/response/group/members/remove_all": {
device: string;
endpoint: string | number | "default";
};
"bridge/request/touchlink/factory_reset": {
ieee_address: string;
channel: number;
} | "";
"bridge/response/touchlink/factory_reset": {
ieee_address: string;
channel: number;
} | Record<string, never>;
"bridge/request/touchlink/scan": "";
"bridge/response/touchlink/scan": {
found: {
ieee_address: string;
channel: number;
}[];
};
"bridge/request/touchlink/identify": {
ieee_address: string;
channel: number;
};
"bridge/response/touchlink/identify": {
ieee_address: string;
channel: number;
};
"bridge/request/action": {
action: string;
params?: Record<string, unknown>;
};
"bridge/response/action": GenericZdoResponse | ZclPayload | undefined;
/**
* entity state response
*/
"{friendlyName}": {
[key: string]: unknown;
update?: UpdatePayload["update"];
};
"{friendlyName}/availability": {
state: "online" | "offline";
};
/** entity set request (tries to match endpoint to definition, else uses "default") */
"{friendlyNameOrId}/set": {
[attribute: string]: {
[key: string]: unknown;
} | string | boolean;
};
/** entity set request (tries to match endpoint to definition, else uses "default") */
"{friendlyNameOrId}/set/{attribute}": {
[key: string]: unknown;
};
/** entity set request */
"{friendlyNameOrId}/{endpoint}/set": {
[attribute: string]: {
[key: string]: unknown;
} | string | boolean;
};
/** entity set request */
"{friendlyNameOrId}/{endpoint}/set/{attribute}": {
[key: string]: unknown;
};
/** entity get request (tries to match endpoint to definition, else uses "default") */
"{friendlyNameOrId}/get": {
[attribute: string]: {
[key: string]: unknown;
} | string | boolean;
};
/** entity get request (tries to match endpoint to definition, else uses "default") */
"{friendlyNameOrId}/get/{attribute}": {
[key: string]: unknown;
};
/** entity get request */
"{friendlyNameOrId}/{endpoint}/get": {
[attribute: string]: {
[key: string]: unknown;
} | string | boolean;
};
/** entity get request */
"{friendlyNameOrId}/{endpoint}/get/{attribute}": {
[key: string]: unknown;
};
}
export type Zigbee2MQTTRequestEndpoints = "bridge/request/permit_join" | "bridge/request/health_check" | "bridge/request/coordinator_check" | "bridge/request/restart" | "bridge/request/networkmap" | "bridge/request/extension/save" | "bridge/request/extension/remove" | "bridge/request/converter/save" | "bridge/request/converter/remove" | "bridge/request/backup" | "bridge/request/install_code/add" | "bridge/request/options" | "bridge/request/device/bind" | "bridge/request/device/unbind" | "bridge/request/device/binds/clear" | "bridge/request/device/configure" | "bridge/request/device/remove" | "bridge/request/device/ota_update/check" | "bridge/request/device/ota_update/check/downgrade" | "bridge/request/device/ota_update/update" | "bridge/request/device/ota_update/update/downgrade" | "bridge/request/device/ota_update/update/abort" | "bridge/request/device/ota_update/schedule" | "bridge/request/device/ota_update/schedule/downgrade" | "bridge/request/device/ota_update/unschedule" | "bridge/request/device/interview" | "bridge/request/device/generate_external_definition" | "bridge/request/device/options" | "bridge/request/device/rename" | "bridge/request/device/reporting/configure" | "bridge/request/device/reporting/read" | "bridge/request/group/remove" | "bridge/request/group/add" | "bridge/request/group/rename" | "bridge/request/group/options" | "bridge/request/group/members/add" | "bridge/request/group/members/remove" | "bridge/request/group/members/remove_all" | "bridge/request/touchlink/factory_reset" | "bridge/request/touchlink/scan" | "bridge/request/touchlink/identify" | "bridge/request/action" | "{friendlyNameOrId}/set" | "{friendlyNameOrId}/set/{attribute}" | "{friendlyNameOrId}/{endpoint}/set" | "{friendlyNameOrId}/{endpoint}/set/{attribute}" | "{friendlyNameOrId}/get" | "{friendlyNameOrId}/get/{attribute}" | "{friendlyNameOrId}/{endpoint}/get" | "{friendlyNameOrId}/{endpoint}/get/{attribute}";
export type Zigbee2MQTTResponseEndpoints = "bridge/response/permit_join" | "bridge/response/health_check" | "bridge/response/coordinator_check" | "bridge/response/restart" | "bridge/response/networkmap" | "bridge/response/extension/save" | "bridge/response/extension/remove" | "bridge/response/converter/save" | "bridge/response/converter/remove" | "bridge/response/backup" | "bridge/response/install_code/add" | "bridge/response/options" | "bridge/response/device/bind" | "bridge/response/device/unbind" | "bridge/response/device/binds/clear" | "bridge/response/device/configure" | "bridge/response/device/remove" | "bridge/response/device/ota_update/check" | "bridge/response/device/ota_update/update" | "bridge/response/device/ota_update/update/abort" | "bridge/response/device/ota_update/schedule" | "bridge/response/device/ota_update/unschedule" | "bridge/response/device/interview" | "bridge/response/device/generate_external_definition" | "bridge/response/device/options" | "bridge/response/device/rename" | "bridge/response/device/reporting/configure" | "bridge/response/device/reporting/read" | "bridge/response/group/remove" | "bridge/response/group/add" | "bridge/response/group/rename" | "bridge/response/group/options" | "bridge/response/group/members/add" | "bridge/response/group/members/remove" | "bridge/response/group/members/remove_all" | "bridge/response/touchlink/factory_reset" | "bridge/response/touchlink/scan" | "bridge/response/touchlink/identify" | "bridge/response/action";
export type Zigbee2MQTTRequest<T extends Zigbee2MQTTRequestEndpoints> = {
transaction?: string;
} & Zigbee2MQTTAPI[T];
export type Zigbee2MQTTResponseOK<T extends Zigbee2MQTTResponseEndpoints> = {
status: "ok";
data: Zigbee2MQTTAPI[T];
transaction?: string;
};
export type Zigbee2MQTTResponseError = {
status: "error";
data: Record<string, never>;
error: string;
transaction?: string;
};
export type Zigbee2MQTTResponse<T extends Zigbee2MQTTResponseEndpoints> = Zigbee2MQTTResponseOK<T> | Zigbee2MQTTResponseError;
//# sourceMappingURL=api.d.ts.map
-1
View File
File diff suppressed because one or more lines are too long
-10
View File
@@ -1,10 +0,0 @@
declare function joinPath(file: string): string;
declare function getPath(): string;
declare function _testReload(): void;
declare const _default: {
joinPath: typeof joinPath;
getPath: typeof getPath;
_testReload: typeof _testReload;
};
export default _default;
//# sourceMappingURL=data.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../lib/util/data.ts"],"names":[],"mappings":"AAQA,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,iBAAS,OAAO,IAAI,MAAM,CAEzB;AAED,iBAAS,WAAW,IAAI,IAAI,CAE3B"}
-34
View File
@@ -1,34 +0,0 @@
import winston from "winston";
import * as settings from "./settings";
declare class Logger {
private level;
private output;
private directory;
private logger;
private fileTransport;
private debugNamespaceIgnoreRegex?;
private namespacedLevels;
private cachedNamespacedLevels;
init(): void;
get winston(): winston.Logger;
addTransport(transport: winston.transport): void;
removeTransport(transport: winston.transport): void;
getDebugNamespaceIgnore(): string;
setDebugNamespaceIgnore(value: string): void;
getLevel(): settings.LogLevel;
setLevel(level: settings.LogLevel): void;
getNamespacedLevels(): Record<string, settings.LogLevel>;
setNamespacedLevels(nsLevels: Record<string, settings.LogLevel>): void;
private resetCachedNamespacedLevels;
private cacheNamespacedLevel;
private log;
error(messageOrLambda: string | (() => string), namespace?: string): void;
warning(messageOrLambda: string | (() => string), namespace?: string): void;
info(messageOrLambda: string | (() => string), namespace?: string): void;
debug(messageOrLambda: string | (() => string), namespace?: string): void;
private cleanup;
end(): Promise<void>;
}
declare const _default: Logger;
export default _default;
//# sourceMappingURL=logger.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/util/logger.ts"],"names":[],"mappings":"AAIA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAIvC,cAAM,MA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E,SAAS,SAAQ,GAAG,IAAI,CAE7E;IAEM,KAAK,CAAC,eAAe,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,SAAS,SAAQ,GAAG,IAAI,CAM9E;IAGD,OAAO,CAAC,OAAO;IA0BF,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBhC;CAEJ"}
-15
View File
@@ -1,15 +0,0 @@
/** Anything mergeable: a plain-ish object, explicitly not an array or another iterable. */
export type UnknownRecord = Record<string | number, unknown> & {
[Symbol.iterator]?: never;
};
/**
* Merge all sources into `target` recursively.
*
* Key behavior:
* - ignore properties `__proto__`, `constructor` & `prototype`
* - assumes no infinite circular possible (unhandled for perf)
*
* Pass empty object `{}` as `target` to return a new object without modifying any existing objects.
*/
export declare function objectAssignDeep<T extends UnknownRecord, S extends readonly UnknownRecord[]>(target: T, ...sources: S): T & UnionToIntersection<S[number]>;
//# sourceMappingURL=objectAssignDeep.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"objectAssignDeep.d.ts","sourceRoot":"","sources":["../../lib/util/objectAssignDeep.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG;IAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAA;CAAC,CAAC;AA+B3F;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,SAAS,aAAa,EAAE,EACxF,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,CAAC,GACd,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAsBpC"}
-2
View File
@@ -1,2 +0,0 @@
export declare function onboard(): Promise<boolean>;
//# sourceMappingURL=onboarding.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../lib/util/onboarding.ts"],"names":[],"mappings":"AAgQA,wBAAsB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAgEhD"}
-10
View File
@@ -1,10 +0,0 @@
/**
* Handle sd_notify protocol, @see https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html
* No-op if running on unsupported platforms or without Type=notify
* Soft-fails if improperly setup (this is not necessary for Zigbee2MQTT to function properly)
*/
export declare function initSdNotify(): Promise<{
notifyStopping: () => void;
stop: () => void;
} | undefined>;
//# sourceMappingURL=sd-notify.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"sd-notify.d.ts","sourceRoot":"","sources":["../../lib/util/sd-notify.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAC,GAAG,SAAS,CAAC,CA0DxG"}
-238
View File
@@ -1,238 +0,0 @@
import schemaJson from "./settings.schema.json";
export { schemaJson };
export declare const CURRENT_VERSION = 5;
/** NOTE: by order of priority, lower index is lower level (more important) */
export declare const LOG_LEVELS: readonly string[];
export type LogLevel = "error" | "warning" | "info" | "debug";
export declare const defaults: {
homeassistant: {
enabled: false;
discovery_topic: string;
status_topic: string;
legacy_action_sensor: false;
experimental_event_entities: false;
};
availability: {
enabled: false;
active: {
timeout: number;
max_jitter: number;
backoff: true;
pause_on_backoff_gt: number;
};
passive: {
timeout: number;
};
};
frontend: {
enabled: false;
package: "zigbee2mqtt-windfront";
port: number;
base_url: string;
};
mqtt: {
base_topic: string;
include_device_information: false;
force_disable_retain: false;
maximum_packet_size: number;
keepalive: number;
reject_unauthorized: true;
version: 4;
};
serial: {
disable_led: false;
};
passlist: never[];
blocklist: never[];
map_options: {
graphviz: {
colors: {
fill: {
enddevice: string;
coordinator: string;
router: string;
};
font: {
coordinator: string;
router: string;
enddevice: string;
};
line: {
active: string;
inactive: string;
};
};
};
};
ota: {
update_check_interval: number;
disable_automatic_update_check: false;
image_block_request_timeout: number;
image_block_response_delay: number;
default_maximum_data_size: number;
};
device_options: {};
advanced: {
log_rotation: true;
log_console_json: false;
log_symlink_current: false;
log_output: ("console" | "file")[];
log_directory: string;
log_file: string;
log_level: "debug" | "info";
log_namespaced_levels: {};
log_syslog: {};
log_debug_to_mqtt_frontend: false;
log_debug_namespace_ignore: string;
log_directories_to_keep: number;
pan_id: number;
ext_pan_id: number[];
channel: number;
adapter_concurrent: undefined;
adapter_delay: undefined;
cache_state: true;
cache_state_persistent: true;
cache_state_send_on_startup: true;
last_seen: "disable";
elapsed: false;
network_key: number[];
timestamp_format: string;
output: "json";
enable_external_js: true;
};
health: {
interval: number;
reset_on_check: false;
};
};
export declare function writeMinimalDefaults(): void;
export declare function setOnboarding(value: boolean): void;
export declare function write(): void;
export declare function validate(): string[];
export declare function validateNonRequired(): string[];
/**
* Get the settings actually written in the yaml.
* Env vars are applied on top.
* Defaults merged on startup are not included.
*/
export declare function getPersistedSettings(): Partial<Settings>;
export declare function get(): Settings;
export declare function set(path: string[], value: string | number | boolean | KeyValue): void;
export declare function apply(settings: Record<string, unknown>, throwOnError?: boolean): boolean;
export declare function getGroup(IDorName: string | number): GroupOptions | undefined;
export declare function getDevice(IDorName: string): DeviceOptionsWithId | undefined;
export declare function addDevice(id: string): DeviceOptionsWithId;
export declare function blockDevice(id: string): void;
export declare function removeDevice(IDorName: string): void;
export declare function addGroup(name: string, id?: string): GroupOptions;
export declare function removeGroup(IDorName: string | number): void;
export declare function changeEntityOptions(IDorName: string, newOptions: KeyValue): boolean;
export declare function changeFriendlyName(IDorName: string, newName: string): void;
export declare function reRead(): void;
export declare const testing: {
write: typeof write;
clear: () => void;
defaults: {
homeassistant: {
enabled: false;
discovery_topic: string;
status_topic: string;
legacy_action_sensor: false;
experimental_event_entities: false;
};
availability: {
enabled: false;
active: {
timeout: number;
max_jitter: number;
backoff: true;
pause_on_backoff_gt: number;
};
passive: {
timeout: number;
};
};
frontend: {
enabled: false;
package: "zigbee2mqtt-windfront";
port: number;
base_url: string;
};
mqtt: {
base_topic: string;
include_device_information: false;
force_disable_retain: false;
maximum_packet_size: number;
keepalive: number;
reject_unauthorized: true;
version: 4;
};
serial: {
disable_led: false;
};
passlist: never[];
blocklist: never[];
map_options: {
graphviz: {
colors: {
fill: {
enddevice: string;
coordinator: string;
router: string;
};
font: {
coordinator: string;
router: string;
enddevice: string;
};
line: {
active: string;
inactive: string;
};
};
};
};
ota: {
update_check_interval: number;
disable_automatic_update_check: false;
image_block_request_timeout: number;
image_block_response_delay: number;
default_maximum_data_size: number;
};
device_options: {};
advanced: {
log_rotation: true;
log_console_json: false;
log_symlink_current: false;
log_output: ("console" | "file")[];
log_directory: string;
log_file: string;
log_level: "debug" | "info";
log_namespaced_levels: {};
log_syslog: {};
log_debug_to_mqtt_frontend: false;
log_debug_namespace_ignore: string;
log_directories_to_keep: number;
pan_id: number;
ext_pan_id: number[];
channel: number;
adapter_concurrent: undefined;
adapter_delay: undefined;
cache_state: true;
cache_state_persistent: true;
cache_state_send_on_startup: true;
last_seen: "disable";
elapsed: false;
network_key: number[];
timestamp_format: string;
output: "json";
enable_external_js: true;
};
health: {
interval: number;
reset_on_check: false;
};
};
CURRENT_VERSION: number;
};
//# sourceMappingURL=settings.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../lib/util/settings.ts"],"names":[],"mappings":"AAKA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAIhD,OAAO,EAAC,UAAU,EAAC,CAAC;AAGpB,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,8EAA8E;AAC9E,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAmD,CAAC;AAC5F,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAY9D,eAAO,MAAM,QAAQ;;;;;;;;;;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IAAI,CAKnD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAiChE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO3D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,GAAG,OAAO,CAiCnF;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAwB1E;AAED,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,eAAO,MAAM,OAAO;;iBAEL,IAAI;;;;;;;;;;;;;;;;;;gBA/pBD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;YAwBjB,QAAQ;gBACJ,MAAM;oBACF,IAAI;wBACA,SAAS;wBACT,WAAW;wBACX,MAAM;;oBAEV,IAAI;wBACA,WAAW;wBACX,MAAM;wBACN,SAAS;;oBAEb,IAAI;wBACA,MAAM;wBACN,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+nB3B,CAAC"}
-1019
View File
File diff suppressed because it is too large Load Diff
-11
View File
@@ -1,11 +0,0 @@
/**
* Order of execution:
* - Transfer
* - Change
* - Add
* - Remove
*
* Should allow the most flexibility whenever combination of migrations is necessary (e.g. Transfer + Change)
*/
export declare function migrateIfNecessary(): void;
//# sourceMappingURL=settingsMigration.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"settingsMigration.d.ts","sourceRoot":"","sources":["../../lib/util/settingsMigration.ts"],"names":[],"mappings":"AAshBA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAoGzC"}
-11
View File
@@ -1,11 +0,0 @@
import type { IncomingMessage, ServerResponse } from "node:http";
export type StaticFileServer = (request: IncomingMessage, response: ServerResponse) => void;
/** Terminal `404` handler for requests no file matched, mirroring the response `finalhandler` used to produce. */
export declare function sendNotFound(request: IncomingMessage, response: ServerResponse): void;
/**
* Serves `dir` on top of a plain `node:http` server, preferring the precompressed `.br`/`.gz` variant of a file when the client accepts it.
*
* Requests that match no file are answered by {@link sendNotFound}.
*/
export declare function createStaticFileServer(dir: string, logError: (message: string) => void): StaticFileServer;
//# sourceMappingURL=staticFileServer.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"staticFileServer.d.ts","sourceRoot":"","sources":["../../lib/util/staticFileServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAI/D,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;AAI5F,kHAAkH;AAClH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAYrF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAoCzG"}
-2
View File
@@ -1,2 +0,0 @@
export declare function stringify(value: object): string;
//# sourceMappingURL=stringify.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../lib/util/stringify.ts"],"names":[],"mappings":"AA2JA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
-96
View File
@@ -1,96 +0,0 @@
import type * as zhc from "zigbee-herdsman-converters";
import type { Zigbee2MQTTAPI, Zigbee2MQTTResponse, Zigbee2MQTTResponseEndpoints, Zigbee2MQTTScene } from "../types/api";
export declare const DEFAULT_BIND_GROUP_ID = 901;
declare function capitalize(s: string): string;
export declare function getZigbee2MQTTVersion(includeCommitHash?: boolean): Promise<{
commitHash?: string;
version: string;
}>;
declare function getDependencyVersion(depend: string): Promise<{
version: string;
}>;
declare function formatDate(time: number, type: "ISO_8601" | "ISO_8601_local" | "epoch" | "relative"): string | number;
declare function objectIsEmpty(object: object): boolean;
declare function objectHasProperties(object: {
[s: string]: unknown;
}, properties: string[]): boolean;
declare function equalsPartial(object: KeyValue, expected: KeyValue): boolean;
declare function getObjectProperty<T>(object: KeyValue, key: string, defaultValue: NoInfer<T>): T;
declare function getResponse<T extends Zigbee2MQTTResponseEndpoints>(request: KeyValue | string, data: Zigbee2MQTTAPI[T], error?: string): Zigbee2MQTTResponse<T>;
declare function parseJSON(value: string, fallback: string): KeyValue | string;
/**
* Delete all keys from passed object that have null/undefined values.
*
* @param {KeyValue} obj Object to process (in-place)
* @param {string[]} [ignoreKeys] Recursively ignore these keys in the object (keep null/undefined values).
*/
declare function removeNullPropertiesFromObject(obj: KeyValue, ignoreKeys?: string[]): void;
declare function toNetworkAddressHex(value: number): string;
declare function getAllFiles(path_: string): string[];
declare function validateFriendlyName(name: string, throwFirstError?: boolean): string[];
declare function sleep(seconds: number): Promise<void>;
declare function sanitizeImageParameter(parameter: string): string;
declare function isAvailabilityEnabledForEntity(entity: Device | Group, settings: Settings): boolean;
declare function isZHEndpoint(obj: unknown): obj is zh.Endpoint;
declare function flatten<Type>(arr: Type[][]): Type[];
declare function arrayUnique<Type>(arr: Type[]): Type[];
declare function isZHGroup(obj: unknown): obj is zh.Group;
export declare const hours: (hours: number) => number;
export declare const minutes: (minutes: number) => number;
export declare const seconds: (seconds: number) => number;
declare function publishLastSeen(data: eventdata.LastSeenChanged, settings: Settings, allowMessageEmitted: boolean, publishEntityState: PublishEntityState): Promise<void>;
declare function filterProperties(filter: string[] | undefined, data: KeyValue): void;
export declare function isNumericExpose(expose: zhc.Expose): expose is zhc.Numeric;
export declare function assertEnumExpose(expose: zhc.Expose): asserts expose is zhc.Enum;
export declare function assertNumericExpose(expose: zhc.Expose): asserts expose is zhc.Numeric;
export declare function assertBinaryExpose(expose: zhc.Expose): asserts expose is zhc.Binary;
export declare function isEnumExpose(expose: zhc.Expose): expose is zhc.Enum;
export declare function isBinaryExpose(expose: zhc.Expose): expose is zhc.Binary;
export declare function isLightExpose(expose: zhc.Expose): expose is zhc.Light;
export declare function assertString(value: unknown, property: string): asserts value is string;
declare function getScenes(entity: zh.Endpoint | zh.Group): Zigbee2MQTTScene[];
declare function deviceNotCoordinator(device: zh.Device): boolean;
declare function matchBase64File(value: string | undefined): {
extension: string;
data: string;
} | false;
declare function saveBase64DeviceIcon(base64Match: {
extension: string;
data: string;
}): string;
declare const noop: () => void;
declare const _default: {
matchBase64File: typeof matchBase64File;
saveBase64DeviceIcon: typeof saveBase64DeviceIcon;
capitalize: typeof capitalize;
getZigbee2MQTTVersion: typeof getZigbee2MQTTVersion;
getDependencyVersion: typeof getDependencyVersion;
formatDate: typeof formatDate;
objectIsEmpty: typeof objectIsEmpty;
objectHasProperties: typeof objectHasProperties;
equalsPartial: typeof equalsPartial;
getObjectProperty: typeof getObjectProperty;
getResponse: typeof getResponse;
parseJSON: typeof parseJSON;
removeNullPropertiesFromObject: typeof removeNullPropertiesFromObject;
toNetworkAddressHex: typeof toNetworkAddressHex;
isZHEndpoint: typeof isZHEndpoint;
isZHGroup: typeof isZHGroup;
hours: typeof hours;
minutes: typeof minutes;
seconds: typeof seconds;
validateFriendlyName: typeof validateFriendlyName;
sleep: typeof sleep;
sanitizeImageParameter: typeof sanitizeImageParameter;
isAvailabilityEnabledForEntity: typeof isAvailabilityEnabledForEntity;
publishLastSeen: typeof publishLastSeen;
getAllFiles: typeof getAllFiles;
filterProperties: typeof filterProperties;
flatten: typeof flatten;
arrayUnique: typeof arrayUnique;
getScenes: typeof getScenes;
deviceNotCoordinator: typeof deviceNotCoordinator;
noop: typeof noop;
};
export default _default;
//# sourceMappingURL=utils.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/util/utils.ts"],"names":[],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AgB,EAAE,CAiBrE;AAED,iBAAS,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,OAAO,CAExD;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,KAAK,CAS7F;AAED,iBAAS,oBAAoB,CAAC,WAAW,EAAE;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAOpF;AAGD,QAAA,MAAM,IAAI,QAAO,IAAU,CAAC"}
-17
View File
@@ -1,17 +0,0 @@
import { YAMLException } from "js-yaml";
export declare class YAMLFileException extends YAMLException {
file: string;
constructor(error: YAMLException, file: string);
}
declare function read(file: string): KeyValue;
declare function readIfExists(file: string, fallback?: KeyValue): KeyValue;
declare function writeIfChanged(file: string, content: KeyValue): void;
declare function updateIfChanged(file: string, key: string, value: KeyValue): void;
declare const _default: {
read: typeof read;
readIfExists: typeof readIfExists;
updateIfChanged: typeof updateIfChanged;
writeIfChanged: typeof writeIfChanged;
};
export default _default;
//# sourceMappingURL=yaml.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../lib/util/yaml.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,aAAa,EAAC,MAAM,SAAS,CAAC;AAElD,qBAAa,iBAAkB,SAAQ,aAAa;IAChD,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAQ7C;CACJ;AAED,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAYpC;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAa,GAAG,QAAQ,CAErE;AAED,iBAAS,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAM7D;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAMzE"}
-57
View File
@@ -1,57 +0,0 @@
import { Controller } from "zigbee-herdsman";
import Device from "./model/device";
import Group from "./model/group";
export default class Zigbee {
#private;
private eventBus;
private groupLookup;
private deviceLookup;
private coordinatorIeeeAddr;
constructor(eventBus: EventBus);
get zhController(): Controller;
start(abortSignal: AbortSignal): Promise<boolean>;
private logDeviceInterview;
private generateNetworkKey;
private generateExtPanID;
private generatePanID;
getCoordinatorVersion(): Promise<zh.CoordinatorVersion>;
isStopping(): boolean;
backup(): Promise<void>;
coordinatorCheck(): Promise<{
missingRouters: Device[];
}>;
getNetworkParameters(): Promise<zh.NetworkParameters>;
stop(): Promise<void>;
getPermitJoin(): boolean;
getPermitJoinEnd(): number | undefined;
permitJoin(time: number, device?: Device): Promise<void>;
resolveDevicesDefinitions(ignoreCache?: boolean, abortSignal?: AbortSignal | undefined): Promise<void>;
private resolveDevice;
private resolveGroup;
resolveEntity(key: string | number | zh.Device): Device | Group | undefined;
resolveEntityAndEndpoint(id: string): {
ID: string;
entity: Device | Group | undefined;
endpointID?: string;
endpoint?: zh.Endpoint;
};
firstCoordinatorEndpoint(): zh.Endpoint;
devicesAndGroupsIterator(devicePredicate?: (value: zh.Device) => boolean, groupPredicate?: (value: zh.Group) => boolean): Generator<Device | Group>;
groupsIterator(predicate?: (value: zh.Group) => boolean): Generator<Group>;
devicesIterator(predicate?: (value: zh.Device) => boolean): Generator<Device>;
private acceptJoiningDeviceHandler;
touchlinkFactoryResetFirst(): Promise<boolean>;
touchlinkFactoryReset(ieeeAddr: string, channel: number): Promise<boolean>;
addInstallCode(installCode: string): Promise<void>;
touchlinkIdentify(ieeeAddr: string, channel: number): Promise<void>;
touchlinkScan(): Promise<{
ieeeAddr: string;
channel: number;
}[]>;
createGroup(id: number): Group;
deviceByNetworkAddress(networkAddress: number): Device | undefined;
groupByID(id: number): Group | undefined;
removeDeviceFromLookup(ieee: string): boolean;
removeGroupFromLookup(id: number): boolean;
}
//# sourceMappingURL=zigbee.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"zigbee.d.ts","sourceRoot":"","sources":["../lib/zigbee.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,eAAe,CAAC;AASlC,MAAM,CAAC,OAAO,OAAO,MAAM;;IAEvB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,WAAW,CAA2C;IAC9D,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,mBAAmB,CAAU;IAErC,YAAY,QAAQ,EAAE,QAAQ,EAE7B;IAED,IAAI,YAAY,eAEf;IAEK,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CA6JtD;IAED,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,aAAa;IAMf,qBAAqB,IAAI,OAAO,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAE5D;IAED,UAAU,IAAI,OAAO,CAEpB;IAEK,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAEK,gBAAgB,IAAI,OAAO,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAC,CAAC,CAI5D;IAEK,oBAAoB,IAAI,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAE1D;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAI1B;IAED,aAAa,IAAI,OAAO,CAEvB;IAED,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErC;IAEK,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,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AE/E;IAEK,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD;IAEK,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;IAEK,aAAa,IAAI,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC,CAEpE;IAED,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAI7B;IAED,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;IAED,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAEvC;IAED,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;IAED,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEzC;CACJ"}
+20
View File
@@ -0,0 +1,20 @@
FROM alpine:3.7
# Copy files
ADD . /app
RUN cp /app/data/configuration.yaml /app
RUN cp /app/docker/run.sh /app
RUN chmod +x /app/run.sh
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json
# Install dependencies
RUN apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev git
# Entrypoint
ENTRYPOINT ["./run.sh"]
+22
View File
@@ -0,0 +1,22 @@
FROM arm32v6/alpine:3.7
# Setup cross-build
ENV QEMU_EXECVE 1
COPY docker/qemu-arm-static /usr/bin
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN [ "qemu-arm-static", "/bin/sh", "-c", "echo {\\\"hash\\\": \\\"$COMMIT\\\"} > .hash.json" ]
# Copy files & install dependencies
ADD . /app
RUN [ "qemu-arm-static", "/bin/sh", "-c", \
"cp /app/data/configuration.yaml /app && \
cp /app/docker/run.sh /app && chmod +x /app/run.sh && \
apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev git"]
# Entrypoint
ENTRYPOINT ["./run.sh"]
+22
View File
@@ -0,0 +1,22 @@
FROM arm64v8/alpine:3.7
# Setup cross-build
ENV QEMU_EXECVE 1
COPY docker/qemu-aarch64-static /usr/bin
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN [ "qemu-aarch64-static", "/bin/sh", "-c", "echo {\\\"hash\\\": \\\"$COMMIT\\\"} > .hash.json" ]
# Copy files & install dependencies
ADD . /app
RUN [ "qemu-aarch64-static", "/bin/sh", "-c", \
"cp /app/data/configuration.yaml /app && \
cp /app/docker/run.sh /app && chmod +x /app/run.sh && \
apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev git"]
# Entrypoint
ENTRYPOINT ["./run.sh"]
+1
View File
@@ -0,0 +1 @@
qemu-aarch64-static and qemu-arm-static are taken from https://github.com/resin-io/qemu/releases/tag/v2.9.0%2Bresin1
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
if [ ! -z "$ZIGBEE2MQTT_DATA" ]; then
DATA="$ZIGBEE2MQTT_DATA"
else
DATA="/app/data"
fi
echo "Using '$DATA' as data directory"
if [ ! -f "$DATA/configuration.yaml" ]; then
echo "Creating configuration file..."
cp /app/configuration.yaml "$DATA/configuration.yaml"
fi
if [ ! -z "$DEBUG" ]; then
npm start
else
DEBUG="$DEBUG" npm start
fi
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

+10
View File
@@ -0,0 +1,10 @@
const Controller = require('./lib/controller');
const controller = new Controller();
controller.start();
process.on('SIGINT', handleQuit);
function handleQuit() {
controller.stop(() => process.exit());
}
+553
View File
@@ -0,0 +1,553 @@
const MQTT = require('./mqtt');
const Zigbee = require('./zigbee');
const logger = require('./util/logger');
const settings = require('./util/settings');
const zigbeeShepherdConverters = require('zigbee-shepherd-converters');
const homeassistant = require('./homeassistant');
const objectAssignDeep = require(`object-assign-deep`);
const mqttConfigRegex = new RegExp(`${settings.get().mqtt.base_topic}/bridge/config/\\w+`, 'g');
const mqttDeviceRegex = new RegExp(`${settings.get().mqtt.base_topic}/[\\w\\s\\d]+/set`, 'g');
const mqttDevicePrefixRegex = new RegExp(`${settings.get().mqtt.base_topic}/[\\w\\s\\d]+/[\\w\\s\\d]+/set`, 'g');
const pollInterval = 60 * 1000; // seconds * 1000.
const softResetTimeout = 3600 * 1000; // seconds * 1000.
const allowedLogLevels = ['error', 'warn', 'info', 'debug'];
/**
* Home Assistant requires ALL attributes to be present in ALL MQTT messages send by the device.
* https://community.home-assistant.io/t/missing-value-with-mqtt-only-last-data-set-is-shown/47070/9
*
* Therefore zigbee2mqtt BY DEFAULT caches all values and resend it with every message.
* advanced.cache_state in configuration.yaml allows to configure this.
* https://github.com/Koenkk/zigbee2mqtt/wiki/Configuration
*/
const cacheState = settings.get().advanced && settings.get().advanced.cache_state === false ? false : true;
if (settings.get().homeassistant && !cacheState) {
logger.warn('In order for Home Assistant integration to work properly set `cache_state: true');
}
class Controller {
constructor() {
this.zigbee = new Zigbee();
this.mqtt = new MQTT();
this.stateCache = {};
this.configured = [];
this.handleZigbeeMessage = this.handleZigbeeMessage.bind(this);
this.handleMQTTMessage = this.handleMQTTMessage.bind(this);
}
start() {
this.startupLogVersion(() => {
this.zigbee.start(this.handleZigbeeMessage, (error) => {
if (error) {
logger.error('Failed to start', error);
} else {
// Log zigbee clients on startup and configure.
const devices = this.zigbee.getAllClients();
logger.info(`Currently ${devices.length} devices are joined:`);
devices.forEach((device) => {
logger.info(this.getDeviceStartupLogMessage(device));
this.configureDevice(device);
});
// Enable zigbee join.
if (settings.get().permit_join) {
logger.warn('`permit_join` set to `true` in configuration.yaml.');
logger.warn('Allowing new devices to join.');
logger.warn('Set `permit_join` to `false` once you joined all devices.');
this.zigbee.permitJoin(true);
}
// Start timers.
this.pollTimer(true);
this.softResetTimeout(true);
// Connect to MQTT broker
const subscriptions = [
`${settings.get().mqtt.base_topic}/+/set`,
`${settings.get().mqtt.base_topic}/+/+/set`,
`${settings.get().mqtt.base_topic}/bridge/config/+`,
];
if (settings.get().homeassistant) {
subscriptions.push('hass/status');
}
this.mqtt.connect(this.handleMQTTMessage, subscriptions, () => this.handleMQTTConnected());
}
});
});
}
handleMQTTConnected() {
// Home Assistant MQTT discovery on MQTT connected.
if (settings.get().homeassistant) {
// MQTT discovery of all paired devices on startup.
this.zigbee.getAllClients().forEach((device) => {
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
if (mappedModel) {
homeassistant.discover(device.ieeeAddr, mappedModel.model, this.mqtt, true);
}
});
}
// Resend all cached states.
this.sendAllCachedStates();
}
sendAllCachedStates() {
this.zigbee.getAllClients().forEach((device) => {
if (this.stateCache.hasOwnProperty(device.ieeeAddr)) {
this.mqttPublishDeviceState(device.ieeeAddr, this.stateCache[device.ieeeAddr], false);
}
});
}
softResetTimeout(start) {
if (this._softResetTimer) {
clearTimeout(this._softResetTimer);
this._softResetTimer = null;
}
if (start) {
this._softResetTimer = setTimeout(() => {
this.zigbee.softReset((error) => {
if (error) {
logger.warn('Soft reset error', error);
this.zigbee.stop((error) => {
logger.warn('Zigbee stopped');
this.zigbee.start(this.handleZigbeeMessage, (error) => {
if (error) {
logger.error('Failed to restart!');
}
});
});
} else {
logger.warn('Soft resetted zigbee');
}
this.softResetTimeout(true);
});
}, softResetTimeout);
}
}
pollTimer(start) {
// Some routers need polling to prevent them from sleeping.
if (start && !this._pollTimer) {
this._pollTimer = setInterval(() => {
const devices = this.zigbee.getAllClients().filter((d) => {
const power = d.powerSource ? d.powerSource.toLowerCase().split(' ')[0] : 'unknown';
return power !== 'battery' && power !== 'unknown' && d.type === 'Router';
});
devices.forEach((d) => this.zigbee.ping(d.ieeeAddr));
}, pollInterval);
} else if (!start && this._pollTimer) {
clearTimeout(this._pollTimer);
this._pollTimer = null;
}
}
stop(callback) {
this.mqtt.disconnect();
this.pollTimer(false);
this.softResetTimeout(false);
this.zigbee.stop(callback);
}
configureDevice(device) {
const ieeeAddr = device.ieeeAddr;
if (ieeeAddr && device.modelId && !this.configured.includes(ieeeAddr)) {
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
// Call configure function of device.
if (mappedModel && mappedModel.configure) {
mappedModel.configure(ieeeAddr, this.zigbee.shepherd, this.zigbee.getCoordinator(), (ok, msg) => {
if (ok) {
logger.info(`Succesfully configured ${ieeeAddr}`);
} else {
logger.error(`Failed to configure ${ieeeAddr}`);
}
});
}
// Setup an OnAfIncomingMsg handler if needed.
if (mappedModel && mappedModel.onAfIncomingMsg) {
mappedModel.onAfIncomingMsg.forEach((ep) => this.zigbee.registerOnAfIncomingMsg(ieeeAddr, ep));
}
this.configured.push(ieeeAddr);
}
}
getDeviceStartupLogMessage(device) {
let friendlyName = 'unknown';
let type = 'unknown';
let friendlyDevice = {model: 'unkown', description: 'unknown'};
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
if (mappedModel) {
friendlyDevice = mappedModel;
}
if (settings.getDevice(device.ieeeAddr)) {
friendlyName = settings.getDevice(device.ieeeAddr).friendly_name;
}
if (device.type) {
type = device.type;
}
return `${friendlyName} (${device.ieeeAddr}): ${friendlyDevice.model} - ` +
`${friendlyDevice.vendor} ${friendlyDevice.description} (${type})`;
}
handleZigbeeMessage(message) {
// Zigbee message receieved, reset soft reset timeout.
this.softResetTimeout(true);
logger.debug('Recieved zigbee message with data', JSON.stringify(message.data));
if (message.type == 'devInterview' && !settings.getDevice(message.data)) {
logger.info('Connecting with device...');
this.mqtt.log('pairing', 'connecting with device');
}
if (message.type == 'devIncoming') {
logger.info('Device incoming...');
this.mqtt.log('pairing', 'device incoming');
}
// We dont handle messages without endpoints.
if (!message.endpoints) {
return;
}
const device = message.endpoints[0].device;
if (!device) {
logger.warn('Message without device!');
return;
}
// Check if this is a new device.
if (!settings.getDevice(device.ieeeAddr)) {
logger.info(`New device with address ${device.ieeeAddr} connected!`);
settings.addDevice(device.ieeeAddr);
this.mqtt.log('device_connected', device.ieeeAddr);
}
// We can't handle devices without modelId.
if (!device.modelId) {
return;
}
// Map Zigbee modelID to vendor modelID.
const modelID = message.endpoints[0].device.modelId;
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(modelID);
if (!mappedModel) {
logger.warn(`Device with modelID '${modelID}' is not supported.`);
logger.warn(`Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices`);
return;
}
// Configure device.
this.configureDevice(device);
// Home Assistant MQTT discovery
if (settings.get().homeassistant) {
homeassistant.discover(device.ieeeAddr, mappedModel.model, this.mqtt, false);
}
// After this point we cant handle message withoud cid anymore.
if (!message.data || (!message.data.cid && !message.data.cmdId)) {
return;
}
// Find a conveter for this message.
const cid = message.data.cid;
const cmdId = message.data.cmdId;
const converters = mappedModel.fromZigbee.filter((c) => {
if (cid) {
return c.cid === cid && c.type === message.type;
} else if (cmdId) {
return c.cmd === cmdId;
}
return false;
});
if (!converters.length) {
if (cid) {
logger.warn(
`No converter available for '${mappedModel.model}' with cid '${cid}' and type '${message.type}'`
);
} else if (cmdId) {
logger.warn(`No converter available for '${mappedModel.model}' with cmd '${cmdId}'`);
}
logger.warn(`Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.`);
return;
}
// Convert this Zigbee message to a MQTT message.
// Get payload for the message.
// - If a payload is returned publish it to the MQTT broker
// - If NO payload is returned do nothing. This is for non-standard behaviour
// for e.g. click switches where we need to count number of clicks and detect long presses.
converters.forEach((converter) => {
const publish = (payload) => {
// Don't cache messages with following properties:
const dontCacheProperties = ['click', 'action', 'button', 'button_left', 'button_right'];
let cache = true;
dontCacheProperties.forEach((property) => {
if (payload.hasOwnProperty(property)) {
cache = false;
}
});
this.mqttPublishDeviceState(device.ieeeAddr, payload, cache);
};
const payload = converter.convert(mappedModel, message, publish, settings.getDevice(device.ieeeAddr));
if (payload) {
publish(payload);
}
});
}
handleMQTTMessage(topic, message) {
logger.debug(`Recieved mqtt message on topic '${topic}' with data '${message}'`);
if (topic.match(mqttConfigRegex)) {
this.handleMQTTMessageConfig(topic, message);
} else if (topic.match(mqttDeviceRegex) || topic.match(mqttDevicePrefixRegex)) {
this.handleMQTTMessageDevice(topic, message, topic.match(mqttDevicePrefixRegex));
} else if (topic === 'hass/status') {
if (message.toString().toLowerCase() === 'online') {
const timer = setTimeout(() => {
this.sendAllCachedStates();
clearTimeout(timer);
}, 20000);
}
} else {
logger.warn(`Cannot handle MQTT message with topic '${topic}' and message '${message}'`);
}
}
handleMQTTMessageConfig(topic, message) {
const option = topic.split('/')[3];
if (option === 'permit_join') {
this.zigbee.permitJoin(message.toString().toLowerCase() === 'true');
} else if (option === 'log_level') {
const level = message.toString().toLowerCase();
if (allowedLogLevels.includes(level)) {
logger.info(`Switching log level to '${level}'`);
logger.transports.console.level = level;
logger.transports.file.level = level;
} else {
logger.error(`Could not set log level to '${level}'. Allowed level: '${allowedLogLevels.join(',')}'`);
}
} else if (option === 'devices') {
const devices = this.zigbee.getAllClients().map((device) => {
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
const friendlyDevice = settings.getDevice(device.ieeeAddr);
return {
ieeeAddr: device.ieeeAddr,
type: device.type,
model: mappedModel ? mappedModel.model : device.modelId,
friendly_name: friendlyDevice ? friendlyDevice.friendly_name : device.ieeeAddr,
};
});
this.mqtt.log('devices', devices);
} else if (option === 'remove') {
message = message.toString();
const IDByFriendlyName = settings.getIDByFriendlyName(message);
const deviceID = IDByFriendlyName ? IDByFriendlyName : message;
const device = this.zigbee.getDevice(deviceID);
const cleanup = () => {
// Clear Home Assistant MQTT discovery message
if (settings.get().homeassistant && device) {
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
if (mappedModel) {
homeassistant.clear(deviceID, mappedModel.model, this.mqtt);
}
}
// Remove from configuration.yaml
settings.removeDevice(deviceID);
logger.info(`Successfully removed ${deviceID}`);
this.mqtt.log('device_removed', message);
};
// Remove from zigbee network.
if (device) {
this.zigbee.removeDevice(deviceID, (error) => {
if (!error) {
cleanup();
} else {
logger.error(`Failed to remove ${deviceID}`);
}
});
} else {
cleanup();
}
} else {
logger.warn(`Cannot handle MQTT config option '${option}' with message '${message}'`);
}
}
handleMQTTMessageDevice(topic, message, withPrefix) {
const friendlyName = topic.split('/')[1];
const topicPrefix = withPrefix ? topic.split('/')[2] : '';
// Map friendlyName to deviceID.
const deviceID = settings.getIDByFriendlyName(friendlyName);
if (!deviceID) {
logger.error(`Cannot handle '${topic}' because deviceID of '${friendlyName}' cannot be found`);
return;
}
// Convert the MQTT message to a Zigbee message.
let json = null;
try {
json = JSON.parse(message);
} catch (e) {
// Cannot be parsed to JSON, assume state message.
json = {state: message.toString()};
}
// Find ep for this device
const device = this.zigbee.getDevice(deviceID);
if (!device) {
logger.error(`Failed to find device with deviceID ${deviceID}`);
return;
}
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
if (!mappedModel) {
logger.warn(`Device with modelID '${device.modelId}' is not supported.`);
logger.warn(`Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices`);
return;
}
const ep = mappedModel.ep && mappedModel.ep[topicPrefix] ? mappedModel.ep[topicPrefix] : null;
const published = [];
Object.keys(json).forEach((key) => {
// Find converter for this key.
const converter = mappedModel.toZigbee.find((c) => c.key === key);
if (!converter) {
logger.error(`No converter available for '${key}' (${json[key]})`);
return;
}
const message = converter.convert(json[key], json);
if (!message) {
return;
}
const callback = (error) => {
// Devices do not report when they go off, this ensures state (on/off) is always in sync.
if (!error && key.startsWith('state')) {
const msg = {};
const _key = topicPrefix ? `${key}_${topicPrefix}` : key;
msg[_key] = json[key];
this.mqttPublishDeviceState(deviceID, msg, true);
}
};
this.zigbee.publish(deviceID, message.cid, message.cmd, message.zclData, ep, callback);
published.push({message: message, converter: converter});
});
/**
* After publishing a command to a zigbee device we want to monitor the changed attribute(s) so that
* everything stays in sync.
*/
published.forEach((p) => {
let counter = 0;
let secondsToMonitor = 1;
// In case of a transition we need to monitor for the whole transition time.
if (p.message.zclData.hasOwnProperty('transtime')) {
// Note that: transtime 10 = 0.1 seconds, 100 = 1 seconds, etc.
secondsToMonitor = (p.message.zclData.transtime / 10) + 1;
}
const timer = setInterval(() => {
counter++;
// Doing a 'read' will result in the device sending a zigbee message with the current attribute value.
// which will be handled by this.handleZigbeeMessage.
p.converter.attr.forEach((attribute) => {
this.zigbee.read(deviceID, p.message.cid, attribute, ep, () => null);
});
if (counter >= secondsToMonitor) {
clearTimeout(timer);
}
}, 1000);
});
}
mqttPublishDeviceState(deviceID, payload, cache) {
if (cacheState) {
// Add cached state to payload
if (this.stateCache[deviceID]) {
payload = objectAssignDeep.noMutate(this.stateCache[deviceID], payload);
}
// Update state cache with new state.
if (cache) {
this.stateCache[deviceID] = payload;
}
}
const deviceSettings = settings.getDevice(deviceID);
const options = {
retain: deviceSettings.retain,
qos: deviceSettings.qos ? deviceSettings.qos : 0,
};
this.mqtt.publish(deviceSettings.friendly_name, JSON.stringify(payload), options);
}
startupLogVersion(callback) {
const git = require('git-last-commit');
const packageJSON = require('../package.json');
const version = packageJSON.version;
git.getLastCommit((err, commit) => {
let commitHash = null;
if (err) {
try {
commitHash = require('../.hash.json').hash;
} catch (error) {
commitHash = 'unknown';
}
} else {
commitHash = commit.shortHash;
}
logger.info(`Starting zigbee2mqtt version ${version} (commit #${commitHash})`);
callback();
});
}
}
module.exports = Controller;
+355
View File
@@ -0,0 +1,355 @@
const settings = require('./util/settings');
const configurations = {
// Binary sensor
'binary_sensor_occupancy': {
type: 'binary_sensor',
object_id: 'occupancy',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.occupancy }}',
device_class: 'motion',
json_attributes: ['battery', 'voltage'],
},
},
'binary_sensor_contact': {
type: 'binary_sensor',
object_id: 'contact',
discovery_payload: {
payload_on: false,
payload_off: true,
value_template: '{{ value_json.contact }}',
device_class: 'door',
json_attributes: ['battery', 'voltage'],
},
},
'binary_sensor_water_leak': {
type: 'binary_sensor',
object_id: 'water_leak',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.water_leak }}',
device_class: 'moisture',
json_attributes: ['battery', 'voltage'],
},
},
'binary_sensor_smoke': {
type: 'binary_sensor',
object_id: 'smoke',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.smoke }}',
device_class: 'smoke',
json_attributes: ['battery', 'voltage'],
},
},
'binary_sensor_router': {
type: 'binary_sensor',
object_id: 'router',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.state }}',
device_class: 'connectivity',
json_attributes: ['description', 'type', 'rssi'],
},
},
// Sensor
'sensor_illuminance': {
type: 'sensor',
object_id: 'illuminance',
discovery_payload: {
unit_of_measurement: 'lx',
icon: 'mdi:theme-light-dark',
value_template: '{{ value_json.illuminance }}',
json_attributes: ['battery', 'voltage'],
},
},
'sensor_humidity': {
type: 'sensor',
object_id: 'humidity',
discovery_payload: {
unit_of_measurement: '%',
icon: 'mdi:water-percent',
value_template: '{{ value_json.humidity }}',
json_attributes: ['battery', 'voltage'],
},
},
'sensor_temperature': {
type: 'sensor',
object_id: 'temperature',
discovery_payload: {
unit_of_measurement: '°C',
icon: 'mdi:temperature-celsius',
value_template: '{{ value_json.temperature }}',
json_attributes: ['battery', 'voltage'],
},
},
'sensor_pressure': {
type: 'sensor',
object_id: 'pressure',
discovery_payload: {
unit_of_measurement: 'Pa',
icon: 'mdi:speedometer',
value_template: '{{ value_json.pressure }}',
json_attributes: ['battery', 'voltage'],
},
},
'sensor_click': {
type: 'sensor',
object_id: 'click',
discovery_payload: {
icon: 'mdi:toggle-switch',
value_template: '{{ value_json.click }}',
json_attributes: ['battery', 'voltage', 'action', 'duration'],
},
},
'sensor_power': {
type: 'sensor',
object_id: 'power',
discovery_payload: {
unit_of_measurement: 'Watt',
icon: 'mdi:flash',
value_template: '{{ value_json.power }}',
json_attributes: ['voltage', 'temperature', 'consumption', 'current', 'power_factor'],
},
},
'sensor_action': {
type: 'sensor',
object_id: 'action',
discovery_payload: {
icon: 'mdi:cube',
value_template: '{{ value_json.action }}',
json_attributes: ['battery', 'voltage', 'angle', 'side', 'from_side', 'to_side'],
},
},
'sensor_brightness': {
type: 'sensor',
object_id: 'brightness',
discovery_payload: {
unit_of_measurement: 'brightness',
icon: 'mdi:brightness-5',
value_template: '{{ value_json.brightness }}',
json_attributes: [],
},
},
// Light
'light_brightness_colortemp_xy': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
color_temp: true,
xy: true,
platform: 'mqtt_json',
command_topic: true,
},
},
'light_brightness_xy': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
xy: true,
platform: 'mqtt_json',
command_topic: true,
},
},
'light_brightness_colortemp': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
color_temp: true,
platform: 'mqtt_json',
command_topic: true,
},
},
'light_brightness': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
platform: 'mqtt_json',
command_topic: true,
},
},
// Switch
'switch': {
type: 'switch',
object_id: 'switch',
discovery_payload: {
payload_off: 'OFF',
payload_on: 'ON',
value_template: '{{ value_json.state }}',
command_topic: true,
},
},
'switch_left': {
type: 'switch',
object_id: 'switch_left',
discovery_payload: {
payload_off: 'OFF',
payload_on: 'ON',
value_template: '{{ value_json.state_left }}',
command_topic: true,
command_topic_prefix: 'left',
},
},
'switch_right': {
type: 'switch',
object_id: 'switch_right',
discovery_payload: {
payload_off: 'OFF',
payload_on: 'ON',
value_template: '{{ value_json.state_right }}',
command_topic: true,
command_topic_prefix: 'right',
},
},
};
// Map homeassitant configurations to devices.
const mapping = {
'WXKG01LM': [configurations.sensor_click],
'WXKG11LM': [configurations.sensor_click],
'WXKG12LM': [configurations.sensor_click],
'WXKG03LM': [configurations.sensor_click],
'WXKG02LM': [configurations.sensor_click],
'QBKG04LM': [configurations.switch],
'QBKG03LM': [configurations.switch_left, configurations.switch_right],
'WSDCGQ01LM': [configurations.sensor_temperature, configurations.sensor_humidity],
'WSDCGQ11LM': [configurations.sensor_temperature, configurations.sensor_humidity, configurations.sensor_pressure],
'RTCGQ01LM': [configurations.binary_sensor_occupancy],
'RTCGQ11LM': [configurations.binary_sensor_occupancy, configurations.sensor_illuminance],
'MCCGQ01LM': [configurations.binary_sensor_contact],
'MCCGQ11LM': [configurations.binary_sensor_contact],
'SJCGQ11LM': [configurations.binary_sensor_water_leak],
'MFKZQ01LM': [configurations.sensor_action],
'ZNCZ02LM': [configurations.switch, configurations.sensor_power],
'QBCZ11LM': [configurations.switch, configurations.sensor_power],
'LED1545G12': [configurations.light_brightness_colortemp],
'LED1623G12': [configurations.light_brightness],
'LED1622G12': [configurations.light_brightness],
'LED1537R6': [configurations.light_brightness_colortemp],
'LED1650R5': [configurations.light_brightness],
'LED1536G5': [configurations.light_brightness_colortemp],
'7146060PH': [configurations.light_brightness_colortemp_xy],
'F7C033': [configurations.light_brightness],
'JTYJ-GD-01LM/BW': [configurations.binary_sensor_smoke],
'PLUG EDP RE:DY': [configurations.switch, configurations.sensor_power],
'CC2530.ROUTER': [configurations.binary_sensor_router],
'AA70155': [configurations.light_brightness_colortemp],
'AA69697': [configurations.light_brightness_colortemp_xy],
'HALIGHTDIMWWE27': [configurations.light_brightness],
'AB3257001NJ': [configurations.switch],
'8718696449691': [configurations.light_brightness],
'RB 185 C': [configurations.light_brightness_colortemp_xy],
'9290012573A': [configurations.light_brightness_colortemp_xy],
'LED1624G9': [configurations.light_brightness_xy],
'73742': [configurations.light_brightness_colortemp],
'73740': [configurations.light_brightness_colortemp],
'22670': [configurations.light_brightness],
'ICTC-G-1': [configurations.sensor_brightness],
'ICPSHC24-30EU-IL-1': [configurations.light_brightness],
'45852GE': [configurations.light_brightness],
'E11-G13': [configurations.light_brightness],
'LED1649C5': [configurations.light_brightness],
'ICPSHC24-10EU-IL-1': [configurations.light_brightness],
'LED1546G12': [configurations.light_brightness_colortemp],
'L1527': [configurations.light_brightness_colortemp],
'L1529': [configurations.light_brightness_colortemp],
'L1528': [configurations.light_brightness_colortemp],
'RB 165': [configurations.light_brightness],
'RB 175 W': [configurations.light_brightness],
'RS 125': [configurations.light_brightness],
'RB 145': [configurations.light_brightness],
'PL 110': [configurations.light_brightness],
'ST 110': [configurations.light_brightness],
'UC 110': [configurations.light_brightness],
'DL 110 N': [configurations.light_brightness],
'DL 110 W': [configurations.light_brightness],
'SL 110 N': [configurations.light_brightness],
'SL 110 M': [configurations.light_brightness],
'SL 110 W': [configurations.light_brightness],
'AA68199': [configurations.light_brightness_colortemp],
'QBKG11LM': [configurations.switch, configurations.sensor_power],
'QBKG12LM': [configurations.switch_left, configurations.switch_right, configurations.sensor_power],
'K2RGBW01': [configurations.light_brightness_colortemp_xy],
'9290011370': [configurations.light_brightness],
'DNCKATSW001': [configurations.switch],
'Z809A': [configurations.switch, configurations.sensor_power],
'NL08-0800': [configurations.light_brightness],
'915005106701': [configurations.light_brightness_colortemp_xy],
'AB32840': [configurations.light_brightness_colortemp],
};
// A map of all discoverd devices
const discovered = {};
function discover(deviceID, model, mqtt, force) {
// Check if already discoverd and check if there are configs.
const discover = force || !discovered[deviceID];
if (!discover || !mapping[model] || !settings.getDevice(deviceID)) {
return;
}
const friendlyName = settings.getDevice(deviceID).friendly_name;
mapping[model].forEach((config) => {
const topic = `${config.type}/${deviceID}/${config.object_id}/config`;
const payload = config.discovery_payload;
payload.state_topic = `${settings.get().mqtt.base_topic}/${friendlyName}`;
payload.availability_topic = `${settings.get().mqtt.base_topic}/bridge/state`;
// Set unique names in cases this device produces multiple entities in homeassistant.
payload.name = mapping[model].length > 1 ? `${friendlyName}_${config.object_id}` : friendlyName;
// Only set unique_id when user did not set a friendly_name yet,
// see https://github.com/Koenkk/zigbee2mqtt/issues/138
if (deviceID === friendlyName) {
payload.unique_id = `${deviceID}_${config.object_id}_${settings.get().mqtt.base_topic}`;
}
if (payload.command_topic) {
payload.command_topic = `${settings.get().mqtt.base_topic}/${friendlyName}/`;
if (payload.command_topic_prefix) {
payload.command_topic += `${payload.command_topic_prefix}/`;
}
payload.command_topic += 'set';
}
mqtt.publish(topic, JSON.stringify(payload), {retain: true, qos: 0}, null, 'homeassistant');
});
discovered[deviceID] = true;
}
function clear(deviceID, model, mqtt) {
// Check if there are configs.
if (!mapping[model]) {
return;
}
mapping[model].forEach((config) => {
const topic = `${config.type}/${deviceID}/${config.object_id}/config`;
const payload = '';
mqtt.publish(topic, payload, {retain: true, qos: 0}, null, 'homeassistant');
});
discovered[deviceID] = false;
}
module.exports = {
mapping: mapping,
discover: (deviceID, model, mqtt, force) => discover(deviceID, model, mqtt, force),
clear: (deviceID, model, mqtt) => clear(deviceID, model, mqtt),
};
+85
View File
@@ -0,0 +1,85 @@
const mqtt = require('mqtt');
const logger = require('./util/logger');
const settings = require('./util/settings');
class MQTT {
constructor() {
this.handleConnect = this.handleConnect.bind(this);
this.handleMessage = this.handleMessage.bind(this);
}
connect(onMessage, subscriptions, callback) {
const mqttSettings = settings.get().mqtt;
logger.info(`Connecting to MQTT server at ${mqttSettings.server}`);
const options = {};
if (mqttSettings.user && mqttSettings.password) {
options.username = mqttSettings.user;
options.password = mqttSettings.password;
}
this.client = mqtt.connect(mqttSettings.server, options);
// Register callbacks.
this.client.on('connect', () => {
this.handleConnect();
callback();
});
this.client.on('message', this.handleMessage);
// Set timer at interval to check if connected to MQTT server.
const interval = 10 * 1000; // seconds * 1000.
this.connectionTimer = setInterval(() => {
if (this.client.reconnecting) {
logger.error('Not connected to MQTT server!');
}
}, interval);
this.onMessage = onMessage;
this.subscriptions = subscriptions;
}
disconnect() {
clearTimeout(this.connectionTimer);
this.connectionTimer = null;
this.publish('bridge/state', 'offline', {retain: true, qos: 0}, () => {
logger.info('Disconnecting from MQTT server');
this.client.end();
});
}
handleConnect() {
logger.info('Connected to MQTT server');
this.publish('bridge/state', 'online', {retain: true, qos: 0});
this.subscriptions.forEach((topic) => this.client.subscribe(topic));
}
handleMessage(topic, message) {
if (this.onMessage) {
this.onMessage(topic, message);
}
}
publish(topic, payload, options, callback, baseTopic) {
baseTopic = baseTopic ? baseTopic : settings.get().mqtt.base_topic;
topic = `${baseTopic}/${topic}`;
if (!this.client || this.client.reconnecting) {
logger.error(`Not connected to MQTT server!`);
logger.error(`Cannot send message: topic: '${topic}', payload: '${payload}`);
return;
}
logger.info(`MQTT publish, topic: '${topic}', payload: '${payload}'`);
this.client.publish(topic, payload, options, callback);
}
log(type, message) {
const payload = {type: type, message: message};
this.publish('bridge/log', JSON.stringify(payload), {retain: false});
}
}
module.exports = MQTT;
+14
View File
@@ -0,0 +1,14 @@
const path = require('path');
let dataPath = null;
if (process.env.ZIGBEE2MQTT_DATA) {
dataPath = process.env.ZIGBEE2MQTT_DATA;
} else {
dataPath = path.join(__dirname, '..', '..', 'data');
dataPath = path.normalize(dataPath);
}
module.exports = {
joinPath: (file) => path.join(dataPath, file),
};
+37
View File
@@ -0,0 +1,37 @@
const winston = require('winston');
const data = require('./data');
const settings = require('./settings');
let logLevel = '';
if (process.env.DEBUG) {
logLevel = 'debug';
} else if (settings.get().advanced && settings.get().advanced.log_level) {
logLevel = settings.get().advanced.log_level;
} else {
logLevel = winston.level.info;
}
const logger = new (winston.Logger)({
transports: [
new (winston.transports.File)({
filename: data.joinPath('log.txt'),
json: false,
level: logLevel,
maxFiles: 3,
maxsize: 10000000, // 10MB
}),
new (winston.transports.Console)({
timestamp: () => new Date().toLocaleString(),
formatter: function(options) {
return options.timestamp() + ' ' +
winston.config.colorize(options.level, options.level.toUpperCase()) + ' ' +
(options.message ? options.message : '') +
(options.meta && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' );
},
}),
],
});
logger.transports.console.level = logLevel;
module.exports = logger;

Some files were not shown because too many files have changed in this diff Show More