This commit is contained in:
Koen Kanters 2019-09-10 19:42:04 +02:00
parent 411f1fab73
commit cfae1bf3b0
2 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,7 @@ class EntityPublish {
} else {
converters = groupConverters;
target = entity.group;
options = entity.settings;
}
// Convert the MQTT message to a Zigbee message.

View File

@ -556,6 +556,18 @@ describe('Entity publish', () => {
expect(endpoint.read.mock.calls[1]).toEqual(["lightingColorCtrl", ["currentX", "currentY", "colorTemperature"]]);
});
it('Should use transition when brightness with group', async () => {
const group = zigbeeHerdsman.groups.group_1;
settings.set(['groups', '1', 'transition'], 20);
await MQTT.events.message('zigbee2mqtt/group_1/set', JSON.stringify({brightness: 100}));
await flushPromises();
expect(group.command).toHaveBeenCalledTimes(1);
expect(group.command).toHaveBeenCalledWith("genLevelCtrl", "moveToLevelWithOnOff", {level: 100, transtime: 200}, {});
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/group_1');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({state: 'ON', brightness: 100});
});
it('Should use transition when brightness', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
settings.set(['devices', device.ieeeAddr, 'transition'], 20);