@willieee802/zigbee-herdsman 0.36.0 → 0.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +317 -0
- package/dist/adapter/adapter.d.ts +14 -13
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.js +15 -17
- package/dist/adapter/adapter.js.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +14 -12
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +118 -128
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
- package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/driver.js +44 -44
- package/dist/adapter/deconz/driver/driver.js.map +1 -1
- package/dist/adapter/deconz/driver/frameParser.js +43 -43
- package/dist/adapter/deconz/driver/frameParser.js.map +1 -1
- package/dist/adapter/deconz/driver/parser.js +6 -6
- package/dist/adapter/deconz/driver/parser.js.map +1 -1
- package/dist/adapter/deconz/driver/writer.js +3 -3
- package/dist/adapter/deconz/driver/writer.js.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +32 -36
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +418 -446
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
- package/dist/adapter/ember/adapter/endpoints.d.ts +5 -3
- package/dist/adapter/ember/adapter/endpoints.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/endpoints.js +33 -31
- package/dist/adapter/ember/adapter/endpoints.js.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.d.ts +10 -2
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.js +19 -5
- package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
- package/dist/adapter/ember/adapter/requestQueue.d.ts +2 -4
- package/dist/adapter/ember/adapter/requestQueue.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/requestQueue.js +16 -21
- package/dist/adapter/ember/adapter/requestQueue.js.map +1 -1
- package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/tokensManager.js +23 -20
- package/dist/adapter/ember/adapter/tokensManager.js.map +1 -1
- package/dist/adapter/ember/consts.d.ts +0 -7
- package/dist/adapter/ember/consts.d.ts.map +1 -1
- package/dist/adapter/ember/consts.js +2 -9
- package/dist/adapter/ember/consts.js.map +1 -1
- package/dist/adapter/ember/enums.d.ts +12 -14
- package/dist/adapter/ember/enums.d.ts.map +1 -1
- package/dist/adapter/ember/enums.js +12 -14
- package/dist/adapter/ember/enums.js.map +1 -1
- package/dist/adapter/ember/ezsp/buffalo.js +4 -4
- package/dist/adapter/ember/ezsp/buffalo.js.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.d.ts +1 -2
- package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.js +218 -199
- package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
- package/dist/adapter/ember/types.d.ts +9 -9
- package/dist/adapter/ember/types.d.ts.map +1 -1
- package/dist/adapter/ember/uart/ash.d.ts +11 -5
- package/dist/adapter/ember/uart/ash.d.ts.map +1 -1
- package/dist/adapter/ember/uart/ash.js +125 -93
- package/dist/adapter/ember/uart/ash.js.map +1 -1
- package/dist/adapter/ember/uart/consts.d.ts +1 -1
- package/dist/adapter/ember/uart/consts.js +1 -1
- package/dist/adapter/ember/uart/parser.d.ts.map +1 -1
- package/dist/adapter/ember/uart/parser.js +5 -9
- package/dist/adapter/ember/uart/parser.js.map +1 -1
- package/dist/adapter/ember/uart/queues.d.ts.map +1 -1
- package/dist/adapter/ember/uart/queues.js +3 -1
- package/dist/adapter/ember/uart/queues.js.map +1 -1
- package/dist/adapter/ember/uart/writer.d.ts.map +1 -1
- package/dist/adapter/ember/uart/writer.js +4 -6
- package/dist/adapter/ember/uart/writer.js.map +1 -1
- package/dist/adapter/ember/zdo.d.ts +6 -2
- package/dist/adapter/ember/zdo.d.ts.map +1 -1
- package/dist/adapter/ember/zdo.js +2 -2
- package/dist/adapter/ember/zdo.js.map +1 -1
- package/dist/adapter/events.d.ts +17 -23
- package/dist/adapter/events.d.ts.map +1 -1
- package/dist/adapter/events.js +1 -2
- package/dist/adapter/events.js.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.d.ts +0 -1
- package/dist/adapter/ezsp/adapter/backup.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.js +3 -7
- package/dist/adapter/ezsp/adapter/backup.js.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +13 -10
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +79 -72
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
- package/dist/adapter/ezsp/driver/commands.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/commands.js +3 -5
- package/dist/adapter/ezsp/driver/commands.js.map +1 -1
- package/dist/adapter/ezsp/driver/driver.d.ts +1 -4
- package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/driver.js +101 -122
- package/dist/adapter/ezsp/driver/driver.js.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.js +61 -50
- package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
- package/dist/adapter/ezsp/driver/multicast.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/multicast.js +8 -12
- package/dist/adapter/ezsp/driver/multicast.js.map +1 -1
- package/dist/adapter/ezsp/driver/parser.js +5 -5
- package/dist/adapter/ezsp/driver/parser.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/basic.js +1 -1
- package/dist/adapter/ezsp/driver/types/basic.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/named.js +2 -2
- package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/struct.js +2 -2
- package/dist/adapter/ezsp/driver/types/struct.js.map +1 -1
- package/dist/adapter/ezsp/driver/uart.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/uart.js +46 -46
- package/dist/adapter/ezsp/driver/uart.js.map +1 -1
- package/dist/adapter/ezsp/driver/writer.js +3 -6
- package/dist/adapter/ezsp/driver/writer.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +0 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js +25 -29
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
- package/dist/adapter/z-stack/adapter/endpoints.js +4 -4
- package/dist/adapter/z-stack/adapter/endpoints.js.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts +1 -4
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.js +52 -61
- package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +12 -10
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +92 -68
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
- package/dist/adapter/z-stack/unpi/parser.js +6 -6
- package/dist/adapter/z-stack/unpi/parser.js.map +1 -1
- package/dist/adapter/z-stack/unpi/writer.js +4 -7
- package/dist/adapter/z-stack/unpi/writer.js.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +4 -2
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.js +154 -25
- package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
- package/dist/adapter/z-stack/znp/definition.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/definition.js +2 -1
- package/dist/adapter/z-stack/znp/definition.js.map +1 -1
- package/dist/adapter/z-stack/znp/tstype.d.ts +4 -3
- package/dist/adapter/z-stack/znp/tstype.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/znp.js +18 -25
- package/dist/adapter/z-stack/znp/znp.js.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.js +2 -2
- package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +13 -12
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.js +81 -90
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts +7 -8
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.js +150 -100
- package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
- package/dist/adapter/zigate/driver/commandType.d.ts +2 -1
- package/dist/adapter/zigate/driver/commandType.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/commandType.js +56 -52
- package/dist/adapter/zigate/driver/commandType.js.map +1 -1
- package/dist/adapter/zigate/driver/frame.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/frame.js +8 -8
- package/dist/adapter/zigate/driver/frame.js.map +1 -1
- package/dist/adapter/zigate/driver/messageType.d.ts +2 -1
- package/dist/adapter/zigate/driver/messageType.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/messageType.js +113 -108
- package/dist/adapter/zigate/driver/messageType.js.map +1 -1
- package/dist/adapter/zigate/driver/parameterType.d.ts +8 -1
- package/dist/adapter/zigate/driver/parameterType.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/parameterType.js +9 -0
- package/dist/adapter/zigate/driver/parameterType.js.map +1 -1
- package/dist/adapter/zigate/driver/ziGateObject.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/ziGateObject.js +9 -9
- package/dist/adapter/zigate/driver/ziGateObject.js.map +1 -1
- package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/zigate.js +23 -31
- package/dist/adapter/zigate/driver/zigate.js.map +1 -1
- package/dist/buffalo/buffalo.d.ts +23 -19
- package/dist/buffalo/buffalo.d.ts.map +1 -1
- package/dist/buffalo/buffalo.js +74 -169
- package/dist/buffalo/buffalo.js.map +1 -1
- package/dist/buffalo/index.d.ts +1 -2
- package/dist/buffalo/index.d.ts.map +1 -1
- package/dist/buffalo/index.js +1 -26
- package/dist/buffalo/index.js.map +1 -1
- package/dist/controller/controller.d.ts +8 -5
- package/dist/controller/controller.d.ts.map +1 -1
- package/dist/controller/controller.js +181 -126
- package/dist/controller/controller.js.map +1 -1
- package/dist/controller/database.d.ts +1 -0
- package/dist/controller/database.d.ts.map +1 -1
- package/dist/controller/database.js +7 -10
- package/dist/controller/database.js.map +1 -1
- package/dist/controller/events.d.ts +2 -2
- package/dist/controller/events.d.ts.map +1 -1
- package/dist/controller/events.js +4 -0
- package/dist/controller/events.js.map +1 -1
- package/dist/controller/greenPower.d.ts +2 -1
- package/dist/controller/greenPower.d.ts.map +1 -1
- package/dist/controller/greenPower.js +51 -57
- package/dist/controller/greenPower.js.map +1 -1
- package/dist/controller/helpers/request.d.ts +3 -3
- package/dist/controller/helpers/request.d.ts.map +1 -1
- package/dist/controller/helpers/request.js +2 -2
- package/dist/controller/helpers/request.js.map +1 -1
- package/dist/controller/helpers/requestQueue.d.ts.map +1 -1
- package/dist/controller/helpers/requestQueue.js +26 -36
- package/dist/controller/helpers/requestQueue.js.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.d.ts +4 -3
- package/dist/controller/helpers/zclFrameConverter.d.ts.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.js +33 -14
- package/dist/controller/helpers/zclFrameConverter.js.map +1 -1
- package/dist/controller/model/device.d.ts +12 -5
- package/dist/controller/model/device.d.ts.map +1 -1
- package/dist/controller/model/device.js +105 -86
- package/dist/controller/model/device.js.map +1 -1
- package/dist/controller/model/endpoint.d.ts +22 -17
- package/dist/controller/model/endpoint.d.ts.map +1 -1
- package/dist/controller/model/endpoint.js +139 -228
- package/dist/controller/model/endpoint.js.map +1 -1
- package/dist/controller/model/group.d.ts +1 -1
- package/dist/controller/model/group.d.ts.map +1 -1
- package/dist/controller/model/group.js +18 -18
- package/dist/controller/model/group.js.map +1 -1
- package/dist/controller/touchlink.js +25 -28
- package/dist/controller/touchlink.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +14 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/zspec/consts.d.ts +60 -0
- package/dist/zspec/consts.d.ts.map +1 -0
- package/dist/zspec/consts.js +64 -0
- package/dist/zspec/consts.js.map +1 -0
- package/dist/zspec/enums.d.ts +19 -0
- package/dist/zspec/enums.d.ts.map +1 -0
- package/dist/zspec/enums.js +28 -0
- package/dist/zspec/enums.js.map +1 -0
- package/dist/zspec/index.d.ts +4 -0
- package/dist/zspec/index.d.ts.map +1 -0
- package/dist/zspec/index.js +43 -0
- package/dist/zspec/index.js.map +1 -0
- package/dist/zspec/tstypes.d.ts +19 -0
- package/dist/zspec/tstypes.d.ts.map +1 -0
- package/dist/{buffalo/tstype.js → zspec/tstypes.js} +1 -1
- package/dist/zspec/tstypes.js.map +1 -0
- package/dist/zspec/utils.d.ts +14 -0
- package/dist/zspec/utils.d.ts.map +1 -0
- package/dist/zspec/utils.js +29 -0
- package/dist/zspec/utils.js.map +1 -0
- package/dist/zspec/zcl/buffaloZcl.d.ts +55 -0
- package/dist/zspec/zcl/buffaloZcl.d.ts.map +1 -0
- package/dist/zspec/zcl/buffaloZcl.js +929 -0
- package/dist/zspec/zcl/buffaloZcl.js.map +1 -0
- package/dist/zspec/zcl/definition/cluster.d.ts +3 -0
- package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/cluster.js +5500 -0
- package/dist/zspec/zcl/definition/cluster.js.map +1 -0
- package/dist/zspec/zcl/definition/consts.d.ts +9 -0
- package/dist/zspec/zcl/definition/consts.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/consts.js +27 -0
- package/dist/zspec/zcl/definition/consts.js.map +1 -0
- package/dist/zspec/zcl/definition/enums.d.ts +177 -0
- package/dist/zspec/zcl/definition/enums.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/enums.js +187 -0
- package/dist/zspec/zcl/definition/enums.js.map +1 -0
- package/dist/zspec/zcl/definition/foundation.d.ts +11 -0
- package/dist/zspec/zcl/definition/foundation.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/foundation.js +241 -0
- package/dist/zspec/zcl/definition/foundation.js.map +1 -0
- package/dist/zspec/zcl/definition/manufacturerCode.d.ts +727 -0
- package/dist/zspec/zcl/definition/manufacturerCode.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/manufacturerCode.js +733 -0
- package/dist/zspec/zcl/definition/manufacturerCode.js.map +1 -0
- package/dist/zspec/zcl/definition/status.d.ts +69 -0
- package/dist/zspec/zcl/definition/status.d.ts.map +1 -0
- package/dist/zspec/zcl/definition/status.js +74 -0
- package/dist/zspec/zcl/definition/status.js.map +1 -0
- package/dist/zspec/zcl/definition/tstype.d.ts +114 -0
- package/dist/zspec/zcl/definition/tstype.d.ts.map +1 -0
- package/dist/{zcl/zclHeader.js → zspec/zcl/definition/tstype.js} +2 -1
- package/dist/zspec/zcl/definition/tstype.js.map +1 -0
- package/dist/zspec/zcl/index.d.ts +11 -0
- package/dist/zspec/zcl/index.d.ts.map +1 -0
- package/dist/zspec/zcl/index.js +47 -0
- package/dist/zspec/zcl/index.js.map +1 -0
- package/dist/zspec/zcl/utils.d.ts +7 -0
- package/dist/zspec/zcl/utils.d.ts.map +1 -0
- package/dist/zspec/zcl/utils.js +234 -0
- package/dist/zspec/zcl/utils.js.map +1 -0
- package/dist/zspec/zcl/zclFrame.d.ts +36 -0
- package/dist/zspec/zcl/zclFrame.d.ts.map +1 -0
- package/dist/zspec/zcl/zclFrame.js +304 -0
- package/dist/zspec/zcl/zclFrame.js.map +1 -0
- package/dist/zspec/zcl/zclHeader.d.ts +17 -0
- package/dist/zspec/zcl/zclHeader.d.ts.map +1 -0
- package/dist/zspec/zcl/zclHeader.js +88 -0
- package/dist/zspec/zcl/zclHeader.js.map +1 -0
- package/dist/zspec/zcl/zclStatusError.d.ts +6 -0
- package/dist/zspec/zcl/zclStatusError.d.ts.map +1 -0
- package/dist/zspec/zcl/zclStatusError.js +13 -0
- package/dist/zspec/zcl/zclStatusError.js.map +1 -0
- package/dist/zspec/zdo/buffaloZdo.d.ts +438 -0
- package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -0
- package/dist/zspec/zdo/buffaloZdo.js +1892 -0
- package/dist/zspec/zdo/buffaloZdo.js.map +1 -0
- package/dist/zspec/zdo/definition/clusters.d.ts +624 -0
- package/dist/zspec/zdo/definition/clusters.d.ts.map +1 -0
- package/dist/zspec/zdo/definition/clusters.js +687 -0
- package/dist/zspec/zdo/definition/clusters.js.map +1 -0
- package/dist/zspec/zdo/definition/consts.d.ts +13 -0
- package/dist/zspec/zdo/definition/consts.d.ts.map +1 -0
- package/dist/zspec/zdo/definition/consts.js +16 -0
- package/dist/zspec/zdo/definition/consts.js.map +1 -0
- package/dist/zspec/zdo/definition/enums.d.ts +75 -0
- package/dist/zspec/zdo/definition/enums.d.ts.map +1 -0
- package/dist/zspec/zdo/definition/enums.js +97 -0
- package/dist/zspec/zdo/definition/enums.js.map +1 -0
- package/dist/zspec/zdo/definition/status.d.ts +99 -0
- package/dist/zspec/zdo/definition/status.d.ts.map +1 -0
- package/dist/zspec/zdo/definition/status.js +109 -0
- package/dist/zspec/zdo/definition/status.js.map +1 -0
- package/dist/zspec/zdo/definition/tstypes.d.ts +787 -0
- package/dist/zspec/zdo/definition/tstypes.d.ts.map +1 -0
- package/dist/{zcl/definition/tstype.js → zspec/zdo/definition/tstypes.js} +1 -1
- package/dist/zspec/zdo/definition/tstypes.js.map +1 -0
- package/dist/zspec/zdo/index.d.ts +7 -0
- package/dist/zspec/zdo/index.d.ts.map +1 -0
- package/dist/zspec/zdo/index.js +39 -0
- package/dist/zspec/zdo/index.js.map +1 -0
- package/dist/zspec/zdo/utils.d.ts +25 -0
- package/dist/zspec/zdo/utils.d.ts.map +1 -0
- package/dist/zspec/zdo/utils.js +75 -0
- package/dist/zspec/zdo/utils.js.map +1 -0
- package/dist/zspec/zdo/zdoStatusError.d.ts +6 -0
- package/dist/zspec/zdo/zdoStatusError.d.ts.map +1 -0
- package/dist/zspec/zdo/zdoStatusError.js +13 -0
- package/dist/zspec/zdo/zdoStatusError.js.map +1 -0
- package/examples/join-and-log.js +7 -12
- package/package.json +5 -5
- package/dist/adapter/zigate/debug.d.ts +0 -8
- package/dist/adapter/zigate/debug.d.ts.map +0 -1
- package/dist/adapter/zigate/debug.js +0 -20
- package/dist/adapter/zigate/debug.js.map +0 -1
- package/dist/buffalo/tstype.d.ts +0 -9
- package/dist/buffalo/tstype.d.ts.map +0 -1
- package/dist/buffalo/tstype.js.map +0 -1
- package/dist/controller/logger-stub.d.ts +0 -7
- package/dist/controller/logger-stub.d.ts.map +0 -1
- package/dist/controller/logger-stub.js +0 -3
- package/dist/controller/logger-stub.js.map +0 -1
- package/dist/zcl/buffaloZcl.d.ts +0 -42
- package/dist/zcl/buffaloZcl.d.ts.map +0 -1
- package/dist/zcl/buffaloZcl.js +0 -595
- package/dist/zcl/buffaloZcl.js.map +0 -1
- package/dist/zcl/definition/buffaloZclDataType.d.ts +0 -18
- package/dist/zcl/definition/buffaloZclDataType.d.ts.map +0 -1
- package/dist/zcl/definition/buffaloZclDataType.js +0 -21
- package/dist/zcl/definition/buffaloZclDataType.js.map +0 -1
- package/dist/zcl/definition/cluster.d.ts +0 -30
- package/dist/zcl/definition/cluster.d.ts.map +0 -1
- package/dist/zcl/definition/cluster.js +0 -5531
- package/dist/zcl/definition/cluster.js.map +0 -1
- package/dist/zcl/definition/dataType.d.ts +0 -60
- package/dist/zcl/definition/dataType.d.ts.map +0 -1
- package/dist/zcl/definition/dataType.js +0 -65
- package/dist/zcl/definition/dataType.js.map +0 -1
- package/dist/zcl/definition/direction.d.ts +0 -6
- package/dist/zcl/definition/direction.d.ts.map +0 -1
- package/dist/zcl/definition/direction.js +0 -9
- package/dist/zcl/definition/direction.js.map +0 -1
- package/dist/zcl/definition/endpointDeviceType.d.ts +0 -5
- package/dist/zcl/definition/endpointDeviceType.d.ts.map +0 -1
- package/dist/zcl/definition/endpointDeviceType.js +0 -16
- package/dist/zcl/definition/endpointDeviceType.js.map +0 -1
- package/dist/zcl/definition/foundation.d.ts +0 -12
- package/dist/zcl/definition/foundation.d.ts.map +0 -1
- package/dist/zcl/definition/foundation.js +0 -168
- package/dist/zcl/definition/foundation.js.map +0 -1
- package/dist/zcl/definition/frameControl.d.ts +0 -11
- package/dist/zcl/definition/frameControl.d.ts.map +0 -1
- package/dist/zcl/definition/frameControl.js +0 -3
- package/dist/zcl/definition/frameControl.js.map +0 -1
- package/dist/zcl/definition/frameType.d.ts +0 -6
- package/dist/zcl/definition/frameType.d.ts.map +0 -1
- package/dist/zcl/definition/frameType.js +0 -9
- package/dist/zcl/definition/frameType.js.map +0 -1
- package/dist/zcl/definition/index.d.ts +0 -14
- package/dist/zcl/definition/index.d.ts.map +0 -1
- package/dist/zcl/definition/index.js +0 -52
- package/dist/zcl/definition/index.js.map +0 -1
- package/dist/zcl/definition/manufacturerCode.d.ts +0 -1078
- package/dist/zcl/definition/manufacturerCode.d.ts.map +0 -1
- package/dist/zcl/definition/manufacturerCode.js +0 -1083
- package/dist/zcl/definition/manufacturerCode.js.map +0 -1
- package/dist/zcl/definition/powerSource.d.ts +0 -5
- package/dist/zcl/definition/powerSource.d.ts.map +0 -1
- package/dist/zcl/definition/powerSource.js +0 -13
- package/dist/zcl/definition/powerSource.js.map +0 -1
- package/dist/zcl/definition/status.d.ts +0 -39
- package/dist/zcl/definition/status.d.ts.map +0 -1
- package/dist/zcl/definition/status.js +0 -42
- package/dist/zcl/definition/status.js.map +0 -1
- package/dist/zcl/definition/tstype.d.ts +0 -17
- package/dist/zcl/definition/tstype.d.ts.map +0 -1
- package/dist/zcl/definition/tstype.js.map +0 -1
- package/dist/zcl/index.d.ts +0 -17
- package/dist/zcl/index.d.ts.map +0 -1
- package/dist/zcl/index.js +0 -56
- package/dist/zcl/index.js.map +0 -1
- package/dist/zcl/tstype.d.ts +0 -57
- package/dist/zcl/tstype.d.ts.map +0 -1
- package/dist/zcl/tstype.js +0 -10
- package/dist/zcl/tstype.js.map +0 -1
- package/dist/zcl/utils.d.ts +0 -7
- package/dist/zcl/utils.d.ts.map +0 -1
- package/dist/zcl/utils.js +0 -165
- package/dist/zcl/utils.js.map +0 -1
- package/dist/zcl/zclFrame.d.ts +0 -41
- package/dist/zcl/zclFrame.d.ts.map +0 -1
- package/dist/zcl/zclFrame.js +0 -352
- package/dist/zcl/zclFrame.js.map +0 -1
- package/dist/zcl/zclHeader.d.ts +0 -9
- package/dist/zcl/zclHeader.d.ts.map +0 -1
- package/dist/zcl/zclHeader.js.map +0 -1
- package/dist/zcl/zclStatusError.d.ts +0 -6
- package/dist/zcl/zclStatusError.d.ts.map +0 -1
- package/dist/zcl/zclStatusError.js +0 -15
- package/dist/zcl/zclStatusError.js.map +0 -1
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const entity_1 = __importDefault(require("./entity"));
|
|
30
|
-
const Zcl = __importStar(require("../../zcl"));
|
|
30
|
+
const Zcl = __importStar(require("../../zspec/zcl"));
|
|
31
31
|
const zclTransactionSequenceNumber_1 = __importDefault(require("../helpers/zclTransactionSequenceNumber"));
|
|
32
32
|
const ZclFrameConverter = __importStar(require("../helpers/zclFrameConverter"));
|
|
33
33
|
const request_1 = __importDefault(require("../helpers/request"));
|
|
@@ -40,6 +40,9 @@ const debug = {
|
|
|
40
40
|
info: (0, debug_1.default)("zigbee-herdsman:controller:endpoint"),
|
|
41
41
|
error: (0, debug_1.default)("zigbee-herdsman:controller:endpoint"),
|
|
42
42
|
};
|
|
43
|
+
const logger_1 = require("../../utils/logger");
|
|
44
|
+
const enums_1 = require("../../zspec/enums");
|
|
45
|
+
const NS = 'zh:controller:endpoint';
|
|
43
46
|
class Endpoint extends entity_1.default {
|
|
44
47
|
databaseID;
|
|
45
48
|
deviceID;
|
|
@@ -69,20 +72,16 @@ class Endpoint extends entity_1.default {
|
|
|
69
72
|
target = group_1.default.byGroupID(entry.groupID, this.databaseID);
|
|
70
73
|
}
|
|
71
74
|
if (target) {
|
|
72
|
-
return {
|
|
73
|
-
target,
|
|
74
|
-
cluster: Zcl.Utils.getCluster(entry.cluster, this.getDevice().manufacturerID),
|
|
75
|
-
};
|
|
75
|
+
return { target, cluster: this.getCluster(entry.cluster) };
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
return undefined;
|
|
79
79
|
}
|
|
80
|
-
})
|
|
81
|
-
.filter((b) => b !== undefined);
|
|
80
|
+
}).filter(b => b !== undefined);
|
|
82
81
|
}
|
|
83
82
|
get configuredReportings() {
|
|
84
83
|
return this._configuredReportings.map((entry) => {
|
|
85
|
-
const cluster = Zcl.Utils.getCluster(entry.cluster, entry.manufacturerCode);
|
|
84
|
+
const cluster = Zcl.Utils.getCluster(entry.cluster, entry.manufacturerCode, this.getDevice().customClusters);
|
|
86
85
|
let attribute;
|
|
87
86
|
if (cluster.hasAttribute(entry.attrId)) {
|
|
88
87
|
attribute = cluster.getAttribute(entry.attrId);
|
|
@@ -127,35 +126,35 @@ class Endpoint extends entity_1.default {
|
|
|
127
126
|
return device_1.default.byIeeeAddr(this.databaseID, this.deviceIeeeAddress);
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
* @param {number|string} clusterKey
|
|
130
|
+
* @returns {boolean}
|
|
131
|
+
*/
|
|
133
132
|
supportsInputCluster(clusterKey) {
|
|
134
|
-
const cluster =
|
|
133
|
+
const cluster = this.getCluster(clusterKey);
|
|
135
134
|
return this.inputClusters.includes(cluster.ID);
|
|
136
135
|
}
|
|
137
136
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
* @param {number|string} clusterKey
|
|
138
|
+
* @returns {boolean}
|
|
139
|
+
*/
|
|
141
140
|
supportsOutputCluster(clusterKey) {
|
|
142
|
-
const cluster =
|
|
141
|
+
const cluster = this.getCluster(clusterKey);
|
|
143
142
|
return this.outputClusters.includes(cluster.ID);
|
|
144
143
|
}
|
|
145
144
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
* @returns {ZclTypes.Cluster[]}
|
|
146
|
+
*/
|
|
148
147
|
getInputClusters() {
|
|
149
148
|
return this.clusterNumbersToClusters(this.inputClusters);
|
|
150
149
|
}
|
|
151
150
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
* @returns {ZclTypes.Cluster[]}
|
|
152
|
+
*/
|
|
154
153
|
getOutputClusters() {
|
|
155
154
|
return this.clusterNumbersToClusters(this.outputClusters);
|
|
156
155
|
}
|
|
157
156
|
clusterNumbersToClusters(clusterNumbers) {
|
|
158
|
-
return clusterNumbers.map((c) =>
|
|
157
|
+
return clusterNumbers.map((c) => this.getCluster(c));
|
|
159
158
|
}
|
|
160
159
|
/*
|
|
161
160
|
* CRUD
|
|
@@ -189,7 +188,7 @@ class Endpoint extends entity_1.default {
|
|
|
189
188
|
return new Endpoint(databaseID, ID, profileID, deviceID, inputClusters, outputClusters, deviceNetworkAddress, deviceIeeeAddress, {}, [], [], {});
|
|
190
189
|
}
|
|
191
190
|
saveClusterAttributeKeyValue(clusterKey, list) {
|
|
192
|
-
const cluster =
|
|
191
|
+
const cluster = this.getCluster(clusterKey);
|
|
193
192
|
if (!this.clusters[cluster.name])
|
|
194
193
|
this.clusters[cluster.name] = { attributes: {} };
|
|
195
194
|
for (const [attribute, value] of Object.entries(list)) {
|
|
@@ -197,7 +196,7 @@ class Endpoint extends entity_1.default {
|
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
getClusterAttributeValue(clusterKey, attributeKey) {
|
|
200
|
-
const cluster =
|
|
199
|
+
const cluster = this.getCluster(clusterKey);
|
|
201
200
|
const attribute = cluster.getAttribute(attributeKey);
|
|
202
201
|
if (this.clusters[cluster.name] && this.clusters[cluster.name].attributes) {
|
|
203
202
|
return this.clusters[cluster.name].attributes[attribute.name];
|
|
@@ -214,33 +213,32 @@ class Endpoint extends entity_1.default {
|
|
|
214
213
|
return entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToEndpoint(this.deviceIeeeAddress, this.deviceNetworkAddress, this.ID, d, options.timeout, options.disableResponse, options.disableRecovery, options.srcEndpoint);
|
|
215
214
|
}) {
|
|
216
215
|
const logPrefix = `Request Queue (${this.deviceIeeeAddress}/${this.ID}): `;
|
|
217
|
-
const
|
|
216
|
+
const device = this.getDevice();
|
|
217
|
+
const request = new request_1.default(func, frame, device.pendingRequestTimeout, options.sendPolicy);
|
|
218
218
|
if (request.sendPolicy !== 'bulk') {
|
|
219
219
|
// Check if such a request is already in the queue and remove the old one(s) if necessary
|
|
220
220
|
this.pendingRequests.filter(request);
|
|
221
221
|
}
|
|
222
222
|
// send without queueing if sendPolicy is 'immediate' or if the device has no timeout set
|
|
223
|
-
if (request.sendPolicy === 'immediate'
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
debug.info(logPrefix + `send ${frame.getCommand().name} request immediately ` +
|
|
227
|
-
`(sendPolicy=${options.sendPolicy})`);
|
|
223
|
+
if (request.sendPolicy === 'immediate' || !device.pendingRequestTimeout) {
|
|
224
|
+
if (device.pendingRequestTimeout > 0) {
|
|
225
|
+
logger_1.logger.debug(logPrefix + `send ${frame.command.name} request immediately (sendPolicy=${options.sendPolicy})`, NS);
|
|
228
226
|
}
|
|
229
227
|
return request.send();
|
|
230
228
|
}
|
|
231
229
|
// If this is a bulk message, we queue directly.
|
|
232
230
|
if (request.sendPolicy === 'bulk') {
|
|
233
|
-
debug
|
|
231
|
+
logger_1.logger.debug(logPrefix + `queue request (${this.pendingRequests.size})`, NS);
|
|
234
232
|
return this.pendingRequests.queue(request);
|
|
235
233
|
}
|
|
236
234
|
try {
|
|
237
|
-
debug
|
|
235
|
+
logger_1.logger.debug(logPrefix + `send request`, NS);
|
|
238
236
|
return await request.send();
|
|
239
237
|
}
|
|
240
238
|
catch (error) {
|
|
241
239
|
// If we got a failed transaction, the device is likely sleeping.
|
|
242
240
|
// Queue for transmission later.
|
|
243
|
-
debug
|
|
241
|
+
logger_1.logger.debug(logPrefix + `queue request (transaction failed)`, NS);
|
|
244
242
|
return this.pendingRequests.queue(request);
|
|
245
243
|
}
|
|
246
244
|
}
|
|
@@ -253,11 +251,10 @@ class Endpoint extends entity_1.default {
|
|
|
253
251
|
: [payload.statusCode];
|
|
254
252
|
const invalid = codes.find((c) => c !== Zcl.Status.SUCCESS);
|
|
255
253
|
if (invalid)
|
|
256
|
-
throw new Zcl.
|
|
254
|
+
throw new Zcl.StatusError(invalid);
|
|
257
255
|
}
|
|
258
256
|
async report(clusterKey, attributes, options) {
|
|
259
|
-
const cluster =
|
|
260
|
-
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
257
|
+
const cluster = this.getCluster(clusterKey);
|
|
261
258
|
const payload = [];
|
|
262
259
|
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
263
260
|
if (cluster.hasAttribute(nameOrID)) {
|
|
@@ -279,22 +276,10 @@ class Endpoint extends entity_1.default {
|
|
|
279
276
|
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
280
277
|
}
|
|
281
278
|
}
|
|
282
|
-
|
|
283
|
-
`${cluster.name}(${JSON.stringify(attributes)}, ${JSON.stringify(options)})`;
|
|
284
|
-
debug.info(log);
|
|
285
|
-
try {
|
|
286
|
-
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ??
|
|
287
|
-
zclTransactionSequenceNumber_1.default.next(), "report", cluster.ID, payload, options.reservedBits);
|
|
288
|
-
await this.sendRequest(frame, options);
|
|
289
|
-
}
|
|
290
|
-
catch (error) {
|
|
291
|
-
error.message = `${log} failed (${error.message})`;
|
|
292
|
-
debug.error(error.message);
|
|
293
|
-
throw error;
|
|
294
|
-
}
|
|
279
|
+
await this.zclCommand(clusterKey, "report", payload, options, attributes);
|
|
295
280
|
}
|
|
296
281
|
async write(clusterKey, attributes, options) {
|
|
297
|
-
const cluster =
|
|
282
|
+
const cluster = this.getCluster(clusterKey);
|
|
298
283
|
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
299
284
|
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, Object.keys(attributes), options.manufacturerCode, 'write');
|
|
300
285
|
const payload = [];
|
|
@@ -310,27 +295,11 @@ class Endpoint extends entity_1.default {
|
|
|
310
295
|
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
311
296
|
}
|
|
312
297
|
}
|
|
313
|
-
|
|
314
|
-
`${cluster.name}(${JSON.stringify(attributes)}, ${JSON.stringify(options)})`;
|
|
315
|
-
debug.info(log);
|
|
316
|
-
try {
|
|
317
|
-
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ??
|
|
318
|
-
zclTransactionSequenceNumber_1.default.next(), options.writeUndiv ? "writeUndiv" : "write", cluster.ID, payload, options.reservedBits);
|
|
319
|
-
const result = await this.sendRequest(frame, options);
|
|
320
|
-
if (!options.disableResponse) {
|
|
321
|
-
this.checkStatus(result.frame.Payload);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
catch (error) {
|
|
325
|
-
error.message = `${log} failed (${error.message})`;
|
|
326
|
-
debug.error(error.message);
|
|
327
|
-
throw error;
|
|
328
|
-
}
|
|
298
|
+
await this.zclCommand(clusterKey, options.writeUndiv ? "writeUndiv" : "write", payload, options, attributes, true);
|
|
329
299
|
}
|
|
330
300
|
async writeResponse(clusterKey, transactionSequenceNumber, attributes, options) {
|
|
331
301
|
(0, assert_1.default)(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter');
|
|
332
|
-
const cluster =
|
|
333
|
-
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
302
|
+
const cluster = this.getCluster(clusterKey);
|
|
334
303
|
const payload = [];
|
|
335
304
|
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
336
305
|
if (value.hasOwnProperty('status')) {
|
|
@@ -349,51 +318,25 @@ class Endpoint extends entity_1.default {
|
|
|
349
318
|
throw new Error(`Missing attribute 'status'`);
|
|
350
319
|
}
|
|
351
320
|
}
|
|
352
|
-
|
|
353
|
-
const log = `WriteResponse ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
354
|
-
`${cluster.name}(${JSON.stringify(attributes)}, ${JSON.stringify(options)})`;
|
|
355
|
-
debug.info(log);
|
|
356
|
-
try {
|
|
357
|
-
await this.sendRequest(frame, options);
|
|
358
|
-
}
|
|
359
|
-
catch (error) {
|
|
360
|
-
error.message = `${log} failed (${error.message})`;
|
|
361
|
-
debug.error(error.message);
|
|
362
|
-
throw error;
|
|
363
|
-
}
|
|
321
|
+
await this.zclCommand(clusterKey, 'writeRsp', payload, { direction: Zcl.Direction.SERVER_TO_CLIENT, ...options, transactionSequenceNumber }, attributes);
|
|
364
322
|
}
|
|
365
323
|
async read(clusterKey, attributes, options) {
|
|
366
|
-
const
|
|
324
|
+
const device = this.getDevice();
|
|
325
|
+
const cluster = this.getCluster(clusterKey, device);
|
|
367
326
|
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
368
327
|
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, attributes, options.manufacturerCode, 'read');
|
|
369
328
|
const payload = [];
|
|
370
329
|
for (const attribute of attributes) {
|
|
371
330
|
payload.push({ attrId: typeof attribute === 'number' ? attribute : cluster.getAttribute(attribute).ID });
|
|
372
331
|
}
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
debug.info(log);
|
|
377
|
-
try {
|
|
378
|
-
const result = await this.sendRequest(frame, options);
|
|
379
|
-
if (!options.disableResponse) {
|
|
380
|
-
this.checkStatus(result.frame.Payload);
|
|
381
|
-
return ZclFrameConverter.attributeKeyValue(result.frame, this.getDevice().manufacturerID);
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
catch (error) {
|
|
388
|
-
error.message = `${log} failed (${error.message})`;
|
|
389
|
-
debug.error(error.message);
|
|
390
|
-
throw error;
|
|
332
|
+
const resultFrame = await this.zclCommand(clusterKey, 'read', payload, options, attributes, true);
|
|
333
|
+
if (resultFrame) {
|
|
334
|
+
return ZclFrameConverter.attributeKeyValue(resultFrame, device.manufacturerID, device.customClusters);
|
|
391
335
|
}
|
|
392
336
|
}
|
|
393
337
|
async readResponse(clusterKey, transactionSequenceNumber, attributes, options) {
|
|
394
|
-
(0, assert_1.default)(!options || !options.hasOwnProperty(
|
|
395
|
-
const cluster =
|
|
396
|
-
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
338
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter');
|
|
339
|
+
const cluster = this.getCluster(clusterKey);
|
|
397
340
|
const payload = [];
|
|
398
341
|
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
399
342
|
if (cluster.hasAttribute(nameOrID)) {
|
|
@@ -417,25 +360,12 @@ class Endpoint extends entity_1.default {
|
|
|
417
360
|
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
418
361
|
}
|
|
419
362
|
}
|
|
420
|
-
|
|
421
|
-
const log = `ReadResponse ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
422
|
-
`${cluster.name}(${JSON.stringify(attributes)}, ${JSON.stringify(options)})`;
|
|
423
|
-
debug.info(log);
|
|
424
|
-
try {
|
|
425
|
-
await this.sendRequest(frame, options);
|
|
426
|
-
}
|
|
427
|
-
catch (error) {
|
|
428
|
-
error.message = `${log} failed (${error.message})`;
|
|
429
|
-
debug.error(error.message);
|
|
430
|
-
throw error;
|
|
431
|
-
}
|
|
363
|
+
await this.zclCommand(clusterKey, 'readRsp', payload, { direction: Zcl.Direction.SERVER_TO_CLIENT, ...options, transactionSequenceNumber }, attributes);
|
|
432
364
|
}
|
|
433
365
|
addBinding(clusterKey, target) {
|
|
434
|
-
const cluster =
|
|
435
|
-
if (typeof target ===
|
|
436
|
-
target =
|
|
437
|
-
group_1.default.byGroupID(target, this.databaseID) ||
|
|
438
|
-
group_1.default.create(target, this.databaseID);
|
|
366
|
+
const cluster = this.getCluster(clusterKey);
|
|
367
|
+
if (typeof target === 'number') {
|
|
368
|
+
target = group_1.default.byGroupID(target, this.databaseID) || group_1.default.create(target, this.databaseID);
|
|
439
369
|
}
|
|
440
370
|
if (!this.binds.find((b) => b.cluster.ID === cluster.ID && b.target === target)) {
|
|
441
371
|
if (target instanceof group_1.default) {
|
|
@@ -457,26 +387,22 @@ class Endpoint extends entity_1.default {
|
|
|
457
387
|
}
|
|
458
388
|
}
|
|
459
389
|
async bind(clusterKey, target) {
|
|
460
|
-
const cluster =
|
|
461
|
-
const type = target instanceof Endpoint ?
|
|
462
|
-
if (typeof target ===
|
|
463
|
-
target =
|
|
464
|
-
group_1.default.byGroupID(target, this.databaseID) ||
|
|
465
|
-
group_1.default.create(target, this.databaseID);
|
|
390
|
+
const cluster = this.getCluster(clusterKey);
|
|
391
|
+
const type = target instanceof Endpoint ? 'endpoint' : 'group';
|
|
392
|
+
if (typeof target === 'number') {
|
|
393
|
+
target = group_1.default.byGroupID(target, this.databaseID) || group_1.default.create(target, this.databaseID);
|
|
466
394
|
}
|
|
467
395
|
const destinationAddress = target instanceof Endpoint ? target.deviceIeeeAddress : target.groupID;
|
|
468
396
|
const log = `Bind ${this.deviceIeeeAddress}/${this.ID} ${cluster.name} from ` +
|
|
469
|
-
`'${target instanceof Endpoint
|
|
470
|
-
|
|
471
|
-
: destinationAddress}'`;
|
|
472
|
-
debug.info(log);
|
|
397
|
+
`'${target instanceof Endpoint ? `${destinationAddress}/${target.ID}` : destinationAddress}'`;
|
|
398
|
+
logger_1.logger.debug(log, NS);
|
|
473
399
|
try {
|
|
474
400
|
await entity_1.default.getAdapterByID(this.databaseID).bind(this.deviceNetworkAddress, this.deviceIeeeAddress, this.ID, cluster.ID, destinationAddress, type, target instanceof Endpoint ? target.ID : null);
|
|
475
401
|
this.addBinding(clusterKey, target);
|
|
476
402
|
}
|
|
477
403
|
catch (error) {
|
|
478
404
|
error.message = `${log} failed (${error.message})`;
|
|
479
|
-
debug
|
|
405
|
+
logger_1.logger.debug(error, NS);
|
|
480
406
|
throw error;
|
|
481
407
|
}
|
|
482
408
|
}
|
|
@@ -484,18 +410,16 @@ class Endpoint extends entity_1.default {
|
|
|
484
410
|
this.getDevice().save();
|
|
485
411
|
}
|
|
486
412
|
async unbind(clusterKey, target) {
|
|
487
|
-
const cluster =
|
|
488
|
-
const type = target instanceof Endpoint ?
|
|
413
|
+
const cluster = this.getCluster(clusterKey);
|
|
414
|
+
const type = target instanceof Endpoint ? 'endpoint' : 'group';
|
|
489
415
|
const destinationAddress = target instanceof Endpoint
|
|
490
416
|
? target.deviceIeeeAddress
|
|
491
417
|
: target instanceof group_1.default
|
|
492
418
|
? target.groupID
|
|
493
419
|
: target;
|
|
494
420
|
const log = `Unbind ${this.deviceIeeeAddress}/${this.ID} ${cluster.name} from ` +
|
|
495
|
-
`'${target instanceof Endpoint
|
|
496
|
-
|
|
497
|
-
: destinationAddress}'`;
|
|
498
|
-
debug.info(log);
|
|
421
|
+
`'${target instanceof Endpoint ? `${destinationAddress}/${target.ID}` : destinationAddress}'`;
|
|
422
|
+
logger_1.logger.debug(log, NS);
|
|
499
423
|
try {
|
|
500
424
|
await entity_1.default.getAdapterByID(this.databaseID).unbind(this.deviceNetworkAddress, this.deviceIeeeAddress, this.ID, cluster.ID, destinationAddress, type, target instanceof Endpoint ? target.ID : null);
|
|
501
425
|
if (typeof target === "number" &&
|
|
@@ -510,29 +434,17 @@ class Endpoint extends entity_1.default {
|
|
|
510
434
|
}
|
|
511
435
|
catch (error) {
|
|
512
436
|
error.message = `${log} failed (${error.message})`;
|
|
513
|
-
debug
|
|
437
|
+
logger_1.logger.debug(error, NS);
|
|
514
438
|
throw error;
|
|
515
439
|
}
|
|
516
440
|
}
|
|
517
441
|
async defaultResponse(commandID, status, clusterID, transactionSequenceNumber, options) {
|
|
518
|
-
(0, assert_1.default)(!options || !options.hasOwnProperty(
|
|
519
|
-
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, null);
|
|
442
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter');
|
|
520
443
|
const payload = { cmdId: commandID, statusCode: status };
|
|
521
|
-
|
|
522
|
-
const log = `DefaultResponse ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
523
|
-
`${clusterID}(${commandID}, ${JSON.stringify(options)})`;
|
|
524
|
-
debug.info(log);
|
|
525
|
-
try {
|
|
526
|
-
await this.sendRequest(frame, options);
|
|
527
|
-
}
|
|
528
|
-
catch (error) {
|
|
529
|
-
error.message = `${log} failed (${error.message})`;
|
|
530
|
-
debug.error(error.message);
|
|
531
|
-
throw error;
|
|
532
|
-
}
|
|
444
|
+
await this.zclCommand(clusterID, 'defaultRsp', payload, { direction: Zcl.Direction.SERVER_TO_CLIENT, ...options, transactionSequenceNumber });
|
|
533
445
|
}
|
|
534
446
|
async configureReporting(clusterKey, items, options) {
|
|
535
|
-
const cluster =
|
|
447
|
+
const cluster = this.getCluster(clusterKey);
|
|
536
448
|
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
537
449
|
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, items, options.manufacturerCode, 'configureReporting');
|
|
538
450
|
const payload = items.map((item) => {
|
|
@@ -558,93 +470,48 @@ class Endpoint extends entity_1.default {
|
|
|
558
470
|
repChange: item.reportableChange,
|
|
559
471
|
};
|
|
560
472
|
});
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (
|
|
568
|
-
this.
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
for (const entry of payload) {
|
|
575
|
-
if (entry.maxRepIntval !== 0xffff) {
|
|
576
|
-
this._configuredReportings.push({
|
|
577
|
-
cluster: cluster.ID,
|
|
578
|
-
attrId: entry.attrId,
|
|
579
|
-
minRepIntval: entry.minRepIntval,
|
|
580
|
-
maxRepIntval: entry.maxRepIntval,
|
|
581
|
-
repChange: entry.repChange,
|
|
582
|
-
manufacturerCode: options.manufacturerCode,
|
|
583
|
-
});
|
|
584
|
-
}
|
|
473
|
+
await this.zclCommand(clusterKey, 'configReport', payload, options, items, true);
|
|
474
|
+
for (const e of payload) {
|
|
475
|
+
this._configuredReportings = this._configuredReportings.filter((c) => !(c.attrId === e.attrId && c.cluster === cluster.ID &&
|
|
476
|
+
(!('manufacturerCode' in c) || c.manufacturerCode === options.manufacturerCode)));
|
|
477
|
+
}
|
|
478
|
+
for (const entry of payload) {
|
|
479
|
+
if (entry.maxRepIntval !== 0xFFFF) {
|
|
480
|
+
this._configuredReportings.push({
|
|
481
|
+
cluster: cluster.ID, attrId: entry.attrId, minRepIntval: entry.minRepIntval,
|
|
482
|
+
maxRepIntval: entry.maxRepIntval, repChange: entry.repChange,
|
|
483
|
+
manufacturerCode: options.manufacturerCode,
|
|
484
|
+
});
|
|
585
485
|
}
|
|
586
|
-
this.save();
|
|
587
|
-
}
|
|
588
|
-
catch (error) {
|
|
589
|
-
error.message = `${log} failed (${error.message})`;
|
|
590
|
-
debug.error(error.message);
|
|
591
|
-
throw error;
|
|
592
486
|
}
|
|
487
|
+
this.save();
|
|
593
488
|
}
|
|
594
489
|
async writeStructured(clusterKey, payload, options) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), `writeStructured`, cluster.ID, payload, options.reservedBits);
|
|
598
|
-
const log = `WriteStructured ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
599
|
-
`${cluster.name}(${JSON.stringify(payload)}, ${JSON.stringify(options)})`;
|
|
600
|
-
debug.info(log);
|
|
601
|
-
try {
|
|
602
|
-
await this.sendRequest(frame, options);
|
|
603
|
-
// TODO: support `writeStructuredResponse`
|
|
604
|
-
}
|
|
605
|
-
catch (error) {
|
|
606
|
-
error.message = `${log} failed (${error.message})`;
|
|
607
|
-
debug.error(error.message);
|
|
608
|
-
throw error;
|
|
609
|
-
}
|
|
490
|
+
await this.zclCommand(clusterKey, 'writeStructured', payload, options);
|
|
491
|
+
// TODO: support `writeStructuredResponse`
|
|
610
492
|
}
|
|
611
493
|
async command(clusterKey, commandKey, payload, options) {
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
options = this.getOptionsWithDefaults(options, hasResponse, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
616
|
-
const frame = Zcl.ZclFrame.create(Zcl.FrameType.SPECIFIC, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), command.name, cluster.name, payload, options.reservedBits);
|
|
617
|
-
const log = `Command ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
618
|
-
`${cluster.name}.${command.name}(${JSON.stringify(payload)}, ${JSON.stringify(options)})`;
|
|
619
|
-
debug.info(log);
|
|
620
|
-
try {
|
|
621
|
-
const result = await this.sendRequest(frame, options);
|
|
622
|
-
if (result) {
|
|
623
|
-
return result.frame.Payload;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
catch (error) {
|
|
627
|
-
error.message = `${log} failed (${error.message})`;
|
|
628
|
-
debug.error(error.message);
|
|
629
|
-
throw error;
|
|
494
|
+
const frame = await this.zclCommand(clusterKey, commandKey, payload, options, null, false, Zcl.FrameType.SPECIFIC);
|
|
495
|
+
if (frame) {
|
|
496
|
+
return frame.payload;
|
|
630
497
|
}
|
|
631
498
|
}
|
|
632
499
|
async commandResponse(clusterKey, commandKey, payload, options, transactionSequenceNumber) {
|
|
633
|
-
(0, assert_1.default)(!options || !options.hasOwnProperty(
|
|
634
|
-
const
|
|
500
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter');
|
|
501
|
+
const device = this.getDevice();
|
|
502
|
+
const cluster = this.getCluster(clusterKey, device);
|
|
635
503
|
const command = cluster.getCommandResponse(commandKey);
|
|
636
|
-
transactionSequenceNumber =
|
|
637
|
-
transactionSequenceNumber || zclTransactionSequenceNumber_1.default.next();
|
|
504
|
+
transactionSequenceNumber = transactionSequenceNumber || zclTransactionSequenceNumber_1.default.next();
|
|
638
505
|
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
639
|
-
const frame = Zcl.
|
|
506
|
+
const frame = Zcl.Frame.create(Zcl.FrameType.SPECIFIC, options.direction, options.disableDefaultResponse, options.manufacturerCode, transactionSequenceNumber, command.name, cluster.name, payload, device.customClusters, options.reservedBits);
|
|
640
507
|
const log = `CommandResponse ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
641
508
|
`${cluster.name}.${command.name}(${JSON.stringify(payload)}, ${JSON.stringify(options)})`;
|
|
642
|
-
debug
|
|
509
|
+
logger_1.logger.debug(log, NS);
|
|
643
510
|
try {
|
|
644
511
|
await this.sendRequest(frame, options, async (f) => {
|
|
645
512
|
// Broadcast Green Power responses
|
|
646
513
|
if (this.ID === 242) {
|
|
647
|
-
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToAll(242, f, 242);
|
|
514
|
+
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToAll(242, f, 242, enums_1.BroadcastAddress.RX_ON_WHEN_IDLE);
|
|
648
515
|
}
|
|
649
516
|
else {
|
|
650
517
|
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToEndpoint(this.deviceIeeeAddress, this.deviceNetworkAddress, this.ID, f, options.timeout, options.disableResponse, options.disableRecovery, options.srcEndpoint);
|
|
@@ -653,19 +520,20 @@ class Endpoint extends entity_1.default {
|
|
|
653
520
|
}
|
|
654
521
|
catch (error) {
|
|
655
522
|
error.message = `${log} failed (${error.message})`;
|
|
656
|
-
debug
|
|
523
|
+
logger_1.logger.debug(error, NS);
|
|
657
524
|
throw error;
|
|
658
525
|
}
|
|
659
526
|
}
|
|
660
527
|
waitForCommand(clusterKey, commandKey, transactionSequenceNumber, timeout) {
|
|
661
|
-
const
|
|
528
|
+
const device = this.getDevice();
|
|
529
|
+
const cluster = this.getCluster(clusterKey, device);
|
|
662
530
|
const command = cluster.getCommand(commandKey);
|
|
663
531
|
const waiter = entity_1.default.getAdapterByID(this.databaseID).waitFor(this.deviceNetworkAddress, this.ID, Zcl.FrameType.SPECIFIC, Zcl.Direction.CLIENT_TO_SERVER, transactionSequenceNumber, cluster.ID, command.ID, timeout);
|
|
664
532
|
const promise = new Promise((resolve, reject) => {
|
|
665
|
-
waiter.promise.then((payload) =>
|
|
666
|
-
header
|
|
667
|
-
payload:
|
|
668
|
-
}
|
|
533
|
+
waiter.promise.then((payload) => {
|
|
534
|
+
const frame = Zcl.Frame.fromBuffer(payload.clusterID, payload.header, payload.data, device.customClusters);
|
|
535
|
+
resolve({ header: frame.header, payload: frame.payload });
|
|
536
|
+
}, (error) => reject(error));
|
|
669
537
|
});
|
|
670
538
|
return { promise, cancel: waiter.cancel };
|
|
671
539
|
}
|
|
@@ -679,7 +547,7 @@ class Endpoint extends entity_1.default {
|
|
|
679
547
|
direction,
|
|
680
548
|
srcEndpoint: null,
|
|
681
549
|
reservedBits: 0,
|
|
682
|
-
manufacturerCode: manufacturerCode
|
|
550
|
+
manufacturerCode: manufacturerCode ?? null,
|
|
683
551
|
transactionSequenceNumber: null,
|
|
684
552
|
writeUndiv: false,
|
|
685
553
|
...providedOptions
|
|
@@ -727,6 +595,10 @@ class Endpoint extends entity_1.default {
|
|
|
727
595
|
});
|
|
728
596
|
group.addMember(this);
|
|
729
597
|
}
|
|
598
|
+
getCluster(clusterKey, device = undefined) {
|
|
599
|
+
device = device ?? this.getDevice();
|
|
600
|
+
return Zcl.Utils.getCluster(clusterKey, device.manufacturerID, device.customClusters);
|
|
601
|
+
}
|
|
730
602
|
/**
|
|
731
603
|
* Remove endpoint from a group, accepts both a Group and number as parameter.
|
|
732
604
|
* The number parameter type should only be used when removing from a group which is not known
|
|
@@ -751,6 +623,45 @@ class Endpoint extends entity_1.default {
|
|
|
751
623
|
}
|
|
752
624
|
}
|
|
753
625
|
}
|
|
626
|
+
async zclCommand(clusterKey, commandKey, payload, options, logPayload, checkStatus = false, frameType = Zcl.FrameType.GLOBAL) {
|
|
627
|
+
const device = this.getDevice();
|
|
628
|
+
const cluster = this.getCluster(clusterKey, device);
|
|
629
|
+
const command = (frameType == Zcl.FrameType.GLOBAL) ? Zcl.Utils.getGlobalCommand(commandKey) : cluster.getCommand(commandKey);
|
|
630
|
+
const hasResponse = (frameType == Zcl.FrameType.GLOBAL) ? true : command.hasOwnProperty('response');
|
|
631
|
+
options = this.getOptionsWithDefaults(options, hasResponse, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
632
|
+
const frame = Zcl.Frame.create(frameType, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), command.name, cluster.name, payload, device.customClusters, options.reservedBits);
|
|
633
|
+
const log = `ZCL command ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
634
|
+
`${cluster.name}.${command.name}(${JSON.stringify((logPayload) ? logPayload : payload)}, ${JSON.stringify(options)})`;
|
|
635
|
+
logger_1.logger.debug(log, NS);
|
|
636
|
+
try {
|
|
637
|
+
const result = await this.sendRequest(frame, options);
|
|
638
|
+
if (result) {
|
|
639
|
+
const resultFrame = Zcl.Frame.fromBuffer(result.clusterID, result.header, result.data, device.customClusters);
|
|
640
|
+
if (result && checkStatus && !options.disableResponse) {
|
|
641
|
+
this.checkStatus(resultFrame.payload);
|
|
642
|
+
}
|
|
643
|
+
return resultFrame;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
catch (error) {
|
|
647
|
+
error.message = `${log} failed (${error.message})`;
|
|
648
|
+
logger_1.logger.debug(error, NS);
|
|
649
|
+
throw error;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
async zclCommandBroadcast(endpoint, destination, clusterKey, commandKey, payload, options) {
|
|
653
|
+
const device = this.getDevice();
|
|
654
|
+
const cluster = this.getCluster(clusterKey, device);
|
|
655
|
+
const command = cluster.getCommand(commandKey);
|
|
656
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
657
|
+
const sourceEndpoint = options.srcEndpoint ?? this.ID;
|
|
658
|
+
const frame = Zcl.Frame.create(Zcl.FrameType.SPECIFIC, options.direction, true, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), command.name, cluster.name, payload, device.customClusters, options.reservedBits);
|
|
659
|
+
const log = `ZCL command broadcast ${this.deviceIeeeAddress}/${sourceEndpoint} to ${destination}/${endpoint} ` +
|
|
660
|
+
`${cluster.name}.${command.name}(${JSON.stringify({ payload, options })})`;
|
|
661
|
+
logger_1.logger.debug(log, NS);
|
|
662
|
+
// if endpoint===0xFF ("broadcast endpoint"), deliver to all endpoints supporting cluster, should be avoided whenever possible
|
|
663
|
+
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToAll(endpoint, frame, sourceEndpoint, destination);
|
|
664
|
+
}
|
|
754
665
|
}
|
|
755
666
|
exports.default = Endpoint;
|
|
756
667
|
//# sourceMappingURL=endpoint.js.map
|