Skip configure when device does not require it. https://github.com/Koenkk/zigbee2mqtt/issues/2588

This commit is contained in:
Koen Kanters
2019-12-23 20:48:37 +01:00
parent 9db1467ed8
commit e63d196966
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -48,6 +48,11 @@ class DeviceConfigure extends BaseExtension {
}
const mappedDevice = zigbeeHerdsmanConverters.findByZigbeeModel(entity.device.modelID);
if (!mappedDevice.configure) {
logger.warn(`Skipping configure of '${entity.name}', device does not require this.`);
return;
}
this.configure(entity.device, mappedDevice, entity.settings, true);
}
+6
View File
@@ -105,6 +105,12 @@ describe('Device configure', () => {
expect(logger.error).toHaveBeenCalledWith(`Device 'remote_random_non_existing' does not exist`);
});
it('Should skip reconfigure when device does not require this', async () => {
await MQTT.events.message('zigbee2mqtt/bridge/configure', 'bulb');
await flushPromises();
expect(logger.warn).toHaveBeenCalledWith(`Skipping configure of 'bulb', device does not require this.`)
});
it('Should not configure when interviewing', async () => {
const device = zigbeeHerdsman.devices.remote;
delete device.meta.configured;