Update converters.

This commit is contained in:
Koen Kanters
2020-01-21 21:19:11 +01:00
parent e94b34caad
commit dae52a22d7
7 changed files with 33 additions and 11 deletions
+5
View File
@@ -1164,6 +1164,11 @@ const mapping = {
'GP-WOU019BBDWG': [cfg.switch, cfg.sensor_power],
'AV2010/21A': [cfg.binary_sensor_battery_low, cfg.binary_sensor_contact, cfg.binary_sensor_tamper],
'AL-PIR02': [cfg.binary_sensor_occupancy, cfg.binary_sensor_tamper, cfg.sensor_battery],
'MKS-CM-W5': [
switchWithPostfix('l1'), switchWithPostfix('l2'),
switchWithPostfix('l3'), switchWithPostfix('l4'),
],
'STS-WTR-250': [cfg.binary_sensor_water_leak, cfg.sensor_battery],
};
Object.keys(mapping).forEach((key) => {
+1 -1
View File
@@ -28,7 +28,7 @@ function toLocalISOString(dDate) {
}
const postfixes = [
'left', 'right', 'center', 'bottom_left', 'bottom_right', 'l1', 'l2', 'default',
'left', 'right', 'center', 'bottom_left', 'bottom_right', 'l1', 'l2', 'l3', 'l4', 'default',
'top_left', 'top_right', 'white', 'rgb', 'system', 'top', 'bottom', 'center_left', 'center_right',
'ep1', 'ep2', 'row_1', 'row_2', 'row_3', 'row_4', 'relay',
];
+9 -9
View File
@@ -640,9 +640,9 @@
"dev": true
},
"@types/istanbul-lib-report": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz",
"integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "*"
@@ -1764,9 +1764,9 @@
}
},
"es-abstract": {
"version": "1.17.3",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.3.tgz",
"integrity": "sha512-AwiVPKf3sKGMoWtFw0J7Y4MTZ4Iek67k4COWOwHqS8B9TOZ71DCfcoBmdamy8Y6mj4MDz0+VNUpC2HKHFHA3pg==",
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
@@ -13526,9 +13526,9 @@
}
},
"zigbee-herdsman-converters": {
"version": "12.0.1",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.1.tgz",
"integrity": "sha512-8zYkePs9B+MV1ITPTnGWIkWdIGKOk1bE6T9al6VbKuHGxejotDBEgs8PRV6m9Ueg0Aop+LB+8TCR9Rxk2UvxTQ==",
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.3.tgz",
"integrity": "sha512-h/yELe1o4Vzu4RrimLFx32M1qVdusBp+c1pgfB8xJ7pjTzH+yuyJj87Msc6dgoe8AJSGI9vSGdrund/cgspW8w==",
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
+1 -1
View File
@@ -46,7 +46,7 @@
"semver": "*",
"winston": "*",
"zigbee-herdsman": "0.12.34",
"zigbee-herdsman-converters": "12.0.1"
"zigbee-herdsman-converters": "12.0.3"
},
"devDependencies": {
"eslint": "*",
+13
View File
@@ -918,4 +918,17 @@ describe('Entity publish', () => {
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({position: 100});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
it('Should publish to MKS-CM-W5', async () => {
const device = zigbeeHerdsman.devices['MKS-CM-W5'];
const endpoint = device.getEndpoint(1);
await MQTT.events.message('zigbee2mqtt/MKS-CM-W5/l3/set', JSON.stringify({state: 'ON'}));
await flushPromises();
expect(endpoint.command).toHaveBeenCalledTimes(1);
expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuyaDimmer", "setData", {data: [1,1], dp: 259, fn: 0, status: 0, transid: 16}, {disableDefaultResponse: true});
expect(MQTT.publish).toHaveBeenCalledTimes(1);
expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/MKS-CM-W5');
expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({state_l3: 'ON'});
expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false});
});
});
+3
View File
@@ -142,6 +142,9 @@ function writeDefaultConfiguration() {
'0x90fd9ffffe4b64ab': {
friendly_name: 'SP600_NEW',
},
'0x90fd9ffffe4b64ac': {
friendly_name: 'MKS-CM-W5',
}
},
groups: {
'1': {
+1
View File
@@ -138,6 +138,7 @@ const devices = {
'ZNLDP12LM': new Device('Router', '0x90fd9ffffe4b64ax', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64ax')], true, "Mains (single phase)", "lumi.light.aqcn02"),
'SP600_OLD': new Device('Router', '0x90fd9ffffe4b64aa', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {seMetering: {"multiplier":1,"divisor":10000}})], true, "Mains (single phase)", "SP600", false, 'Salus', '20160120'),
'SP600_NEW': new Device('Router', '0x90fd9ffffe4b64ab', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {seMetering: {"multiplier":1,"divisor":10000}})], true, "Mains (single phase)", "SP600", false, 'Salus', '20170220'),
'MKS-CM-W5': new Device('Router', '0x90fd9ffffe4b64ac', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {})], true, "Mains (single phase)", "qnazj70", false),
}