iobroker.zigbee 3.2.5 → 3.3.1-alpha.0
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/README.md +16 -0
- package/admin/admin.js +376 -267
- package/admin/index_m.html +21 -32
- package/admin/tab_m.html +14 -2
- package/io-package.json +31 -31
- package/lib/commands.js +120 -76
- package/lib/exclude.js +1 -1
- package/lib/exposes.js +187 -77
- package/lib/groups.js +28 -15
- package/lib/{devices.js → legacy/devices.js} +27 -3
- package/lib/{states.js → legacy/states.js} +3 -3
- package/lib/localConfig.js +42 -0
- package/lib/models.js +615 -0
- package/lib/networkmap.js +15 -5
- package/lib/statescontroller.js +312 -297
- package/lib/utils.js +3 -4
- package/lib/zbBaseExtension.js +4 -0
- package/lib/zbDeviceAvailability.js +16 -23
- package/lib/zbDeviceConfigure.js +21 -8
- package/lib/zigbeecontroller.js +134 -88
- package/main.js +38 -42
- package/package.json +14 -15
package/main.js
CHANGED
|
@@ -206,8 +206,6 @@ class Zigbee extends utils.Adapter {
|
|
|
206
206
|
}
|
|
207
207
|
// external converters
|
|
208
208
|
this.applyExternalConverters();
|
|
209
|
-
// get devices from exposes
|
|
210
|
-
this.stController.getExposes();
|
|
211
209
|
|
|
212
210
|
this.subscribeStates('*');
|
|
213
211
|
this.subscribeForeignStates(`system.adapter.${this.namespace}.logLevel`)
|
|
@@ -629,48 +627,46 @@ class Zigbee extends utils.Adapter {
|
|
|
629
627
|
}
|
|
630
628
|
|
|
631
629
|
await this.setState('info.connection', true, true);
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
const devicesFromDB = this.zbController.getClientIterator(false);
|
|
635
|
-
for (const device of devicesFromDB) {
|
|
636
|
-
const entity = await this.zbController.resolveEntity(device);
|
|
637
|
-
if (entity) {
|
|
638
|
-
const model = entity.mapped ? entity.mapped.model : entity.device.modelID;
|
|
639
|
-
const idx = devicesFromObjects.indexOf(device.ieeeAddr);
|
|
640
|
-
if (idx > -1) devicesFromObjects.splice(idx, 1);
|
|
641
|
-
this.stController.updateDev(zbIdorIeeetoAdId(this.adapter, device.ieeeAddr, false), model, model, () =>
|
|
642
|
-
this.stController.syncDevStates(device, model));
|
|
643
|
-
}
|
|
644
|
-
else (this.log.warn('resolveEntity returned no entity'));
|
|
645
|
-
}
|
|
646
|
-
for (const id of devicesFromObjects) {
|
|
630
|
+
|
|
631
|
+
for (const id of await this.syncAllDeviceStates(false)) {
|
|
647
632
|
try {
|
|
648
|
-
this.log.
|
|
633
|
+
this.log.info(`removing object for device ${id} - it is no longer in the zigbee database`);
|
|
649
634
|
await this.delObjectAsync(id.substring(2), { recursive:true })
|
|
650
635
|
}
|
|
651
636
|
catch {
|
|
652
637
|
this.log.warn(`error removing ${id}`)
|
|
653
638
|
}
|
|
654
639
|
}
|
|
640
|
+
|
|
655
641
|
await this.callPluginMethod('start', [this.zbController, this.stController]);
|
|
656
642
|
}
|
|
657
643
|
|
|
644
|
+
async syncAllDeviceStates(resetRoles) {
|
|
645
|
+
this.stController.CleanupRequired(false);
|
|
646
|
+
if (resetRoles) this.stController.clearModelDefinitions();
|
|
647
|
+
const devicesFromObjects = (await this.getDevicesAsync()).filter(item => item.native.id.length ==16).map((item) => `0x${item.native.id}`);
|
|
648
|
+
const devicesFromDB = this.zbController.getClientIterator(false);
|
|
649
|
+
for (const device of devicesFromDB) {
|
|
650
|
+
if (resetRoles) {
|
|
651
|
+
const hM = await zigbeeHerdsmanConverters.findByDevice(device);
|
|
652
|
+
await this.stController.AddModelFromHerdsman(device, hM ? hM.model : device.modelID);
|
|
653
|
+
}
|
|
654
|
+
// remove from the Adapter device list
|
|
655
|
+
const idx = devicesFromObjects.indexOf(device.ieeeAddr);
|
|
656
|
+
if (idx > -1) devicesFromObjects.splice(idx, 1);
|
|
658
657
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
// await this.stController.deleteObj(devId);
|
|
668
|
-
await this.stController.updateDev(devId, model, model);
|
|
669
|
-
await this.stController.syncDevStates(device, model);
|
|
670
|
-
await this.stController.deleteOrphanedDeviceStates();
|
|
658
|
+
// if it has a mapped model - update its states
|
|
659
|
+
const entity = await this.zbController.resolveEntity(device);
|
|
660
|
+
if (entity) {
|
|
661
|
+
const model = entity.mapped ? entity.mapped.model : entity.device.modelID;
|
|
662
|
+
this.stController.updateDev(zbIdorIeeetoAdId(this, device.ieeeAddr, false), model, model, () =>
|
|
663
|
+
this.stController.syncDevStates(device, model, resetRoles));
|
|
664
|
+
}
|
|
665
|
+
else (this.log.debug('resolveEntity returned no entity'));
|
|
671
666
|
}
|
|
667
|
+
// return the devices in the adapter namespace which do not link to an active zigbee device.
|
|
668
|
+
return devicesFromObjects;
|
|
672
669
|
}
|
|
673
|
-
*/
|
|
674
670
|
|
|
675
671
|
acknowledgeState(deviceId, model, stateDesc, value) {
|
|
676
672
|
const stateId = `${zbIdorIeeetoAdId(this, deviceId, true)}.${stateDesc.id}`;
|
|
@@ -698,24 +694,24 @@ class Zigbee extends utils.Adapter {
|
|
|
698
694
|
|
|
699
695
|
if (this.debugActive) this.log.debug(`New device event: ${safeJsonStringify(entity)}`);
|
|
700
696
|
|
|
701
|
-
const
|
|
702
|
-
const model = (entity.mapped) ? entity.mapped.model :
|
|
697
|
+
const device = entity.device;
|
|
698
|
+
const model = (entity.mapped) ? entity.mapped.model : device.modelID;
|
|
703
699
|
this.log.debug(`New device event: ${safeJsonStringify(entity)}`);
|
|
704
700
|
if (!entity.mapped && !entity.device.interviewing) {
|
|
705
|
-
const msg = `New device: '${
|
|
701
|
+
const msg = `New device: '${device.ieeeAddr}' does not have a known model. please provide an external converter for '${device.modelID}'.`;
|
|
706
702
|
this.log.warn(msg);
|
|
707
703
|
this.logToPairing(msg, true);
|
|
708
704
|
}
|
|
709
705
|
await this.stController.AddModelFromHerdsman(entity.device, model)
|
|
710
|
-
if (
|
|
711
|
-
this.getObject(zbIdorIeeetoAdId(this
|
|
706
|
+
if (device) {
|
|
707
|
+
this.getObject(zbIdorIeeetoAdId(this, device.ieeeAddr, false), (err, obj) => {
|
|
712
708
|
if (!obj) {
|
|
713
709
|
const model = (entity.mapped) ? entity.mapped.model : entity.device.modelID;
|
|
714
|
-
if (this.debugActive) this.log.debug(`new device ${
|
|
710
|
+
if (this.debugActive) this.log.debug(`new device ${device.ieeeAddr} ${device.networkAddress} ${model} `);
|
|
715
711
|
|
|
716
|
-
this.logToPairing(`New device joined '${
|
|
717
|
-
this.stController.updateDev(zbIdorIeeetoAdId(this
|
|
718
|
-
this.stController.syncDevStates(
|
|
712
|
+
this.logToPairing(`New device joined '${device.ieeeAddr}' model ${model}`, true);
|
|
713
|
+
this.stController.updateDev(zbIdorIeeetoAdId(this, device.ieeeAddr, false), model, model, () =>
|
|
714
|
+
this.stController.syncDevStates(device, model, false));
|
|
719
715
|
}
|
|
720
716
|
else if (this.debugActive) this.log.debug(`Device ${safeJsonStringify(entity)} rejoined, no new device`);
|
|
721
717
|
});
|
|
@@ -725,7 +721,7 @@ class Zigbee extends utils.Adapter {
|
|
|
725
721
|
leaveDevice(ieeeAddr) {
|
|
726
722
|
if (this.debugActive) this.log.debug(`Leave device event: ${ieeeAddr}`);
|
|
727
723
|
if (ieeeAddr) {
|
|
728
|
-
const devId = zbIdorIeeetoAdId(this
|
|
724
|
+
const devId = zbIdorIeeetoAdId(this, ieeeAddr, false);
|
|
729
725
|
if (this.debugActive) this.log.debug(`Delete device ${devId} from iobroker.`);
|
|
730
726
|
this.stController.deleteObj(devId);
|
|
731
727
|
}
|
|
@@ -845,7 +841,7 @@ class Zigbee extends utils.Adapter {
|
|
|
845
841
|
this.setState('info.pairingMode', false, true);
|
|
846
842
|
}
|
|
847
843
|
if (data) {
|
|
848
|
-
this.logToPairing(`${message}: ${data.toString()}`);
|
|
844
|
+
this.logToPairing(`${message}: ${typeof data === 'string' ? data: data.toString()}`);
|
|
849
845
|
} else {
|
|
850
846
|
this.logToPairing(`${message}`);
|
|
851
847
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.zigbee",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1-alpha.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kirov Ilya",
|
|
6
6
|
"email": "kirovilya@gmail.com"
|
|
@@ -22,28 +22,27 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@iobroker/adapter-core": "^3.3.2",
|
|
25
|
-
"@iobroker/dm-utils": "^1.0.
|
|
26
|
-
"humanize-duration": "^3.33.
|
|
27
|
-
"tar": "^7.
|
|
25
|
+
"@iobroker/dm-utils": "^1.0.13",
|
|
26
|
+
"humanize-duration": "^3.33.1",
|
|
27
|
+
"tar": "^7.5.2",
|
|
28
28
|
"ajv": "^8.17.1",
|
|
29
29
|
"uri-js": "^4.4.1",
|
|
30
|
-
"typescript": "^5.9.
|
|
31
|
-
"zigbee-herdsman": "^
|
|
32
|
-
"zigbee-herdsman-converters": "
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"zigbee-herdsman": "^7.0.0",
|
|
32
|
+
"zigbee-herdsman-converters": "25.84.0"
|
|
33
33
|
},
|
|
34
34
|
"description": "Zigbee devices",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@alcalzone/release-script": "^
|
|
37
|
-
"@alcalzone/release-script-plugin-iobroker": "^
|
|
38
|
-
"@alcalzone/release-script-plugin-license": "^
|
|
39
|
-
"@alcalzone/release-script-plugin-manual-review": "^
|
|
40
|
-
"@iobroker/testing": "^5.
|
|
41
|
-
"
|
|
42
|
-
"eslint": "^9.36.0",
|
|
36
|
+
"@alcalzone/release-script": "^5.0.0",
|
|
37
|
+
"@alcalzone/release-script-plugin-iobroker": "^4.0.0",
|
|
38
|
+
"@alcalzone/release-script-plugin-license": "^4.0.0",
|
|
39
|
+
"@alcalzone/release-script-plugin-manual-review": "^4.0.0",
|
|
40
|
+
"@iobroker/testing": "^5.2.2",
|
|
41
|
+
"eslint": "^9.39.1",
|
|
43
42
|
"eslint-config-prettier": "^9.1.0",
|
|
44
43
|
"eslint-plugin-prettier": "^5.5.4",
|
|
45
44
|
"mixin-deep": "^2.0.1",
|
|
46
|
-
"@iobroker/dev-server": "^0.
|
|
45
|
+
"@iobroker/dev-server": "^0.8.0"
|
|
47
46
|
},
|
|
48
47
|
"homepage": "https://github.com/ioBroker/ioBroker.zigbee",
|
|
49
48
|
"keywords": [
|