Update converters.

This commit is contained in:
Koen Kanters 2020-03-02 21:11:54 +01:00
parent 658cc21b4d
commit dc8b6c5294
3 changed files with 59 additions and 26 deletions

View File

@ -539,6 +539,27 @@ const switchWithPostfix = (postfix) => {
};
};
const lightWithPostfix = (postfix) => {
return {
type: 'light',
object_id: 'light',
discovery_payload: {
schema: 'template',
command_topic: true,
command_topic_prefix: postfix,
command_on_template: `>
{"state": "on"
{%- if brightness is defined -%}
, "brightness": {{ brightness }}
{%- endif -%}
}`,
command_off_template: '{"state": "off"}',
state_template: `{{ value_json.state_${postfix} }}`,
brightness_template: `{{ value_json.brightness_${postfix} }}`,
},
};
};
// Map homeassitant configurations to devices.
const mapping = {
'WXKG01LM': [cfg.sensor_click, cfg.sensor_battery],
@ -1158,7 +1179,8 @@ const mapping = {
'GL-D-004ZS': [cfg.light_brightness_colortemp_colorxy],
'AC10787': [cfg.light_brightness_colortemp],
'F-APP-UK-V2': [cfg.switch],
'S9TSZGB': [cfg.sensor_action],
'S9TSZGB_3': [cfg.sensor_action],
'S9TSZGB_1': [cfg.sensor_action],
'SP-EUC01': [cfg.switch],
'511.012': [cfg.light_brightness],
'GL-S-008Z': [cfg.light_brightness_colortemp_colorxy],
@ -1275,6 +1297,9 @@ const mapping = {
'C4': [cfg.sensor_action],
'GL-D-003ZS': [cfg.light_brightness_colortemp_colorxy],
'798.09': [cfg.light_brightness_colortemp_colorxy],
'U202DST600ZB': [lightWithPostfix('l1'), lightWithPostfix('l2')],
'SM10ZW': [cfg.binary_sensor_contact, cfg.sensor_battery],
'ICZB-R11D': [cfg.light_brightness],
};
Object.keys(mapping).forEach((key) => {

56
npm-shrinkwrap.json generated
View File

@ -796,20 +796,20 @@
"dev": true
},
"@typescript-eslint/experimental-utils": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.21.0.tgz",
"integrity": "sha512-olKw9JP/XUkav4lq0I7S1mhGgONJF9rHNhKFn9wJlpfRVjNo3PPjSvybxEldvCXnvD+WAshSzqH5cEjPp9CsBA==",
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
"integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.21.0",
"@typescript-eslint/typescript-estree": "2.22.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.21.0.tgz",
"integrity": "sha512-NC/nogZNb9IK2MEFQqyDBAciOT8Lp8O3KgAfvHx2Skx6WBo+KmDqlU3R9KxHONaijfTIKtojRe3SZQyMjr3wBw==",
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
"integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@ -845,9 +845,9 @@
"dev": true
},
"acorn": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
"dev": true
},
"acorn-globals": {
@ -892,12 +892,20 @@
}
},
"ansi-escapes": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz",
"integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==",
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz",
"integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==",
"dev": true,
"requires": {
"type-fest": "^0.8.1"
"type-fest": "^0.11.0"
},
"dependencies": {
"type-fest": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
"integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==",
"dev": true
}
}
},
"ansi-regex": {
@ -1973,9 +1981,9 @@
"dev": true
},
"eslint-plugin-jest": {
"version": "23.8.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.0.tgz",
"integrity": "sha512-DKXmLxguZ1Lru4u5YM12ko3WLq6gqo7dhV2b63K731+/PNyZ/Ff6NGONQsGUtPLG9zU3kdz/N+2LTbweNZifeg==",
"version": "23.8.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.1.tgz",
"integrity": "sha512-OycLNqPo/2EfO6kTqnmsu1khz1gTIOxGl3ThIVwL5/oycDF4pm5uNDyvFelNLdpr4COUuM8PVi3963NEG1Efpw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^2.5.0"
@ -2007,13 +2015,13 @@
"dev": true
},
"espree": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz",
"integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==",
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.2.0.tgz",
"integrity": "sha512-Xs8airJ7RQolnDIbLtRutmfvSsAe0xqMMAantCN/GMoqf81TFbeI1T7Jpd56qYu1uuh32dOG5W/X9uO+ghPXzA==",
"dev": true,
"requires": {
"acorn": "^7.1.0",
"acorn-jsx": "^5.1.0",
"acorn-jsx": "^5.2.0",
"eslint-visitor-keys": "^1.1.0"
}
},
@ -14805,9 +14813,9 @@
}
},
"zigbee-herdsman-converters": {
"version": "12.0.34",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.34.tgz",
"integrity": "sha512-bP/QKsV9Rndad/cApDlg4mcoOWS4O/jh8rbpRIoQoapr5EfrljZrj24ZClGnRl3IG+mvJMG/YXnfpxkYAq3UBQ==",
"version": "12.0.36",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.36.tgz",
"integrity": "sha512-ZPYRI6T5ugtqrek2tAiP7t4lpChRoiDvhM22a3TFuBgHWWj1IKZQzBo9vUSP+lHo1+iWwMlL/XK48QAnZI1h+w==",
"requires": {
"axios": "*",
"tar-stream": "*"

View File

@ -46,7 +46,7 @@
"semver": "*",
"winston": "*",
"zigbee-herdsman": "0.12.57",
"zigbee-herdsman-converters": "12.0.34"
"zigbee-herdsman-converters": "12.0.36"
},
"devDependencies": {
"eslint": "*",