Changes for zigbee-herdsman-converters 12.0.150

This commit is contained in:
Koen Kanters
2020-07-26 14:19:33 +02:00
parent 812c4927e7
commit 7d27e6db69
4 changed files with 88 additions and 52 deletions
+29 -26
View File
@@ -758,15 +758,16 @@ const thermostatHeatCool = /* istanbul ignore next */ (minTemp=7, maxTemp=30, te
// Map Home Assistant configurations to devices.
const mapping = {
'WXKG01LM': [cfg.sensor_click, cfg.sensor_battery],
'WXKG11LM': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action],
'WXKG12LM': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action],
// DEPRECATED; BREAKING_IMPROVEMENT: only use sensor_click for WXKG03LM (action hold -> click hold)
'WXKG03LM': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action],
'WXKG01LM': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'WXKG11LM': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'WXKG12LM': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'WXKG03LM': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'WXKG06LM': [cfg.sensor_battery, cfg.sensor_action],
'WXKG02LM': [cfg.sensor_click, cfg.sensor_battery],
'WXKG02LM': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'QBKG04LM': [cfg.switch, cfg.sensor_click, cfg.sensor_action],
'QBKG03LM': [switchEndpoint('left'), switchEndpoint('right'), cfg.sensor_click, cfg.sensor_temperature],
'QBKG03LM': [
switchEndpoint('left'), switchEndpoint('right'), cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature,
],
'WSDCGQ01LM': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery],
'WSDCGQ11LM': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_pressure, cfg.sensor_battery],
'RTCGQ01LM': [cfg.binary_sensor_occupancy, cfg.sensor_battery],
@@ -841,12 +842,12 @@ const mapping = {
'SL 110 W': [cfg.light_brightness],
'AE 260': [cfg.light_brightness],
'AA68199': [cfg.light_brightness_colortemp],
'QBKG11LM': [cfg.switch, cfg.sensor_power, cfg.sensor_click, cfg.sensor_temperature],
'QBKG11LM': [cfg.switch, cfg.sensor_power, cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature],
'QBKG21LM': [cfg.switch, cfg.sensor_click, cfg.sensor_action],
'QBKG22LM': [cfg.switch, cfg.sensor_click, cfg.sensor_temperature],
'QBKG22LM': [cfg.switch, cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature],
'QBKG12LM': [
switchEndpoint('left'), switchEndpoint('right'), cfg.sensor_power, cfg.sensor_click,
cfg.sensor_temperature,
cfg.sensor_temperature, cfg.sensor_action,
],
'K2RGBW01': [cfg.light_brightness_colortemp_colorxy],
'9290011370': [cfg.light_brightness],
@@ -1027,7 +1028,7 @@ const mapping = {
'YRD426NRSC': [cfg.lock, cfg.sensor_battery],
'BE468': [cfg.lock, cfg.sensor_battery],
'YRD246HA20BP': [cfg.lock, cfg.sensor_battery],
'E1743': [cfg.sensor_click, cfg.sensor_battery],
'E1743': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'LED1732G11': [cfg.light_brightness_colortemp],
'LED1736G9': [cfg.light_brightness_colortemp],
'RB 265': [cfg.light_brightness],
@@ -1098,8 +1099,8 @@ const mapping = {
cfg.sensor_temperature, cfg.binary_sensor_contact,
cfg.sensor_battery, cfg.binary_sensor_battery_low,
],
'IM6001-BTP01': [cfg.sensor_click, cfg.sensor_temperature, cfg.sensor_battery],
'AV2010/34': [cfg.sensor_click],
'IM6001-BTP01': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature, cfg.sensor_battery],
'AV2010/34': [cfg.sensor_click, cfg.sensor_action],
'PP-WHT-US': [
cfg.switch, cfg.sensor_power,
cfg.sensor_current, cfg.sensor_voltage,
@@ -1108,8 +1109,8 @@ const mapping = {
cfg.binary_sensor_battery_low, cfg.binary_sensor_carbon_monoxide,
cfg.binary_sensor_gas,
],
'HGZB-1S': [cfg.switch, cfg.sensor_click],
'HGZB-045': [cfg.switch, cfg.sensor_click],
'HGZB-1S': [cfg.switch, cfg.sensor_click, cfg.sensor_action],
'HGZB-045': [cfg.switch, cfg.sensor_click, cfg.sensor_action],
'HGZB-43': [switchEndpoint('top'), switchEndpoint('bottom'), switchEndpoint('center')],
'HGZB-01A': [cfg.switch],
'HGZB-02A': [cfg.light_brightness],
@@ -1132,7 +1133,7 @@ const mapping = {
cfg.sensor_battery, cfg.binary_sensor_battery_low,
],
'SWO-KEF1PA': [cfg.sensor_action],
'HGZB-02S': [cfg.sensor_click, cfg.switch],
'HGZB-02S': [cfg.sensor_click, cfg.sensor_action, cfg.switch],
'HGZB-41': [cfg.switch],
'ZG9101SAC-HP': [cfg.light_brightness],
'RS 122': [cfg.light_brightness],
@@ -1189,7 +1190,7 @@ const mapping = {
'MCT-340 E': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery],
'MCT-340 SMA': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery],
'D1542': [cfg.light_brightness_colortemp],
'ZGRC-KEY-013': [cfg.sensor_click],
'ZGRC-KEY-013': [cfg.sensor_click, cfg.sensor_action],
'ZigUP': [cfg.switch],
'YRD256HA20BP': [cfg.sensor_battery, cfg.lock],
'SZ-ESW01-AU': [cfg.sensor_power, cfg.switch],
@@ -1260,7 +1261,7 @@ const mapping = {
'AC08559': [cfg.light_brightness_colortemp_colorxy],
'LVS-ZB15S': [cfg.switch],
'LZL4BWHL01': [cfg.sensor_action],
'2AJZ4KPKEY': [cfg.sensor_click, cfg.sensor_battery],
'2AJZ4KPKEY': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery],
'2AJZ4KPFT': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery],
'TT001ZAV20': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery],
'TS0002': [switchEndpoint('l1'), switchEndpoint('l2')],
@@ -1287,7 +1288,7 @@ const mapping = {
sensorEndpoint('l4'), sensorEndpoint('l5'), sensorEndpoint('l6'),
sensorEndpoint('l7'), sensorEndpoint('l8'),
cfg.sensor_click, cfg.sensor_temperature, cfg.sensor_voltage,
cfg.sensor_pressure, cfg.sensor_humidity,
cfg.sensor_pressure, cfg.sensor_humidity, cfg.sensor_action,
],
'DIYRuZ_R4_5': [
switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), switchEndpoint('top_left'),
@@ -1308,7 +1309,7 @@ const mapping = {
'PSB19-SW27': [cfg.light_brightness],
'S1': [cfg.switch, cfg.sensor_power],
'S2': [switchEndpoint('l1'), switchEndpoint('l2'), cfg.sensor_power],
'ZWallRemote0': [cfg.sensor_click],
'ZWallRemote0': [cfg.sensor_click, cfg.sensor_action],
'D1': [cfg.light_brightness, cfg.sensor_power],
'J1': [cfg.cover_position_tilt, cfg.sensor_power],
'73741': [cfg.light_brightness_colortemp_colorxy],
@@ -1323,7 +1324,7 @@ const mapping = {
'Z3-1BRL': [cfg.sensor_action, cfg.sensor_brightness],
'HS1CG-E': [cfg.binary_sensor_gas],
'LED1842G3': [cfg.light_brightness],
'ROB_200-008-0': [cfg.sensor_battery, cfg.sensor_click],
'ROB_200-008-0': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action],
'ICZB-IW11SW': [cfg.switch],
'HV-GUCXZB5': [cfg.light_brightness_colortemp],
'HGZB-20A': [cfg.switch],
@@ -1340,7 +1341,7 @@ const mapping = {
'54668161': [cfg.light_brightness_colortemp],
'8718699688820': [cfg.light_brightness],
'GL-W-001Z': [cfg.switch],
'E1766': [cfg.sensor_click, cfg.sensor_battery],
'E1766': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action],
'929001953101': [cfg.light_brightness_colortemp_colorxy],
'8718699673147': [cfg.light_brightness],
'3300-P': [cfg.sensor_temperature, cfg.binary_sensor_contact, cfg.sensor_battery],
@@ -1380,7 +1381,7 @@ const mapping = {
'9290022169': [cfg.light_brightness_colortemp],
'TERNCY-PP01': [
cfg.sensor_temperature, cfg.binary_sensor_occupancy, cfg.sensor_illuminance, cfg.sensor_illuminance_lux,
cfg.sensor_click,
cfg.sensor_click, cfg.sensor_action,
],
'CR11S8UZ': [cfg.sensor_action],
'RB 148 T': [cfg.light_brightness_colortemp],
@@ -1464,7 +1465,7 @@ const mapping = {
'067773': [cfg.sensor_action, cfg.sensor_battery],
'067771': [cfg.light_brightness],
'064873': [cfg.sensor_action],
'K4003C': [cfg.switch, cfg.sensor_action],
'K4003C/L4003C/N4003C/NT4003C': [cfg.switch, cfg.sensor_action],
'STZB402': [
thermostat(5, 30, 'occupied_heating_setpoint', 0.5),
cfg.sensor_local_temperature,
@@ -1542,7 +1543,7 @@ const mapping = {
'07046L': [cfg.sensor_action],
'07045L': [cfg.binary_sensor_contact, cfg.binary_sensor_tamper, cfg.binary_sensor_battery_low],
'3402831P7': [cfg.light_brightness_colortemp],
'TERNCY-SD01': [cfg.sensor_click, cfg.sensor_battery],
'TERNCY-SD01': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action],
'07048L': [cfg.switch, cfg.sensor_power],
'ICZB-KPD14S': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action],
'73743': [cfg.sensor_action, cfg.sensor_battery],
@@ -1557,7 +1558,7 @@ const mapping = {
'4512703': [cfg.sensor_action, cfg.sensor_battery],
'4512702': [cfg.sensor_action, cfg.sensor_battery],
'4090331P9': [cfg.light_brightness_colortemp_colorxy],
'HS1EB': [cfg.sensor_click],
'HS1EB': [cfg.sensor_click, cfg.sensor_action],
'HS2SW1A-N': [cfg.switch],
'HS2SW2A-N': [switchEndpoint('left'), switchEndpoint('right')],
'HS2SW3A-N': [switchEndpoint('left'), switchEndpoint('right'), switchEndpoint('center')],
@@ -1786,6 +1787,8 @@ const mapping = {
'43102': [cfg.switch],
'1746430P7': [cfg.light_brightness_colortemp_colorxy],
'1743830P7': [cfg.light_brightness_colortemp_colorxy],
'ZB-CT01': [cfg.light_brightness_colortemp],
'8718699703424': [cfg.light_brightness_colortemp_colorxy],
};
const defaultStatusTopic = 'homeassistant/status';
+21 -18
View File
@@ -816,16 +816,17 @@ describe('HomeAssistant extension', () => {
MQTT.publish.mockClear();
const device = zigbeeHerdsman.devices.WXKG11LM;
settings.set(['devices', device.ieeeAddr, 'legacy'], false);
const payload = {data: {onOff: 1}, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
const discoverPayload = {
"automation_type":"trigger",
"type":"click",
"type":"action",
"subtype":"single",
"payload":"single",
"topic":"zigbee2mqtt/button/click",
"topic":"zigbee2mqtt/button/action",
"device":{
"identifiers":[
"zigbee2mqtt_0x0017880104e45520"
@@ -838,14 +839,14 @@ describe('HomeAssistant extension', () => {
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/device_automation/0x0017880104e45520/click_single/config',
'homeassistant/device_automation/0x0017880104e45520/action_single/config',
JSON.stringify(discoverPayload),
{ retain: true, qos: 0 },
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button/click',
'zigbee2mqtt/button/action',
'single',
{ retain: false, qos: 0 },
expect.any(Function),
@@ -853,14 +854,14 @@ describe('HomeAssistant extension', () => {
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button',
JSON.stringify({click: "single", linkquality: 10}),
JSON.stringify({action: "single", linkquality: 10}),
{ retain: false, qos: 0 },
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button',
JSON.stringify({linkquality: 10, click: ""}),
JSON.stringify({linkquality: 10, action: ""}),
{ retain: false, qos: 0 },
expect.any(Function),
);
@@ -870,14 +871,14 @@ describe('HomeAssistant extension', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).not.toHaveBeenCalledWith(
'homeassistant/device_automation/0x0017880104e45520/click_single/config',
'homeassistant/device_automation/0x0017880104e45520/action_single/config',
JSON.stringify(discoverPayload),
{ retain: true, qos: 0 },
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button/click',
'zigbee2mqtt/button/action',
'single',
{ retain: false, qos: 0 },
expect.any(Function),
@@ -915,16 +916,17 @@ describe('HomeAssistant extension', () => {
MQTT.publish.mockClear();
const device = zigbeeHerdsman.devices.WXKG11LM;
settings.set(['devices', device.ieeeAddr, 'legacy'], false);
const payload = {data: {onOff: 1}, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
const discoverPayload = {
"automation_type":"trigger",
"type":"click",
"type":"action",
"subtype":"single",
"payload":"single",
"topic":"zigbee2mqtt/button/click",
"topic":"zigbee2mqtt/button/action",
"device":{
"identifiers":[
"zigbee2mqtt_0x0017880104e45520"
@@ -937,14 +939,14 @@ describe('HomeAssistant extension', () => {
};
expect(MQTT.publish).toHaveBeenCalledWith(
'homeassistant/device_automation/0x0017880104e45520/click_single/config',
'homeassistant/device_automation/0x0017880104e45520/action_single/config',
JSON.stringify(discoverPayload),
{ retain: true, qos: 0 },
expect.any(Function),
);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button/click',
'zigbee2mqtt/button/action',
'single',
{ retain: false, qos: 0 },
expect.any(Function),
@@ -952,7 +954,7 @@ describe('HomeAssistant extension', () => {
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/button',
JSON.stringify({click: "single", linkquality: 10}),
JSON.stringify({action: "single", linkquality: 10}),
{ retain: false, qos: 0 },
expect.any(Function),
);
@@ -985,25 +987,26 @@ describe('HomeAssistant extension', () => {
expect(logger.error).toHaveBeenCalledTimes(0);
});
it('Should counter an action/click payload with an empty payload', async () => {
it('Should counter an action payload with an empty payload', async () => {
controller = new Controller(false);
await controller.start();
await flushPromises();
MQTT.publish.mockClear();
const device = zigbeeHerdsman.devices.WXKG11LM;
settings.set(['devices', device.ieeeAddr, 'legacy'], false);
const data = {onOff: 1}
const payload = {data, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(4);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/button');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'single', linkquality: 10});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({action: 'single', linkquality: 10});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
expect(MQTT.publish.mock.calls[1][0]).toStrictEqual('zigbee2mqtt/button');
expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toStrictEqual({click: '', linkquality: 10});
expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toStrictEqual({action: '', linkquality: 10});
expect(MQTT.publish.mock.calls[1][2]).toStrictEqual({"qos": 0, "retain": false});
expect(MQTT.publish.mock.calls[2][0]).toStrictEqual('homeassistant/device_automation/0x0017880104e45520/click_single/config');
expect(MQTT.publish.mock.calls[3][0]).toStrictEqual('zigbee2mqtt/button/click');
expect(MQTT.publish.mock.calls[2][0]).toStrictEqual('homeassistant/device_automation/0x0017880104e45520/action_single/config');
expect(MQTT.publish.mock.calls[3][0]).toStrictEqual('zigbee2mqtt/button/action');
});
it('Load Home Assistant mapping from external converters', async () => {
+21
View File
@@ -1004,6 +1004,27 @@ describe('Publish', () => {
);
});
it('Should restore brightness when state hass brightness 0 and bulb is turned ON', async () => {
const device = zigbeeHerdsman.devices.bulb_color;
const endpoint = device.getEndpoint(1);
endpoint.read.mockImplementationOnce((cluster, attrs) => {
if (cluster === 'genLevelCtrl' && attrs.includes('currentLevel')) {
return {currentLevel: 100};
}
});
controller.state.state = {[device.ieeeAddr]: {state: "OFF", brightness: 0,}};
await MQTT.events.message('zigbee2mqtt/bulb_color/set', JSON.stringify({state: "OFF"}));
await flushPromises();
await MQTT.events.message('zigbee2mqtt/bulb_color/set', JSON.stringify({state: "ON"}));
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(2);
expect(MQTT.publish).toHaveBeenNthCalledWith(1, 'zigbee2mqtt/bulb_color', JSON.stringify({state: 'OFF', brightness: 0}), {retain: false, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenNthCalledWith(2, 'zigbee2mqtt/bulb_color', JSON.stringify({state: 'ON', brightness: 100}), {retain: false, qos: 0}, expect.any(Function));
expect(endpoint.command).toHaveBeenCalledTimes(2);
expect(endpoint.command.mock.calls[0]).toEqual(["genOnOff", "off", {}, {}]);
expect(endpoint.command.mock.calls[1]).toEqual(["genOnOff", "on", {}, {}]);
});
it('Should publish messages with options disableDefaultResponse', async () => {
const device = zigbeeHerdsman.devices.GLEDOPTO1112;
const endpoint = device.getEndpoint(11);
+17 -8
View File
@@ -28,9 +28,7 @@ describe('Receive', () => {
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/button');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'single', linkquality: 10});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/button', JSON.stringify({action: 'single', click: 'single', linkquality: 10}), {retain: false, qos: 0}, expect.any(Function));
});
it('Should handle a zigbee message which uses ep (left)', async () => {
@@ -41,7 +39,7 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/button_double_key');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'left', linkquality: 10});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'left', action: 'single_left', linkquality: 10});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
@@ -53,7 +51,7 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/button_double_key');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'right', linkquality: 10});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({click: 'right', action: 'single_right', linkquality: 10});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
@@ -69,6 +67,17 @@ describe('Receive', () => {
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 1, "retain": false});
});
it('Should allow to disable the legacy integration', async () => {
const device = zigbeeHerdsman.devices.WXKG11LM;
settings.set(['devices', device.ieeeAddr, 'legacy'], false);
const data = {onOff: 1}
const payload = {data, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/button', JSON.stringify({action: 'single', linkquality: 10}), {retain: false, qos: 0}, expect.any(Function));
});
it('Should debounce messages', async () => {
jest.useFakeTimers();
const device = zigbeeHerdsman.devices.WSDCGQ11LM;
@@ -397,7 +406,7 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/ikea_onoff');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'click': 'brightness_stop', linkquality: 10});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'click': 'brightness_stop', action: 'brightness_stop', linkquality: 10});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
@@ -415,10 +424,10 @@ describe('Receive', () => {
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledTimes(2);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/ikea_onoff');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'click': 'brightness_stop'});
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({'click': 'brightness_stop', action: 'brightness_stop'});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
expect(MQTT.publish.mock.calls[1][0]).toStrictEqual('zigbee2mqtt/ikea_onoff');
expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toMatchObject({'click': 'brightness_stop'});
expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toMatchObject({'click': 'brightness_stop', action: 'brightness_stop'});
expect(JSON.parse(MQTT.publish.mock.calls[1][1]).elapsed).toBe(50);
expect(MQTT.publish.mock.calls[1][2]).toStrictEqual({"qos": 0, "retain": false});
Date.now = oldNow;