Group device staying off when already off (#2140)

* Fix devices within a group staying off if they are off when the group state changes

* Group test cleanups
This commit is contained in:
Gabe Cook
2019-10-15 16:42:28 +02:00
committed by Koen Kanters
parent 0527b89b49
commit 9ebb1b96dd
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ class Groups extends BaseExtension {
const payload = {};
properties.forEach((prop) => {
if (data.to.hasOwnProperty(prop) && (!data.from || data.from[prop] != data.to[prop])) {
if (data.to.hasOwnProperty(prop)) {
payload[prop] = data.to[prop];
}
});
+2 -2
View File
@@ -389,8 +389,8 @@ describe('Groups', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(3);
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/bulb_color", '{"state":"OFF"}', {"retain": false, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/bulb", '{"state":"OFF\","brightness":50,"color_temp":370,"linkquality":99}', {"retain": true, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/group_1", '{"state":"OFF"}', {"retain": false, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/bulb", '{"state":"OFF","brightness":50,"color_temp":370,"linkquality":99}', {"retain": true, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith("zigbee2mqtt/group_1", '{"state":"OFF","brightness":50,"color_temp":370}', {"retain": false, qos: 0}, expect.any(Function));
});
it('Should publish state change off even when missing current state', async () => {