@willieee802/zigbee-herdsman 0.19.21 → 0.34.3
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/.babelrc.js +0 -4
- package/.release-please-manifest.json +1 -2
- package/CHANGELOG.md +376 -0
- package/README.md +1 -1
- package/dist/adapter/adapter.d.ts +61 -61
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.js +158 -153
- package/dist/adapter/adapter.js.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +68 -68
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +1081 -1060
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
- package/dist/adapter/deconz/adapter/index.d.ts +2 -2
- package/dist/adapter/deconz/adapter/index.js +10 -10
- package/dist/adapter/deconz/driver/constants.d.ts +104 -104
- package/dist/adapter/deconz/driver/constants.js +55 -55
- package/dist/adapter/deconz/driver/driver.d.ts +81 -81
- package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/driver.js +750 -732
- package/dist/adapter/deconz/driver/driver.js.map +1 -1
- package/dist/adapter/deconz/driver/frame.d.ts +6 -6
- package/dist/adapter/deconz/driver/frame.js +13 -13
- package/dist/adapter/deconz/driver/frameParser.d.ts +2 -2
- package/dist/adapter/deconz/driver/frameParser.js +443 -443
- package/dist/adapter/deconz/driver/frameParser.js.map +1 -1
- package/dist/adapter/deconz/driver/parser.d.ts +12 -12
- package/dist/adapter/deconz/driver/parser.js +63 -61
- package/dist/adapter/deconz/driver/parser.js.map +1 -1
- package/dist/adapter/deconz/driver/writer.d.ts +8 -8
- package/dist/adapter/deconz/driver/writer.js +44 -44
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +817 -0
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/emberAdapter.js +2981 -0
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -0
- package/dist/adapter/ember/adapter/endpoints.d.ts +25 -0
- package/dist/adapter/ember/adapter/endpoints.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/endpoints.js +66 -0
- package/dist/adapter/ember/adapter/endpoints.js.map +1 -0
- package/dist/adapter/ember/adapter/index.d.ts +3 -0
- package/dist/adapter/ember/adapter/index.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/index.js +6 -0
- package/dist/adapter/ember/adapter/index.js.map +1 -0
- package/dist/adapter/ember/adapter/oneWaitress.d.ts +97 -0
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/oneWaitress.js +226 -0
- package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -0
- package/dist/adapter/ember/adapter/requestQueue.d.ts +59 -0
- package/dist/adapter/ember/adapter/requestQueue.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/requestQueue.js +144 -0
- package/dist/adapter/ember/adapter/requestQueue.js.map +1 -0
- package/dist/adapter/ember/adapter/tokensManager.d.ts +69 -0
- package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -0
- package/dist/adapter/ember/adapter/tokensManager.js +685 -0
- package/dist/adapter/ember/adapter/tokensManager.js.map +1 -0
- package/dist/adapter/ember/consts.d.ts +198 -0
- package/dist/adapter/ember/consts.d.ts.map +1 -0
- package/dist/adapter/ember/consts.js +253 -0
- package/dist/adapter/ember/consts.js.map +1 -0
- package/dist/adapter/ember/enums.d.ts +2184 -0
- package/dist/adapter/ember/enums.d.ts.map +1 -0
- package/dist/adapter/ember/enums.js +2391 -0
- package/dist/adapter/ember/enums.js.map +1 -0
- package/dist/adapter/ember/ezsp/buffalo.d.ts +156 -0
- package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -0
- package/dist/adapter/ember/ezsp/buffalo.js +1033 -0
- package/dist/adapter/ember/ezsp/buffalo.js.map +1 -0
- package/dist/adapter/ember/ezsp/consts.d.ts +116 -0
- package/dist/adapter/ember/ezsp/consts.d.ts.map +1 -0
- package/dist/adapter/ember/ezsp/consts.js +128 -0
- package/dist/adapter/ember/ezsp/consts.js.map +1 -0
- package/dist/adapter/ember/ezsp/enums.d.ts +879 -0
- package/dist/adapter/ember/ezsp/enums.d.ts.map +1 -0
- package/dist/adapter/ember/ezsp/enums.js +948 -0
- package/dist/adapter/ember/ezsp/enums.js.map +1 -0
- package/dist/adapter/ember/ezsp/ezsp.d.ts +2664 -0
- package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -0
- package/dist/adapter/ember/ezsp/ezsp.js +6438 -0
- package/dist/adapter/ember/ezsp/ezsp.js.map +1 -0
- package/dist/adapter/ember/types.d.ts +733 -0
- package/dist/adapter/ember/types.d.ts.map +1 -0
- package/dist/adapter/ember/types.js +3 -0
- package/dist/adapter/ember/types.js.map +1 -0
- package/dist/adapter/ember/uart/ash.d.ts +451 -0
- package/dist/adapter/ember/uart/ash.d.ts.map +1 -0
- package/dist/adapter/ember/uart/ash.js +1584 -0
- package/dist/adapter/ember/uart/ash.js.map +1 -0
- package/dist/adapter/ember/uart/consts.d.ts +91 -0
- package/dist/adapter/ember/uart/consts.d.ts.map +1 -0
- package/dist/adapter/ember/uart/consts.js +100 -0
- package/dist/adapter/ember/uart/consts.js.map +1 -0
- package/dist/adapter/ember/uart/enums.d.ts +191 -0
- package/dist/adapter/ember/uart/enums.d.ts.map +1 -0
- package/dist/adapter/ember/uart/enums.js +197 -0
- package/dist/adapter/ember/uart/enums.js.map +1 -0
- package/dist/adapter/ember/uart/parser.d.ts +10 -0
- package/dist/adapter/ember/uart/parser.d.ts.map +1 -0
- package/dist/adapter/ember/uart/parser.js +41 -0
- package/dist/adapter/ember/uart/parser.js.map +1 -0
- package/dist/adapter/ember/uart/queues.d.ts +85 -0
- package/dist/adapter/ember/uart/queues.d.ts.map +1 -0
- package/dist/adapter/ember/uart/queues.js +212 -0
- package/dist/adapter/ember/uart/queues.js.map +1 -0
- package/dist/adapter/ember/uart/writer.d.ts +15 -0
- package/dist/adapter/ember/uart/writer.d.ts.map +1 -0
- package/dist/adapter/ember/uart/writer.js +48 -0
- package/dist/adapter/ember/uart/writer.js.map +1 -0
- package/dist/adapter/ember/utils/initters.d.ts +20 -0
- package/dist/adapter/ember/utils/initters.d.ts.map +1 -0
- package/dist/adapter/ember/utils/initters.js +58 -0
- package/dist/adapter/ember/utils/initters.js.map +1 -0
- package/dist/adapter/ember/utils/math.d.ts +51 -0
- package/dist/adapter/ember/utils/math.d.ts.map +1 -0
- package/dist/adapter/ember/utils/math.js +102 -0
- package/dist/adapter/ember/utils/math.js.map +1 -0
- package/dist/adapter/ember/zdo.d.ts +921 -0
- package/dist/adapter/ember/zdo.d.ts.map +1 -0
- package/dist/adapter/ember/zdo.js +723 -0
- package/dist/adapter/ember/zdo.js.map +1 -0
- package/dist/adapter/events.d.ts +47 -47
- package/dist/adapter/events.js +13 -14
- package/dist/adapter/events.js.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.d.ts +9 -9
- package/dist/adapter/ezsp/adapter/backup.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.js +72 -53
- package/dist/adapter/ezsp/adapter/backup.js.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +61 -60
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +629 -608
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
- package/dist/adapter/ezsp/adapter/index.d.ts +2 -2
- package/dist/adapter/ezsp/adapter/index.js +10 -10
- package/dist/adapter/ezsp/driver/commands.d.ts +36 -36
- package/dist/adapter/ezsp/driver/commands.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/commands.js +2388 -2359
- package/dist/adapter/ezsp/driver/commands.js.map +1 -1
- package/dist/adapter/ezsp/driver/consts.d.ts +10 -10
- package/dist/adapter/ezsp/driver/consts.js +13 -13
- package/dist/adapter/ezsp/driver/driver.d.ts +106 -101
- package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/driver.js +731 -638
- package/dist/adapter/ezsp/driver/driver.js.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.d.ts +105 -96
- package/dist/adapter/ezsp/driver/ezsp.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.js +651 -586
- package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
- package/dist/adapter/ezsp/driver/frame.d.ts +40 -0
- package/dist/adapter/ezsp/driver/frame.d.ts.map +1 -0
- package/dist/adapter/ezsp/driver/frame.js +101 -0
- package/dist/adapter/ezsp/driver/frame.js.map +1 -0
- package/dist/adapter/ezsp/driver/index.d.ts +3 -3
- package/dist/adapter/ezsp/driver/index.js +8 -8
- package/dist/adapter/ezsp/driver/multicast.d.ts +12 -12
- package/dist/adapter/ezsp/driver/multicast.js +77 -72
- package/dist/adapter/ezsp/driver/multicast.js.map +1 -1
- package/dist/adapter/ezsp/driver/parser.d.ts +11 -12
- package/dist/adapter/ezsp/driver/parser.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/parser.js +104 -111
- package/dist/adapter/ezsp/driver/parser.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/basic.d.ts +62 -62
- package/dist/adapter/ezsp/driver/types/basic.js +208 -208
- package/dist/adapter/ezsp/driver/types/basic.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.d.ts +9 -9
- package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.js +138 -133
- package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/named.d.ts +1287 -697
- package/dist/adapter/ezsp/driver/types/named.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/named.js +2329 -1726
- package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/struct.d.ts +270 -251
- package/dist/adapter/ezsp/driver/types/struct.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/struct.js +803 -708
- package/dist/adapter/ezsp/driver/types/struct.js.map +1 -1
- package/dist/adapter/ezsp/driver/uart.d.ts +48 -44
- package/dist/adapter/ezsp/driver/uart.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/uart.js +382 -368
- package/dist/adapter/ezsp/driver/uart.js.map +1 -1
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts +2 -2
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js +55 -55
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js.map +1 -1
- package/dist/adapter/ezsp/driver/utils/index.d.ts +18 -18
- package/dist/adapter/ezsp/driver/utils/index.js +72 -67
- package/dist/adapter/ezsp/driver/utils/index.js.map +1 -1
- package/dist/adapter/ezsp/driver/writer.d.ts +13 -13
- package/dist/adapter/ezsp/driver/writer.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/writer.js +85 -88
- package/dist/adapter/ezsp/driver/writer.js.map +1 -1
- package/dist/adapter/index.d.ts +4 -4
- package/dist/adapter/index.js +35 -35
- package/dist/adapter/serialPort.d.ts +10 -8
- package/dist/adapter/serialPort.d.ts.map +1 -1
- package/dist/adapter/serialPort.js +53 -22
- package/dist/adapter/serialPort.js.map +1 -1
- package/dist/adapter/serialPortUtils.d.ts +12 -12
- package/dist/adapter/serialPortUtils.js +18 -18
- package/dist/adapter/serialPortUtils.js.map +1 -1
- package/dist/adapter/socketPortUtils.d.ts +10 -10
- package/dist/adapter/socketPortUtils.js +16 -16
- package/dist/adapter/tstype.d.ts +85 -85
- package/dist/adapter/tstype.d.ts.map +1 -1
- package/dist/adapter/tstype.js +2 -2
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +62 -62
- package/dist/adapter/z-stack/adapter/adapter-backup.js +462 -461
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts +150 -150
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +258 -258
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js.map +1 -1
- package/dist/adapter/z-stack/adapter/endpoints.d.ts +11 -11
- package/dist/adapter/z-stack/adapter/endpoints.js +73 -73
- package/dist/adapter/z-stack/adapter/index.d.ts +2 -2
- package/dist/adapter/z-stack/adapter/index.js +8 -8
- package/dist/adapter/z-stack/adapter/manager.d.ts +86 -86
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.js +482 -476
- package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
- package/dist/adapter/z-stack/adapter/tstype.d.ts +6 -6
- package/dist/adapter/z-stack/adapter/tstype.js +9 -10
- package/dist/adapter/z-stack/adapter/tstype.js.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +81 -81
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +891 -868
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
- package/dist/adapter/z-stack/constants/af.d.ts +23 -23
- package/dist/adapter/z-stack/constants/af.js +27 -27
- package/dist/adapter/z-stack/constants/common.d.ts +278 -278
- package/dist/adapter/z-stack/constants/common.d.ts.map +1 -1
- package/dist/adapter/z-stack/constants/common.js +292 -289
- package/dist/adapter/z-stack/constants/common.js.map +1 -1
- package/dist/adapter/z-stack/constants/dbg.d.ts +22 -22
- package/dist/adapter/z-stack/constants/dbg.js +24 -24
- package/dist/adapter/z-stack/constants/index.d.ts +10 -10
- package/dist/adapter/z-stack/constants/index.js +47 -47
- package/dist/adapter/z-stack/constants/mac.d.ts +127 -127
- package/dist/adapter/z-stack/constants/mac.js +129 -129
- package/dist/adapter/z-stack/constants/sapi.d.ts +24 -24
- package/dist/adapter/z-stack/constants/sapi.js +26 -26
- package/dist/adapter/z-stack/constants/sys.d.ts +71 -71
- package/dist/adapter/z-stack/constants/sys.js +73 -73
- package/dist/adapter/z-stack/constants/util.d.ts +81 -81
- package/dist/adapter/z-stack/constants/util.js +83 -83
- package/dist/adapter/z-stack/constants/utils.d.ts +4 -4
- package/dist/adapter/z-stack/constants/utils.js +14 -14
- package/dist/adapter/z-stack/constants/zdo.d.ts +102 -102
- package/dist/adapter/z-stack/constants/zdo.js +104 -104
- package/dist/adapter/z-stack/models/index.d.ts +1 -1
- package/dist/adapter/z-stack/models/index.js +17 -17
- package/dist/adapter/z-stack/models/startup-options.d.ts +12 -12
- package/dist/adapter/z-stack/models/startup-options.js +2 -2
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts +23 -23
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js +45 -45
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/address-manager-table.js +22 -22
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js +21 -21
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js +23 -23
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js +24 -24
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js +23 -23
- package/dist/adapter/z-stack/structs/entries/channel-list.d.ts +8 -8
- package/dist/adapter/z-stack/structs/entries/channel-list.js +15 -15
- package/dist/adapter/z-stack/structs/entries/has-configured.d.ts +8 -8
- package/dist/adapter/z-stack/structs/entries/has-configured.js +16 -16
- package/dist/adapter/z-stack/structs/entries/index.d.ts +16 -16
- package/dist/adapter/z-stack/structs/entries/index.js +32 -32
- package/dist/adapter/z-stack/structs/entries/nib.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/nib.js +68 -68
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js +18 -18
- package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts +8 -8
- package/dist/adapter/z-stack/structs/entries/nwk-key.js +15 -15
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts +8 -8
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js +15 -15
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts +13 -13
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js +23 -23
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js +22 -22
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts +20 -20
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js +36 -36
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts +10 -10
- package/dist/adapter/z-stack/structs/entries/security-manager-table.js +24 -24
- package/dist/adapter/z-stack/structs/index.d.ts +4 -4
- package/dist/adapter/z-stack/structs/index.js +20 -20
- package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts +13 -13
- package/dist/adapter/z-stack/structs/serializable-memory-object.js +2 -2
- package/dist/adapter/z-stack/structs/struct.d.ts +99 -99
- package/dist/adapter/z-stack/structs/struct.js +296 -295
- package/dist/adapter/z-stack/structs/struct.js.map +1 -1
- package/dist/adapter/z-stack/structs/table.d.ts +94 -94
- package/dist/adapter/z-stack/structs/table.js +163 -161
- package/dist/adapter/z-stack/structs/table.js.map +1 -1
- package/dist/adapter/z-stack/unpi/constants.d.ts +28 -28
- package/dist/adapter/z-stack/unpi/constants.js +39 -41
- package/dist/adapter/z-stack/unpi/constants.js.map +1 -1
- package/dist/adapter/z-stack/unpi/frame.d.ts +16 -16
- package/dist/adapter/z-stack/unpi/frame.js +54 -48
- package/dist/adapter/z-stack/unpi/frame.js.map +1 -1
- package/dist/adapter/z-stack/unpi/index.d.ts +5 -5
- package/dist/adapter/z-stack/unpi/index.js +37 -37
- package/dist/adapter/z-stack/unpi/parser.d.ts +10 -10
- package/dist/adapter/z-stack/unpi/parser.js +75 -74
- package/dist/adapter/z-stack/unpi/parser.js.map +1 -1
- package/dist/adapter/z-stack/unpi/writer.d.ts +10 -10
- package/dist/adapter/z-stack/unpi/writer.js +44 -44
- package/dist/adapter/z-stack/utils/channel-list.d.ts +20 -20
- package/dist/adapter/z-stack/utils/channel-list.js +40 -40
- package/dist/adapter/z-stack/utils/channel-list.js.map +1 -1
- package/dist/adapter/z-stack/utils/index.d.ts +2 -2
- package/dist/adapter/z-stack/utils/index.js +18 -18
- package/dist/adapter/z-stack/utils/network-options.d.ts +8 -8
- package/dist/adapter/z-stack/utils/network-options.js +22 -22
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +11 -11
- package/dist/adapter/z-stack/znp/buffaloZnp.js +113 -113
- package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
- package/dist/adapter/z-stack/znp/definition.d.ts +5 -5
- package/dist/adapter/z-stack/znp/definition.js +3050 -3050
- package/dist/adapter/z-stack/znp/index.d.ts +3 -3
- package/dist/adapter/z-stack/znp/index.js +10 -10
- package/dist/adapter/z-stack/znp/parameterType.d.ts +22 -22
- package/dist/adapter/z-stack/znp/parameterType.js +25 -25
- package/dist/adapter/z-stack/znp/tstype.d.ts +21 -21
- package/dist/adapter/z-stack/znp/tstype.js +2 -2
- package/dist/adapter/z-stack/znp/znp.d.ts +44 -43
- package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/znp.js +326 -325
- package/dist/adapter/z-stack/znp/znp.js.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.d.ts +19 -19
- package/dist/adapter/z-stack/znp/zpiObject.js +102 -96
- package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
- package/dist/adapter/zigate/adapter/index.d.ts +2 -2
- package/dist/adapter/zigate/adapter/index.js +10 -10
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +70 -70
- package/dist/adapter/zigate/adapter/zigateAdapter.js +689 -684
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
- package/dist/adapter/zigate/debug.d.ts +7 -7
- package/dist/adapter/zigate/debug.d.ts.map +1 -1
- package/dist/adapter/zigate/debug.js +19 -22
- package/dist/adapter/zigate/debug.js.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts +18 -18
- package/dist/adapter/zigate/driver/buffaloZiGate.js +139 -139
- package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
- package/dist/adapter/zigate/driver/commandType.d.ts +41 -41
- package/dist/adapter/zigate/driver/commandType.js +385 -385
- package/dist/adapter/zigate/driver/commandType.js.map +1 -1
- package/dist/adapter/zigate/driver/constants.d.ts +276 -276
- package/dist/adapter/zigate/driver/constants.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/constants.js +371 -371
- package/dist/adapter/zigate/driver/constants.js.map +1 -1
- package/dist/adapter/zigate/driver/frame.d.ts +26 -26
- package/dist/adapter/zigate/driver/frame.js +172 -172
- package/dist/adapter/zigate/driver/frame.js.map +1 -1
- package/dist/adapter/zigate/driver/messageType.d.ts +11 -11
- package/dist/adapter/zigate/driver/messageType.js +278 -278
- package/dist/adapter/zigate/driver/messageType.js.map +1 -1
- package/dist/adapter/zigate/driver/parameterType.d.ts +20 -20
- package/dist/adapter/zigate/driver/parameterType.js +23 -23
- package/dist/adapter/zigate/driver/ziGateObject.d.ts +23 -23
- package/dist/adapter/zigate/driver/ziGateObject.js +110 -106
- package/dist/adapter/zigate/driver/ziGateObject.js.map +1 -1
- package/dist/adapter/zigate/driver/zigate.d.ts +49 -49
- package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/zigate.js +296 -303
- package/dist/adapter/zigate/driver/zigate.js.map +1 -1
- package/dist/buffalo/buffalo.d.ts +50 -50
- package/dist/buffalo/buffalo.js +324 -322
- package/dist/buffalo/buffalo.js.map +1 -1
- package/dist/buffalo/index.d.ts +3 -3
- package/dist/buffalo/index.js +33 -33
- package/dist/buffalo/tstype.d.ts +8 -8
- package/dist/buffalo/tstype.js +2 -2
- package/dist/controller/controller.d.ts +113 -113
- package/dist/controller/controller.d.ts.map +1 -1
- package/dist/controller/controller.js +641 -619
- package/dist/controller/controller.js.map +1 -1
- package/dist/controller/database.d.ts +18 -18
- package/dist/controller/database.js +96 -93
- package/dist/controller/database.js.map +1 -1
- package/dist/controller/events.d.ts +58 -58
- package/dist/controller/events.d.ts.map +1 -1
- package/dist/controller/events.js +108 -102
- package/dist/controller/events.js.map +1 -1
- package/dist/controller/greenPower.d.ts +12 -12
- package/dist/controller/greenPower.js +221 -220
- package/dist/controller/greenPower.js.map +1 -1
- package/dist/controller/helpers/index.d.ts +2 -2
- package/dist/controller/helpers/index.js +28 -28
- package/dist/controller/helpers/request.d.ts +21 -22
- package/dist/controller/helpers/request.d.ts.map +1 -1
- package/dist/controller/helpers/request.js +77 -71
- package/dist/controller/helpers/request.js.map +1 -1
- package/dist/controller/helpers/requestQueue.d.ts +13 -0
- package/dist/controller/helpers/requestQueue.d.ts.map +1 -0
- package/dist/controller/helpers/requestQueue.js +116 -0
- package/dist/controller/helpers/requestQueue.js.map +1 -0
- package/dist/controller/helpers/zclFrameConverter.d.ts +7 -7
- package/dist/controller/helpers/zclFrameConverter.d.ts.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.js +50 -31
- package/dist/controller/helpers/zclFrameConverter.js.map +1 -1
- package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts +5 -5
- package/dist/controller/helpers/zclTransactionSequenceNumber.js +13 -13
- package/dist/controller/helpers/zclTransactionSequenceNumber.js.map +1 -1
- package/dist/controller/index.d.ts +5 -5
- package/dist/controller/index.js +8 -8
- package/dist/controller/logger-stub.d.ts +6 -6
- package/dist/controller/logger-stub.js +2 -2
- package/dist/controller/model/device.d.ts +132 -133
- package/dist/controller/model/device.d.ts.map +1 -1
- package/dist/controller/model/device.js +724 -717
- package/dist/controller/model/device.js.map +1 -1
- package/dist/controller/model/endpoint.d.ts +128 -131
- package/dist/controller/model/endpoint.d.ts.map +1 -1
- package/dist/controller/model/endpoint.js +755 -821
- package/dist/controller/model/endpoint.js.map +1 -1
- package/dist/controller/model/entity.d.ts +14 -14
- package/dist/controller/model/entity.js +26 -26
- package/dist/controller/model/entity.js.map +1 -1
- package/dist/controller/model/group.d.ts +38 -38
- package/dist/controller/model/group.d.ts.map +1 -1
- package/dist/controller/model/group.js +225 -221
- package/dist/controller/model/group.js.map +1 -1
- package/dist/controller/model/index.d.ts +5 -5
- package/dist/controller/model/index.js +14 -14
- package/dist/controller/touchlink.d.ts +19 -19
- package/dist/controller/touchlink.js +159 -157
- package/dist/controller/touchlink.js.map +1 -1
- package/dist/controller/tstype.d.ts +20 -21
- package/dist/controller/tstype.d.ts.map +1 -1
- package/dist/controller/tstype.js +8 -9
- package/dist/controller/tstype.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +33 -33
- package/dist/models/backup-storage-legacy.d.ts +26 -26
- package/dist/models/backup-storage-legacy.js +2 -2
- package/dist/models/backup-storage-unified.d.ts +49 -49
- package/dist/models/backup-storage-unified.js +2 -2
- package/dist/models/backup.d.ts +37 -37
- package/dist/models/backup.js +2 -2
- package/dist/models/index.d.ts +4 -4
- package/dist/models/index.js +20 -20
- package/dist/models/network-options.d.ts +12 -12
- package/dist/models/network-options.js +2 -2
- package/dist/utils/assertString.d.ts +2 -2
- package/dist/utils/assertString.js +8 -8
- package/dist/utils/assertString.js.map +1 -1
- package/dist/utils/backup.d.ts +20 -20
- package/dist/utils/backup.d.ts.map +1 -1
- package/dist/utils/backup.js +189 -187
- package/dist/utils/backup.js.map +1 -1
- package/dist/utils/equalsPartial.d.ts +2 -2
- package/dist/utils/equalsPartial.js +11 -11
- package/dist/utils/index.d.ts +9 -9
- package/dist/utils/index.js +45 -45
- package/dist/utils/isNumberArray.d.ts +2 -2
- package/dist/utils/isNumberArray.js +6 -6
- package/dist/utils/queue.d.ts +11 -11
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/queue.js +61 -50
- package/dist/utils/queue.js.map +1 -1
- package/dist/utils/realpathSync.d.ts +2 -2
- package/dist/utils/realpathSync.js +12 -12
- package/dist/utils/wait.d.ts +2 -2
- package/dist/utils/wait.js +8 -8
- package/dist/utils/waitress.d.ts +21 -21
- package/dist/utils/waitress.d.ts.map +1 -1
- package/dist/utils/waitress.js +68 -61
- package/dist/utils/waitress.js.map +1 -1
- package/dist/zcl/buffaloZcl.d.ts +41 -41
- package/dist/zcl/buffaloZcl.d.ts.map +1 -1
- package/dist/zcl/buffaloZcl.js +594 -591
- package/dist/zcl/buffaloZcl.js.map +1 -1
- package/dist/zcl/definition/buffaloZclDataType.d.ts +17 -17
- package/dist/zcl/definition/buffaloZclDataType.js +20 -20
- package/dist/zcl/definition/cluster.d.ts +29 -29
- package/dist/zcl/definition/cluster.d.ts.map +1 -1
- package/dist/zcl/definition/cluster.js +5520 -5335
- package/dist/zcl/definition/cluster.js.map +1 -1
- package/dist/zcl/definition/dataType.d.ts +59 -59
- package/dist/zcl/definition/dataType.js +64 -64
- package/dist/zcl/definition/direction.d.ts +5 -5
- package/dist/zcl/definition/direction.js +8 -8
- package/dist/zcl/definition/endpointDeviceType.d.ts +4 -4
- package/dist/zcl/definition/endpointDeviceType.js +15 -15
- package/dist/zcl/definition/foundation.d.ts +11 -11
- package/dist/zcl/definition/foundation.js +167 -167
- package/dist/zcl/definition/frameControl.d.ts +10 -10
- package/dist/zcl/definition/frameControl.js +2 -2
- package/dist/zcl/definition/frameType.d.ts +5 -5
- package/dist/zcl/definition/frameType.js +8 -8
- package/dist/zcl/definition/index.d.ts +13 -13
- package/dist/zcl/definition/index.js +51 -51
- package/dist/zcl/definition/manufacturerCode.d.ts +1077 -1074
- package/dist/zcl/definition/manufacturerCode.d.ts.map +1 -1
- package/dist/zcl/definition/manufacturerCode.js +1082 -1079
- package/dist/zcl/definition/manufacturerCode.js.map +1 -1
- package/dist/zcl/definition/powerSource.d.ts +4 -4
- package/dist/zcl/definition/powerSource.js +12 -12
- package/dist/zcl/definition/status.d.ts +38 -38
- package/dist/zcl/definition/status.js +41 -41
- package/dist/zcl/definition/tstype.d.ts +16 -16
- package/dist/zcl/definition/tstype.js +2 -2
- package/dist/zcl/index.d.ts +16 -16
- package/dist/zcl/index.js +55 -55
- package/dist/zcl/tstype.d.ts +56 -56
- package/dist/zcl/tstype.js +9 -10
- package/dist/zcl/tstype.js.map +1 -1
- package/dist/zcl/utils.d.ts +6 -6
- package/dist/zcl/utils.js +164 -165
- package/dist/zcl/utils.js.map +1 -1
- package/dist/zcl/zclFrame.d.ts +40 -40
- package/dist/zcl/zclFrame.js +351 -347
- package/dist/zcl/zclFrame.js.map +1 -1
- package/dist/zcl/zclHeader.d.ts +8 -8
- package/dist/zcl/zclHeader.js +2 -2
- package/dist/zcl/zclStatusError.d.ts +5 -5
- package/dist/zcl/zclStatusError.js +14 -13
- package/dist/zcl/zclStatusError.js.map +1 -1
- package/package.json +11 -11
- package/release-please-config.json +1 -5
- package/tsconfig.json +4 -2
|
@@ -1,822 +1,756 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const entity_1 = __importDefault(require("./entity"));
|
|
30
|
-
const Zcl = __importStar(require("../../zcl"));
|
|
31
|
-
const zclTransactionSequenceNumber_1 = __importDefault(require("../helpers/zclTransactionSequenceNumber"));
|
|
32
|
-
const ZclFrameConverter = __importStar(require("../helpers/zclFrameConverter"));
|
|
33
|
-
const request_1 = __importDefault(require("../helpers/request"));
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.
|
|
182
|
-
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
async
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
type
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
debug.error(error.message);
|
|
757
|
-
throw error;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
waitForCommand(clusterKey, commandKey, transactionSequenceNumber, timeout) {
|
|
761
|
-
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
762
|
-
const command = cluster.getCommand(commandKey);
|
|
763
|
-
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);
|
|
764
|
-
const promise = new Promise((resolve, reject) => {
|
|
765
|
-
waiter.promise.then((payload) => resolve({
|
|
766
|
-
header: payload.frame.Header,
|
|
767
|
-
payload: payload.frame.Payload,
|
|
768
|
-
}), (error) => reject(error));
|
|
769
|
-
});
|
|
770
|
-
return { promise, cancel: waiter.cancel };
|
|
771
|
-
}
|
|
772
|
-
getOptionsWithDefaults(options, disableDefaultResponse, direction, manufacturerCode) {
|
|
773
|
-
const providedOptions = options || {};
|
|
774
|
-
return {
|
|
775
|
-
sendWhen: this.getDevice().defaultSendRequestWhen,
|
|
776
|
-
timeout: 10000,
|
|
777
|
-
disableResponse: false,
|
|
778
|
-
disableRecovery: false,
|
|
779
|
-
disableDefaultResponse,
|
|
780
|
-
direction,
|
|
781
|
-
srcEndpoint: null,
|
|
782
|
-
reservedBits: 0,
|
|
783
|
-
manufacturerCode: manufacturerCode ? manufacturerCode : null,
|
|
784
|
-
transactionSequenceNumber: null,
|
|
785
|
-
writeUndiv: false,
|
|
786
|
-
...providedOptions,
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
async addToGroup(group) {
|
|
790
|
-
await this.command("genGroups", "add", {
|
|
791
|
-
groupid: group.groupID,
|
|
792
|
-
groupname: "",
|
|
793
|
-
});
|
|
794
|
-
group.addMember(this);
|
|
795
|
-
}
|
|
796
|
-
/**
|
|
797
|
-
* Remove endpoint from a group, accepts both a Group and number as parameter.
|
|
798
|
-
* The number parameter type should only be used when removing from a group which is not known
|
|
799
|
-
* to zigbee-herdsman.
|
|
800
|
-
*/
|
|
801
|
-
async removeFromGroup(group) {
|
|
802
|
-
await this.command("genGroups", "remove", {
|
|
803
|
-
groupid: group instanceof group_1.default ? group.groupID : group,
|
|
804
|
-
});
|
|
805
|
-
if (group instanceof group_1.default) {
|
|
806
|
-
group.removeMember(this);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
async removeFromAllGroups() {
|
|
810
|
-
await this.command("genGroups", "removeAll", {}, { disableDefaultResponse: true });
|
|
811
|
-
this.removeFromAllGroupsDatabase();
|
|
812
|
-
}
|
|
813
|
-
removeFromAllGroupsDatabase() {
|
|
814
|
-
for (const group of group_1.default.allByDatabaseID(this.databaseID)) {
|
|
815
|
-
if (group.hasMember(this)) {
|
|
816
|
-
group.removeMember(this);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
exports.default = Endpoint;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const entity_1 = __importDefault(require("./entity"));
|
|
30
|
+
const Zcl = __importStar(require("../../zcl"));
|
|
31
|
+
const zclTransactionSequenceNumber_1 = __importDefault(require("../helpers/zclTransactionSequenceNumber"));
|
|
32
|
+
const ZclFrameConverter = __importStar(require("../helpers/zclFrameConverter"));
|
|
33
|
+
const request_1 = __importDefault(require("../helpers/request"));
|
|
34
|
+
const requestQueue_1 = __importDefault(require("../helpers/requestQueue"));
|
|
35
|
+
const group_1 = __importDefault(require("./group"));
|
|
36
|
+
const device_1 = __importDefault(require("./device"));
|
|
37
|
+
const debug_1 = __importDefault(require("debug"));
|
|
38
|
+
const assert_1 = __importDefault(require("assert"));
|
|
39
|
+
const debug = {
|
|
40
|
+
info: (0, debug_1.default)("zigbee-herdsman:controller:endpoint"),
|
|
41
|
+
error: (0, debug_1.default)("zigbee-herdsman:controller:endpoint"),
|
|
42
|
+
};
|
|
43
|
+
class Endpoint extends entity_1.default {
|
|
44
|
+
databaseID;
|
|
45
|
+
deviceID;
|
|
46
|
+
inputClusters;
|
|
47
|
+
outputClusters;
|
|
48
|
+
profileID;
|
|
49
|
+
ID;
|
|
50
|
+
clusters;
|
|
51
|
+
deviceIeeeAddress;
|
|
52
|
+
deviceNetworkAddress;
|
|
53
|
+
_binds;
|
|
54
|
+
_configuredReportings;
|
|
55
|
+
meta;
|
|
56
|
+
pendingRequests;
|
|
57
|
+
// Getters/setters
|
|
58
|
+
get binds() {
|
|
59
|
+
return this._binds
|
|
60
|
+
.map((entry) => {
|
|
61
|
+
let target = null;
|
|
62
|
+
if (entry.type === "endpoint") {
|
|
63
|
+
const device = device_1.default.byIeeeAddr(this.databaseID, entry.deviceIeeeAddress);
|
|
64
|
+
if (device) {
|
|
65
|
+
target = device.getEndpoint(entry.endpointID);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
target = group_1.default.byGroupID(entry.groupID, this.databaseID);
|
|
70
|
+
}
|
|
71
|
+
if (target) {
|
|
72
|
+
return {
|
|
73
|
+
target,
|
|
74
|
+
cluster: Zcl.Utils.getCluster(entry.cluster, this.getDevice().manufacturerID),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
.filter((b) => b !== undefined);
|
|
82
|
+
}
|
|
83
|
+
get configuredReportings() {
|
|
84
|
+
return this._configuredReportings.map((entry) => {
|
|
85
|
+
const cluster = Zcl.Utils.getCluster(entry.cluster, entry.manufacturerCode);
|
|
86
|
+
let attribute;
|
|
87
|
+
if (cluster.hasAttribute(entry.attrId)) {
|
|
88
|
+
attribute = cluster.getAttribute(entry.attrId);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
attribute = {
|
|
92
|
+
ID: entry.attrId,
|
|
93
|
+
name: undefined,
|
|
94
|
+
type: undefined,
|
|
95
|
+
manufacturerCode: undefined,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
cluster,
|
|
100
|
+
attribute,
|
|
101
|
+
minimumReportInterval: entry.minRepIntval,
|
|
102
|
+
maximumReportInterval: entry.maxRepIntval,
|
|
103
|
+
reportableChange: entry.repChange,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
constructor(databaseID, ID, profileID, deviceID, inputClusters, outputClusters, deviceNetworkAddress, deviceIeeeAddress, clusters, binds, configuredReportings, meta) {
|
|
108
|
+
super();
|
|
109
|
+
this.databaseID = databaseID;
|
|
110
|
+
this.ID = ID;
|
|
111
|
+
this.profileID = profileID;
|
|
112
|
+
this.deviceID = deviceID;
|
|
113
|
+
this.inputClusters = inputClusters;
|
|
114
|
+
this.outputClusters = outputClusters;
|
|
115
|
+
this.deviceNetworkAddress = deviceNetworkAddress;
|
|
116
|
+
this.deviceIeeeAddress = deviceIeeeAddress;
|
|
117
|
+
this.clusters = clusters;
|
|
118
|
+
this._binds = binds;
|
|
119
|
+
this._configuredReportings = configuredReportings;
|
|
120
|
+
this.meta = meta;
|
|
121
|
+
this.pendingRequests = new requestQueue_1.default(this);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get device of this endpoint
|
|
125
|
+
*/
|
|
126
|
+
getDevice() {
|
|
127
|
+
return device_1.default.byIeeeAddr(this.databaseID, this.deviceIeeeAddress);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @param {number|string} clusterKey
|
|
131
|
+
* @returns {boolean}
|
|
132
|
+
*/
|
|
133
|
+
supportsInputCluster(clusterKey) {
|
|
134
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
135
|
+
return this.inputClusters.includes(cluster.ID);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @param {number|string} clusterKey
|
|
139
|
+
* @returns {boolean}
|
|
140
|
+
*/
|
|
141
|
+
supportsOutputCluster(clusterKey) {
|
|
142
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
143
|
+
return this.outputClusters.includes(cluster.ID);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @returns {Zcl.TsType.Cluster[]}
|
|
147
|
+
*/
|
|
148
|
+
getInputClusters() {
|
|
149
|
+
return this.clusterNumbersToClusters(this.inputClusters);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @returns {Zcl.TsType.Cluster[]}
|
|
153
|
+
*/
|
|
154
|
+
getOutputClusters() {
|
|
155
|
+
return this.clusterNumbersToClusters(this.outputClusters);
|
|
156
|
+
}
|
|
157
|
+
clusterNumbersToClusters(clusterNumbers) {
|
|
158
|
+
return clusterNumbers.map((c) => Zcl.Utils.getCluster(c, this.getDevice().manufacturerID));
|
|
159
|
+
}
|
|
160
|
+
/*
|
|
161
|
+
* CRUD
|
|
162
|
+
*/
|
|
163
|
+
static fromDatabaseRecord(record, deviceNetworkAddress, deviceIeeeAddress, databaseID) {
|
|
164
|
+
// Migrate attrs to attributes
|
|
165
|
+
for (const entry of Object.values(record.clusters).filter((e) => e.hasOwnProperty("attrs"))) {
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
entry.attributes = entry.attrs;
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
delete entry.attrs;
|
|
172
|
+
}
|
|
173
|
+
return new Endpoint(databaseID, record.epId, record.profId, record.devId, record.inClusterList, record.outClusterList, deviceNetworkAddress, deviceIeeeAddress, record.clusters, record.binds || [], record.configuredReportings || [], record.meta || {});
|
|
174
|
+
}
|
|
175
|
+
toDatabaseRecord() {
|
|
176
|
+
return {
|
|
177
|
+
profId: this.profileID,
|
|
178
|
+
epId: this.ID,
|
|
179
|
+
devId: this.deviceID,
|
|
180
|
+
inClusterList: this.inputClusters,
|
|
181
|
+
outClusterList: this.outputClusters,
|
|
182
|
+
clusters: this.clusters,
|
|
183
|
+
binds: this._binds,
|
|
184
|
+
configuredReportings: this._configuredReportings,
|
|
185
|
+
meta: this.meta,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static create(databaseID, ID, profileID, deviceID, inputClusters, outputClusters, deviceNetworkAddress, deviceIeeeAddress) {
|
|
189
|
+
return new Endpoint(databaseID, ID, profileID, deviceID, inputClusters, outputClusters, deviceNetworkAddress, deviceIeeeAddress, {}, [], [], {});
|
|
190
|
+
}
|
|
191
|
+
saveClusterAttributeKeyValue(clusterKey, list) {
|
|
192
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
193
|
+
if (!this.clusters[cluster.name])
|
|
194
|
+
this.clusters[cluster.name] = { attributes: {} };
|
|
195
|
+
for (const [attribute, value] of Object.entries(list)) {
|
|
196
|
+
this.clusters[cluster.name].attributes[attribute] = value;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
getClusterAttributeValue(clusterKey, attributeKey) {
|
|
200
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
201
|
+
const attribute = cluster.getAttribute(attributeKey);
|
|
202
|
+
if (this.clusters[cluster.name] && this.clusters[cluster.name].attributes) {
|
|
203
|
+
return this.clusters[cluster.name].attributes[attribute.name];
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
hasPendingRequests() {
|
|
208
|
+
return this.pendingRequests.size > 0;
|
|
209
|
+
}
|
|
210
|
+
async sendPendingRequests(fastPolling) {
|
|
211
|
+
return this.pendingRequests.send(fastPolling);
|
|
212
|
+
}
|
|
213
|
+
async sendRequest(frame, options, func = (d) => {
|
|
214
|
+
return entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToEndpoint(this.deviceIeeeAddress, this.deviceNetworkAddress, this.ID, d, options.timeout, options.disableResponse, options.disableRecovery, options.srcEndpoint);
|
|
215
|
+
}) {
|
|
216
|
+
const logPrefix = `Request Queue (${this.deviceIeeeAddress}/${this.ID}): `;
|
|
217
|
+
const request = new request_1.default(func, frame, this.getDevice().pendingRequestTimeout, options.sendPolicy);
|
|
218
|
+
if (request.sendPolicy !== 'bulk') {
|
|
219
|
+
// Check if such a request is already in the queue and remove the old one(s) if necessary
|
|
220
|
+
this.pendingRequests.filter(request);
|
|
221
|
+
}
|
|
222
|
+
// send without queueing if sendPolicy is 'immediate' or if the device has no timeout set
|
|
223
|
+
if (request.sendPolicy === 'immediate'
|
|
224
|
+
|| !this.getDevice().pendingRequestTimeout) {
|
|
225
|
+
if (this.getDevice().pendingRequestTimeout > 0) {
|
|
226
|
+
debug.info(logPrefix + `send ${frame.getCommand().name} request immediately ` +
|
|
227
|
+
`(sendPolicy=${options.sendPolicy})`);
|
|
228
|
+
}
|
|
229
|
+
return request.send();
|
|
230
|
+
}
|
|
231
|
+
// If this is a bulk message, we queue directly.
|
|
232
|
+
if (request.sendPolicy === 'bulk') {
|
|
233
|
+
debug.info(logPrefix + `queue request (${this.pendingRequests.size})))`);
|
|
234
|
+
return this.pendingRequests.queue(request);
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
debug.info(logPrefix + `send request`);
|
|
238
|
+
return await request.send();
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
// If we got a failed transaction, the device is likely sleeping.
|
|
242
|
+
// Queue for transmission later.
|
|
243
|
+
debug.info(logPrefix + `queue request (transaction failed)`);
|
|
244
|
+
return this.pendingRequests.queue(request);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/*
|
|
248
|
+
* Zigbee functions
|
|
249
|
+
*/
|
|
250
|
+
checkStatus(payload) {
|
|
251
|
+
const codes = Array.isArray(payload)
|
|
252
|
+
? payload.map((i) => i.status)
|
|
253
|
+
: [payload.statusCode];
|
|
254
|
+
const invalid = codes.find((c) => c !== Zcl.Status.SUCCESS);
|
|
255
|
+
if (invalid)
|
|
256
|
+
throw new Zcl.ZclStatusError(invalid);
|
|
257
|
+
}
|
|
258
|
+
async report(clusterKey, attributes, options) {
|
|
259
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
260
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
261
|
+
const payload = [];
|
|
262
|
+
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
263
|
+
if (cluster.hasAttribute(nameOrID)) {
|
|
264
|
+
const attribute = cluster.getAttribute(nameOrID);
|
|
265
|
+
payload.push({
|
|
266
|
+
attrId: attribute.ID,
|
|
267
|
+
attrData: value,
|
|
268
|
+
dataType: attribute.type,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
else if (!isNaN(Number(nameOrID))) {
|
|
272
|
+
payload.push({
|
|
273
|
+
attrId: Number(nameOrID),
|
|
274
|
+
attrData: value.value,
|
|
275
|
+
dataType: value.type,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const log = `Report to ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
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
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async write(clusterKey, attributes, options) {
|
|
297
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
298
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
299
|
+
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, Object.keys(attributes), options.manufacturerCode, 'write');
|
|
300
|
+
const payload = [];
|
|
301
|
+
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
302
|
+
if (cluster.hasAttribute(nameOrID)) {
|
|
303
|
+
const attribute = cluster.getAttribute(nameOrID);
|
|
304
|
+
payload.push({ attrId: attribute.ID, attrData: value, dataType: attribute.type });
|
|
305
|
+
}
|
|
306
|
+
else if (!isNaN(Number(nameOrID))) {
|
|
307
|
+
payload.push({ attrId: Number(nameOrID), attrData: value.value, dataType: value.type });
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const log = `Write ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
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
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async writeResponse(clusterKey, transactionSequenceNumber, attributes, options) {
|
|
331
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter');
|
|
332
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
333
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
334
|
+
const payload = [];
|
|
335
|
+
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
336
|
+
if (value.hasOwnProperty('status')) {
|
|
337
|
+
if (cluster.hasAttribute(nameOrID)) {
|
|
338
|
+
const attribute = cluster.getAttribute(nameOrID);
|
|
339
|
+
payload.push({ attrId: attribute.ID, status: value.status });
|
|
340
|
+
}
|
|
341
|
+
else if (!isNaN(Number(nameOrID))) {
|
|
342
|
+
payload.push({ attrId: Number(nameOrID), status: value.status });
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
throw new Error(`Missing attribute 'status'`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, transactionSequenceNumber, "writeRsp", cluster.ID, payload, options.reservedBits);
|
|
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
|
+
}
|
|
364
|
+
}
|
|
365
|
+
async read(clusterKey, attributes, options) {
|
|
366
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
367
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
368
|
+
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, attributes, options.manufacturerCode, 'read');
|
|
369
|
+
const payload = [];
|
|
370
|
+
for (const attribute of attributes) {
|
|
371
|
+
payload.push({ attrId: typeof attribute === 'number' ? attribute : cluster.getAttribute(attribute).ID });
|
|
372
|
+
}
|
|
373
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), "read", cluster.ID, payload, options.reservedBits);
|
|
374
|
+
const log = `Read ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
375
|
+
`${cluster.name}(${JSON.stringify(attributes)}, ${JSON.stringify(options)})`;
|
|
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;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
async readResponse(clusterKey, transactionSequenceNumber, attributes, options) {
|
|
394
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty("transactionSequenceNumber"), "Use parameter");
|
|
395
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
396
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
397
|
+
const payload = [];
|
|
398
|
+
for (const [nameOrID, value] of Object.entries(attributes)) {
|
|
399
|
+
if (cluster.hasAttribute(nameOrID)) {
|
|
400
|
+
const attribute = cluster.getAttribute(nameOrID);
|
|
401
|
+
payload.push({
|
|
402
|
+
attrId: attribute.ID,
|
|
403
|
+
attrData: value,
|
|
404
|
+
dataType: attribute.type,
|
|
405
|
+
status: 0,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
else if (!isNaN(Number(nameOrID))) {
|
|
409
|
+
payload.push({
|
|
410
|
+
attrId: Number(nameOrID),
|
|
411
|
+
attrData: value.value,
|
|
412
|
+
dataType: value.type,
|
|
413
|
+
status: 0,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, transactionSequenceNumber, "readRsp", cluster.ID, payload, options.reservedBits);
|
|
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
|
+
}
|
|
432
|
+
}
|
|
433
|
+
addBinding(clusterKey, target) {
|
|
434
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
435
|
+
if (typeof target === "number") {
|
|
436
|
+
target =
|
|
437
|
+
group_1.default.byGroupID(target, this.databaseID) ||
|
|
438
|
+
group_1.default.create(target, this.databaseID);
|
|
439
|
+
}
|
|
440
|
+
if (!this.binds.find((b) => b.cluster.ID === cluster.ID && b.target === target)) {
|
|
441
|
+
if (target instanceof group_1.default) {
|
|
442
|
+
this._binds.push({
|
|
443
|
+
cluster: cluster.ID,
|
|
444
|
+
groupID: target.groupID,
|
|
445
|
+
type: "group",
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
this._binds.push({
|
|
450
|
+
cluster: cluster.ID,
|
|
451
|
+
type: "endpoint",
|
|
452
|
+
deviceIeeeAddress: target.deviceIeeeAddress,
|
|
453
|
+
endpointID: target.ID,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
this.save();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
async bind(clusterKey, target) {
|
|
460
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
461
|
+
const type = target instanceof Endpoint ? "endpoint" : "group";
|
|
462
|
+
if (typeof target === "number") {
|
|
463
|
+
target =
|
|
464
|
+
group_1.default.byGroupID(target, this.databaseID) ||
|
|
465
|
+
group_1.default.create(target, this.databaseID);
|
|
466
|
+
}
|
|
467
|
+
const destinationAddress = target instanceof Endpoint ? target.deviceIeeeAddress : target.groupID;
|
|
468
|
+
const log = `Bind ${this.deviceIeeeAddress}/${this.ID} ${cluster.name} from ` +
|
|
469
|
+
`'${target instanceof Endpoint
|
|
470
|
+
? `${destinationAddress}/${target.ID}`
|
|
471
|
+
: destinationAddress}'`;
|
|
472
|
+
debug.info(log);
|
|
473
|
+
try {
|
|
474
|
+
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
|
+
this.addBinding(clusterKey, target);
|
|
476
|
+
}
|
|
477
|
+
catch (error) {
|
|
478
|
+
error.message = `${log} failed (${error.message})`;
|
|
479
|
+
debug.error(error.message);
|
|
480
|
+
throw error;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
save() {
|
|
484
|
+
this.getDevice().save();
|
|
485
|
+
}
|
|
486
|
+
async unbind(clusterKey, target) {
|
|
487
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
488
|
+
const type = target instanceof Endpoint ? "endpoint" : "group";
|
|
489
|
+
const destinationAddress = target instanceof Endpoint
|
|
490
|
+
? target.deviceIeeeAddress
|
|
491
|
+
: target instanceof group_1.default
|
|
492
|
+
? target.groupID
|
|
493
|
+
: target;
|
|
494
|
+
const log = `Unbind ${this.deviceIeeeAddress}/${this.ID} ${cluster.name} from ` +
|
|
495
|
+
`'${target instanceof Endpoint
|
|
496
|
+
? `${destinationAddress}/${target.ID}`
|
|
497
|
+
: destinationAddress}'`;
|
|
498
|
+
debug.info(log);
|
|
499
|
+
try {
|
|
500
|
+
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
|
+
if (typeof target === "number" &&
|
|
502
|
+
group_1.default.byGroupID(target, this.databaseID)) {
|
|
503
|
+
target = group_1.default.byGroupID(target, this.databaseID);
|
|
504
|
+
}
|
|
505
|
+
const index = this.binds.findIndex((b) => b.cluster.ID === cluster.ID && b.target === target);
|
|
506
|
+
if (index !== -1) {
|
|
507
|
+
this._binds.splice(index, 1);
|
|
508
|
+
this.save();
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
error.message = `${log} failed (${error.message})`;
|
|
513
|
+
debug.error(error.message);
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
async defaultResponse(commandID, status, clusterID, transactionSequenceNumber, options) {
|
|
518
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty("transactionSequenceNumber"), "Use parameter");
|
|
519
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, null);
|
|
520
|
+
const payload = { cmdId: commandID, statusCode: status };
|
|
521
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, transactionSequenceNumber, "defaultRsp", clusterID, payload, options.reservedBits);
|
|
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
|
+
}
|
|
533
|
+
}
|
|
534
|
+
async configureReporting(clusterKey, items, options) {
|
|
535
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
536
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
537
|
+
options.manufacturerCode = this.ensureManufacturerCodeIsUniqueAndGet(cluster, items, options.manufacturerCode, 'configureReporting');
|
|
538
|
+
const payload = items.map((item) => {
|
|
539
|
+
let dataType, attrId;
|
|
540
|
+
if (typeof item.attribute === "object") {
|
|
541
|
+
dataType = item.attribute.type;
|
|
542
|
+
attrId = item.attribute.ID;
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
/* istanbul ignore else */
|
|
546
|
+
if (cluster.hasAttribute(item.attribute)) {
|
|
547
|
+
const attribute = cluster.getAttribute(item.attribute);
|
|
548
|
+
dataType = attribute.type;
|
|
549
|
+
attrId = attribute.ID;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
direction: Zcl.Direction.CLIENT_TO_SERVER,
|
|
554
|
+
attrId,
|
|
555
|
+
dataType,
|
|
556
|
+
minRepIntval: item.minimumReportInterval,
|
|
557
|
+
maxRepIntval: item.maximumReportInterval,
|
|
558
|
+
repChange: item.reportableChange,
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, options.manufacturerCode, options.transactionSequenceNumber ?? zclTransactionSequenceNumber_1.default.next(), "configReport", cluster.ID, payload, options.reservedBits);
|
|
562
|
+
const log = `ConfigureReporting ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
563
|
+
`${cluster.name}(${JSON.stringify(items)}, ${JSON.stringify(options)})`;
|
|
564
|
+
debug.info(log);
|
|
565
|
+
try {
|
|
566
|
+
const result = await this.sendRequest(frame, options);
|
|
567
|
+
if (!options.disableResponse) {
|
|
568
|
+
this.checkStatus(result.frame.Payload);
|
|
569
|
+
}
|
|
570
|
+
for (const e of payload) {
|
|
571
|
+
this._configuredReportings = this._configuredReportings.filter((c) => !(c.attrId === e.attrId && c.cluster === cluster.ID &&
|
|
572
|
+
(!('manufacturerCode' in c) || c.manufacturerCode === options.manufacturerCode)));
|
|
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
|
+
}
|
|
585
|
+
}
|
|
586
|
+
this.save();
|
|
587
|
+
}
|
|
588
|
+
catch (error) {
|
|
589
|
+
error.message = `${log} failed (${error.message})`;
|
|
590
|
+
debug.error(error.message);
|
|
591
|
+
throw error;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
async writeStructured(clusterKey, payload, options) {
|
|
595
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
596
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.CLIENT_TO_SERVER, cluster.manufacturerCode);
|
|
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
|
+
}
|
|
610
|
+
}
|
|
611
|
+
async command(clusterKey, commandKey, payload, options) {
|
|
612
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
613
|
+
const command = cluster.getCommand(commandKey);
|
|
614
|
+
const hasResponse = command.hasOwnProperty("response");
|
|
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;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
async commandResponse(clusterKey, commandKey, payload, options, transactionSequenceNumber) {
|
|
633
|
+
(0, assert_1.default)(!options || !options.hasOwnProperty("transactionSequenceNumber"), "Use parameter");
|
|
634
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
635
|
+
const command = cluster.getCommandResponse(commandKey);
|
|
636
|
+
transactionSequenceNumber =
|
|
637
|
+
transactionSequenceNumber || zclTransactionSequenceNumber_1.default.next();
|
|
638
|
+
options = this.getOptionsWithDefaults(options, true, Zcl.Direction.SERVER_TO_CLIENT, cluster.manufacturerCode);
|
|
639
|
+
const frame = Zcl.ZclFrame.create(Zcl.FrameType.SPECIFIC, options.direction, options.disableDefaultResponse, options.manufacturerCode, transactionSequenceNumber, command.name, cluster.name, payload, options.reservedBits);
|
|
640
|
+
const log = `CommandResponse ${this.deviceIeeeAddress}/${this.ID} ` +
|
|
641
|
+
`${cluster.name}.${command.name}(${JSON.stringify(payload)}, ${JSON.stringify(options)})`;
|
|
642
|
+
debug.info(log);
|
|
643
|
+
try {
|
|
644
|
+
await this.sendRequest(frame, options, async (f) => {
|
|
645
|
+
// Broadcast Green Power responses
|
|
646
|
+
if (this.ID === 242) {
|
|
647
|
+
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToAll(242, f, 242);
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
await entity_1.default.getAdapterByID(this.databaseID).sendZclFrameToEndpoint(this.deviceIeeeAddress, this.deviceNetworkAddress, this.ID, f, options.timeout, options.disableResponse, options.disableRecovery, options.srcEndpoint);
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
error.message = `${log} failed (${error.message})`;
|
|
656
|
+
debug.error(error.message);
|
|
657
|
+
throw error;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
waitForCommand(clusterKey, commandKey, transactionSequenceNumber, timeout) {
|
|
661
|
+
const cluster = Zcl.Utils.getCluster(clusterKey);
|
|
662
|
+
const command = cluster.getCommand(commandKey);
|
|
663
|
+
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
|
+
const promise = new Promise((resolve, reject) => {
|
|
665
|
+
waiter.promise.then((payload) => resolve({
|
|
666
|
+
header: payload.frame.Header,
|
|
667
|
+
payload: payload.frame.Payload,
|
|
668
|
+
}), (error) => reject(error));
|
|
669
|
+
});
|
|
670
|
+
return { promise, cancel: waiter.cancel };
|
|
671
|
+
}
|
|
672
|
+
getOptionsWithDefaults(options, disableDefaultResponse, direction, manufacturerCode) {
|
|
673
|
+
const providedOptions = options || {};
|
|
674
|
+
return {
|
|
675
|
+
timeout: 10000,
|
|
676
|
+
disableResponse: false,
|
|
677
|
+
disableRecovery: false,
|
|
678
|
+
disableDefaultResponse,
|
|
679
|
+
direction,
|
|
680
|
+
srcEndpoint: null,
|
|
681
|
+
reservedBits: 0,
|
|
682
|
+
manufacturerCode: manufacturerCode ? manufacturerCode : null,
|
|
683
|
+
transactionSequenceNumber: null,
|
|
684
|
+
writeUndiv: false,
|
|
685
|
+
...providedOptions
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
ensureManufacturerCodeIsUniqueAndGet(cluster, attributes, fallbackManufacturerCode, caller) {
|
|
689
|
+
const manufacturerCodes = new Set(attributes.map((nameOrID) => {
|
|
690
|
+
let attributeID;
|
|
691
|
+
if (typeof nameOrID == 'object') {
|
|
692
|
+
// ConfigureReportingItem
|
|
693
|
+
if (typeof nameOrID.attribute !== 'object') {
|
|
694
|
+
attributeID = nameOrID.attribute;
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
return fallbackManufacturerCode;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
// string || number
|
|
702
|
+
attributeID = nameOrID;
|
|
703
|
+
}
|
|
704
|
+
// we fall back to caller|cluster provided manufacturerCode
|
|
705
|
+
if (cluster.hasAttribute(attributeID)) {
|
|
706
|
+
const attribute = cluster.getAttribute(attributeID);
|
|
707
|
+
return (attribute.manufacturerCode === undefined) ?
|
|
708
|
+
fallbackManufacturerCode :
|
|
709
|
+
attribute.manufacturerCode;
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
// unknown attribute, we should not fail on this here
|
|
713
|
+
return fallbackManufacturerCode;
|
|
714
|
+
}
|
|
715
|
+
}));
|
|
716
|
+
if (manufacturerCodes.size == 1) {
|
|
717
|
+
return manufacturerCodes.values().next().value;
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
throw new Error(`Cannot have attributes with different manufacturerCode in single '${caller}' call`);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
async addToGroup(group) {
|
|
724
|
+
await this.command("genGroups", "add", {
|
|
725
|
+
groupid: group.groupID,
|
|
726
|
+
groupname: "",
|
|
727
|
+
});
|
|
728
|
+
group.addMember(this);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Remove endpoint from a group, accepts both a Group and number as parameter.
|
|
732
|
+
* The number parameter type should only be used when removing from a group which is not known
|
|
733
|
+
* to zigbee-herdsman.
|
|
734
|
+
*/
|
|
735
|
+
async removeFromGroup(group) {
|
|
736
|
+
await this.command("genGroups", "remove", {
|
|
737
|
+
groupid: group instanceof group_1.default ? group.groupID : group,
|
|
738
|
+
});
|
|
739
|
+
if (group instanceof group_1.default) {
|
|
740
|
+
group.removeMember(this);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
async removeFromAllGroups() {
|
|
744
|
+
await this.command("genGroups", "removeAll", {}, { disableDefaultResponse: true });
|
|
745
|
+
this.removeFromAllGroupsDatabase();
|
|
746
|
+
}
|
|
747
|
+
removeFromAllGroupsDatabase() {
|
|
748
|
+
for (const group of group_1.default.allByDatabaseID(this.databaseID)) {
|
|
749
|
+
if (group.hasMember(this)) {
|
|
750
|
+
group.removeMember(this);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
exports.default = Endpoint;
|
|
822
756
|
//# sourceMappingURL=endpoint.js.map
|