mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Update converters.
This commit is contained in:
@@ -21,6 +21,8 @@ class DeviceEvent extends BaseExtension {
|
||||
}
|
||||
|
||||
callOnEvent(device, type, data, mappedDevice) {
|
||||
zigbeeHerdsmanConverters.onEvent(type, data, device);
|
||||
|
||||
if (!mappedDevice) {
|
||||
mappedDevice = zigbeeHerdsmanConverters.findByZigbeeModel(device.modelID);
|
||||
}
|
||||
|
||||
@@ -303,6 +303,18 @@ const cfg = {
|
||||
command_topic: true,
|
||||
},
|
||||
},
|
||||
'light_brightness_colortemp_colorxy_white': {
|
||||
type: 'light',
|
||||
object_id: 'light',
|
||||
discovery_payload: {
|
||||
brightness: true,
|
||||
xy: true,
|
||||
white_value: true,
|
||||
schema: 'json',
|
||||
command_topic: true,
|
||||
color_temp: true,
|
||||
},
|
||||
},
|
||||
'light_brightness_colortemp_colorxy': {
|
||||
type: 'light',
|
||||
object_id: 'light',
|
||||
@@ -640,7 +652,7 @@ const mapping = {
|
||||
'915005733701': [cfg.light_brightness_colortemp_colorxy],
|
||||
'RB 285 C': [cfg.light_brightness_colortemp_colorxy],
|
||||
'3216331P5': [cfg.light_brightness_colortemp],
|
||||
'AC08562': [cfg.light_brightness],
|
||||
'AC08562': [cfg.light_brightness_colortemp],
|
||||
'900008-WW': [cfg.light_brightness],
|
||||
'Mega23M12': [cfg.light_brightness_colortemp_colorxy],
|
||||
'PSS-23ZBS': [cfg.switch],
|
||||
@@ -693,6 +705,7 @@ const mapping = {
|
||||
'E1524/E1810': [cfg.sensor_action, cfg.sensor_battery],
|
||||
'GL-C-006': [cfg.light_brightness_colortemp],
|
||||
'GL-C-007': [cfg.light_brightness_colorxy_white],
|
||||
'GL-C-007/GL-C-008': [cfg.light_brightness_colortemp_colorxy_white],
|
||||
'100.424.11': [cfg.light_brightness_colortemp],
|
||||
'AC0251100NJ/AC0251700NJ': [cfg.sensor_action, cfg.sensor_battery],
|
||||
'71831': [cfg.light_brightness_colortemp],
|
||||
@@ -1100,7 +1113,7 @@ const mapping = {
|
||||
'9290022411': [cfg.light_brightness],
|
||||
'E1C-NB6': [cfg.switch],
|
||||
'LVS-SC7': [cfg.sensor_action],
|
||||
'1742930P7': [cfg.light_brightness_colorxy],
|
||||
'1742930P7': [cfg.light_brightness_colortemp_colorxy],
|
||||
'ZM-L03E-Z': [switchWithPostfix('left'), switchWithPostfix('center'), switchWithPostfix('right')],
|
||||
'DL15S-1BZ': [cfg.switch],
|
||||
'E1D-G73WNA': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low],
|
||||
|
||||
Generated
+3
-3
@@ -12803,9 +12803,9 @@
|
||||
}
|
||||
},
|
||||
"zigbee-herdsman-converters": {
|
||||
"version": "11.1.68",
|
||||
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-11.1.68.tgz",
|
||||
"integrity": "sha512-7+MnusHo64wpBevSCzpO9jOlvDg5PAnFdyQ5fUUmKqo2Oz6hzd8uG4fD3o+feweE30T78S6we3xs0TRADFrOgw==",
|
||||
"version": "11.2.0",
|
||||
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-11.2.0.tgz",
|
||||
"integrity": "sha512-eZt7d0CYd8l9j4ZKWrLy6u64b3hZIAPQEJqB71dZeQm4XF0ojqI7sCEkIUZ5IJBHC1BG0B7P9SIerwkb7jqbuw==",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
"version": "7.5.5",
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
"semver": "*",
|
||||
"winston": "*",
|
||||
"zigbee-herdsman": "0.12.27",
|
||||
"zigbee-herdsman-converters": "11.1.68"
|
||||
"zigbee-herdsman-converters": "11.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "*",
|
||||
|
||||
@@ -15,6 +15,7 @@ const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
||||
const mockOnEvent = jest.fn();
|
||||
const mappedLivolo = zigbeeHerdsmanConverters.findByZigbeeModel(zigbeeHerdsman.devices.LIVOLO.modelID);
|
||||
mappedLivolo.onEvent = mockOnEvent;
|
||||
zigbeeHerdsmanConverters.onEvent = jest.fn();
|
||||
|
||||
describe('Device event', () => {
|
||||
let controller;
|
||||
@@ -27,6 +28,7 @@ describe('Device event', () => {
|
||||
controller = new Controller();
|
||||
await controller.start();
|
||||
mocksClear.forEach((m) => m.mockClear());
|
||||
zigbeeHerdsmanConverters.onEvent.mockClear();
|
||||
await flushPromises();
|
||||
});
|
||||
|
||||
@@ -59,4 +61,15 @@ describe('Device event', () => {
|
||||
expect(call[1]).toStrictEqual({device})
|
||||
expect(call[2]).toBe(device);
|
||||
});
|
||||
|
||||
it('Should call index onEvent with zigbee event', async () => {
|
||||
zigbeeHerdsmanConverters.onEvent.mockClear();
|
||||
await zigbeeHerdsman.events.deviceAnnounce({device});
|
||||
await flushPromises();
|
||||
expect(zigbeeHerdsmanConverters.onEvent).toHaveBeenCalledTimes(1);
|
||||
const call = zigbeeHerdsmanConverters.onEvent.mock.calls[0];
|
||||
expect(call[0]).toBe('deviceAnnounce')
|
||||
expect(call[1]).toStrictEqual({device})
|
||||
expect(call[2]).toBe(device);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user