mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Fix transition from device_options not applied. #3922
This commit is contained in:
+12
-1
@@ -618,7 +618,7 @@ describe('Publish', () => {
|
||||
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({state: 'ON', brightness: 100});
|
||||
});
|
||||
|
||||
it('Should use transition when brightness', async () => {
|
||||
it('Should use transition on brightness command', async () => {
|
||||
const device = zigbeeHerdsman.devices.bulb_color;
|
||||
settings.set(['devices', device.ieeeAddr, 'transition'], 20);
|
||||
const endpoint = device.getEndpoint(1);
|
||||
@@ -629,6 +629,17 @@ describe('Publish', () => {
|
||||
expect(endpoint.command.mock.calls[0]).toEqual(["genLevelCtrl", "moveToLevelWithOnOff", {level: 20, transtime: 200}, {}]);
|
||||
});
|
||||
|
||||
it('Should use transition from device_options on brightness command', async () => {
|
||||
const device = zigbeeHerdsman.devices.bulb_color;
|
||||
settings.set(['device_options'], {transition: 20});
|
||||
const endpoint = device.getEndpoint(1);
|
||||
const payload = {brightness: 20};
|
||||
await MQTT.events.message('zigbee2mqtt/bulb_color/set', JSON.stringify(payload));
|
||||
await flushPromises();
|
||||
expect(endpoint.command).toHaveBeenCalledTimes(1);
|
||||
expect(endpoint.command.mock.calls[0]).toEqual(["genLevelCtrl", "moveToLevelWithOnOff", {level: 20, transtime: 200}, {}]);
|
||||
});
|
||||
|
||||
it('Transition parameter should not influence brightness on state ON', async () => {
|
||||
// https://github.com/Koenkk/zigbee2mqtt/issues/3563
|
||||
const device = zigbeeHerdsman.devices.bulb_color;
|
||||
|
||||
Reference in New Issue
Block a user