mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-15 18:08:32 -07:00
Default transition for groups. https://github.com/Koenkk/zigbee2mqtt/issues/1948
This commit is contained in:
parent
411f1fab73
commit
cfae1bf3b0
@ -87,6 +87,7 @@ class EntityPublish {
|
||||
} else {
|
||||
converters = groupConverters;
|
||||
target = entity.group;
|
||||
options = entity.settings;
|
||||
}
|
||||
|
||||
// Convert the MQTT message to a Zigbee message.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user