From 14c96a1045dd9d1be774f7f81b8a0e04512285d6 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Fri, 2 Oct 2020 17:26:08 +0200 Subject: [PATCH] Exposes for switch. https://github.com/Koenkk/zigbee2mqtt/issues/4466 --- lib/extension/homeassistant.js | 249 ++------------------------------- 1 file changed, 14 insertions(+), 235 deletions(-) diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index 19bb62ca2..b8157d154 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -3,7 +3,6 @@ const logger = require('../util/logger'); const utils = require('../util/utils'); const zigbee2mqttVersion = require('../../package.json').version; const Extension = require('./extension'); -const objectAssignDeep = require(`object-assign-deep`); const stringify = require('json-stable-stringify-without-jsonify'); const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters'); const assert = require('assert'); @@ -584,61 +583,6 @@ const cfg = { }, // Light - 'light_brightness_colortemp_colorxy': { - type: 'light', - object_id: 'light', - discovery_payload: { - brightness: true, - color_temp: true, - xy: true, - schema: 'json', - command_topic: true, - brightness_scale: 254, - }, - }, - 'light_brightness_colorxy': { - type: 'light', - object_id: 'light', - discovery_payload: { - brightness: true, - xy: true, - schema: 'json', - command_topic: true, - brightness_scale: 254, - }, - }, - 'light_brightness_colortemp_colorhs': { - type: 'light', - object_id: 'light', - discovery_payload: { - brightness: true, - color_temp: true, - hs: true, - schema: 'json', - command_topic: true, - brightness_scale: 254, - }, - }, - 'light_colorhs': { - type: 'light', - object_id: 'light', - discovery_payload: { - hs: true, - schema: 'json', - command_topic: true, - }, - }, - 'light_brightness_colortemp': { - type: 'light', - object_id: 'light', - discovery_payload: { - brightness: true, - color_temp: true, - schema: 'json', - command_topic: true, - brightness_scale: 254, - }, - }, 'light_brightness': { type: 'light', object_id: 'light', @@ -813,14 +757,6 @@ const switchEndpoint = (endpointName) => { }; }; -const lightEndpoint = (configType, endpointName) => { - const config = objectAssignDeep.noMutate(cfg[configType]); - config['object_id'] = `light_${endpointName}`; - config['discovery_payload']['command_topic_prefix'] = endpointName; - config['discovery_payload']['state_topic_postfix'] = endpointName; - return config; -}; - const sensorEndpoint = (endpointName) => { return { type: 'sensor', @@ -938,10 +874,7 @@ const manualMaping = { 'QBCZ11LM': [cfg.switch, cfg.sensor_power], 'JTYJ-GD-01LM/BW': [cfg.binary_sensor_smoke, cfg.sensor_battery, cfg.sensor_sensitivity, cfg.sensor_smoke_density], 'PLUG EDP RE:DY': [cfg.switch, cfg.sensor_power], - 'SWITCH EDP RE:DY': [cfg.switch], 'CC2530.ROUTER': [cfg.binary_sensor_led], - 'AB3257001NJ': [cfg.switch], - 'AC10691': [cfg.switch], 'ICTC-G-1': [cfg.sensor_brightness, cfg.sensor_battery, cfg.sensor_action], 'QBKG11LM': [cfg.switch, cfg.sensor_power, cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature], 'QBKG21LM': [cfg.switch, cfg.sensor_click, cfg.sensor_action], @@ -957,37 +890,23 @@ const manualMaping = { cfg.sensor_battery, ], 'STSS-MULT-001': [cfg.binary_sensor_contact, cfg.sensor_battery], - '72922-A': [cfg.switch], - 'DNCKATSW001': [cfg.switch], - 'DNCKATSW002': [switchEndpoint('left'), switchEndpoint('right')], - 'DNCKATSW003': [switchEndpoint('left'), switchEndpoint('right'), switchEndpoint('center')], - 'DNCKATSW004': [ - switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), - switchEndpoint('top_left'), switchEndpoint('top_right'), - ], 'JTQJ-BF-01LM/BW': [cfg.binary_sensor_gas, cfg.sensor_gas_density, cfg.sensor_sensitivity], - '50043': [cfg.switch], 'AV2010/22': [cfg.binary_sensor_occupancy, cfg.sensor_battery], '3210-L': [cfg.switch, cfg.sensor_power, cfg.sensor_current, cfg.sensor_voltage], '3320-L': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery], '3326-L': [cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_battery], 'A6121': [cfg.sensor_lock], 'DJT11LM': [cfg.sensor_action, cfg.sensor_battery, cfg.sensor_sensitivity, cfg.sensor_strength], - 'E1603/E1702': [cfg.switch], - 'KS-SM001': [cfg.switch], - 'MG-AUWS01': [switchEndpoint('left'), switchEndpoint('right')], '4256251-RZHAC': [cfg.switch, cfg.sensor_power], '4257050-ZHAC': [cfg.light_brightness, cfg.sensor_power, cfg.sensor_current, cfg.sensor_voltage], 'STS-PRS-251': [cfg.binary_sensor_presence, cfg.sensor_battery], 'STSS-PRES-001': [cfg.binary_sensor_presence, cfg.sensor_battery], - 'PSS-23ZBS': [cfg.switch], 'HS1SA-M': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low], 'AC01353010G': [ cfg.binary_sensor_occupancy, cfg.binary_sensor_tamper, cfg.sensor_temperature, cfg.binary_sensor_battery_low, ], 'SP 120': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], - 'SP 222': [cfg.switch], 'HS3SA': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low], 'HS1DS/HS3DS': [cfg.binary_sensor_contact], 'HS3DS': [ @@ -1006,12 +925,12 @@ const manualMaping = { 'ZCTS-808': [cfg.binary_sensor_contact, cfg.sensor_battery], 'ZNCLDJ11LM': [cfg.cover_position, cfg.sensor_cover], 'TS0601_curtain': [cfg.cover_position], + 'TS0601_curtain_switch': [cfg.cover_position], + 'TS0003_curtain_switch': [cfg.cover], '3325-S': [cfg.sensor_temperature, cfg.binary_sensor_occupancy], 'AV2010/25': [cfg.switch, cfg.sensor_power], '1TST-EU': [climate(), cfg.sensor_battery], - '45856GE': [cfg.switch], 'AIRAM-CTR.U': [], - 'HGZB-20-DE': [cfg.switch], 'AV2010/32': [climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_battery], 'E1524/E1810': [cfg.sensor_action, cfg.sensor_battery], 'AC0251100NJ/AC0251700NJ': [cfg.sensor_action, cfg.sensor_battery], @@ -1019,7 +938,6 @@ const manualMaping = { 'HS1DS-E': [cfg.binary_sensor_contact], 'SP600': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], '1613V': [cfg.switch, cfg.sensor_power], - 'TI0001': [switchEndpoint('left'), switchEndpoint('right')], 'SPZB0001': [climate(5, 30, 'current_heating_setpoint', 0.5), cfg.sensor_battery], 'HS3CG': [cfg.binary_sensor_gas], '81825': [cfg.sensor_action], @@ -1036,9 +954,6 @@ const manualMaping = { cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_illuminance, cfg.sensor_illuminance_lux, cfg.sensor_battery, ], - 'HGZB-042': [switchEndpoint('top'), switchEndpoint('bottom')], - 'HGZB-42': [switchEndpoint('top'), switchEndpoint('bottom')], - 'IM6001-OTP05': [cfg.switch], 'SV01': [ cfg.cover_position, cfg.sensor_temperature, cfg.sensor_pressure, cfg.sensor_battery, @@ -1058,20 +973,10 @@ const manualMaping = { ], 'ZYCT-202': [cfg.sensor_action], 'GR-ZB01-W': [cfg.cover_position], - 'HGZB-42-UK / HGZB-41 / HGZB-41-UK': [cfg.switch], 'ISW-ZPR1-WP13': [ cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_battery_low, ], - 'HGZB-043': [switchEndpoint('top'), switchEndpoint('bottom'), switchEndpoint('center')], - 'HGZB-44': [ - switchEndpoint('top_left'), switchEndpoint('top_right'), switchEndpoint('bottom_left'), - switchEndpoint('bottom_right'), - ], - 'NUE-ZBFLB': [ - switchEndpoint('button_light'), switchEndpoint('button_fan_high'), switchEndpoint('button_fan_med'), - switchEndpoint('button_fan_low'), - ], 'NCZ-3043-HA': [ cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_battery_low, @@ -1108,8 +1013,6 @@ const manualMaping = { ], '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], 'MCT-350 SMA': [cfg.binary_sensor_contact], '3310-S': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'IM6001-WLP01': [ @@ -1130,16 +1033,13 @@ const manualMaping = { ], 'SWO-KEF1PA': [cfg.sensor_action], 'HGZB-02S': [cfg.sensor_click, cfg.sensor_action, cfg.switch], - 'HGZB-41': [cfg.switch], 'IM6001-MTP01': [cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_occupancy], - 'U86K31ND6': [switchEndpoint('left'), switchEndpoint('right'), switchEndpoint('center')], 'HS1RC-N': [cfg.sensor_action, cfg.sensor_battery], 'SWO-WDS1PA': [cfg.binary_sensor_contact], 'LLKZMK11LM': [ switchEndpoint('l1'), switchEndpoint('l2'), cfg.sensor_power, cfg.sensor_temperature, cfg.sensor_consumption, ], - 'T18W3Z': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')], 'LVS-SM10ZW': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], 'HS2SK': [cfg.switch, cfg.sensor_power, cfg.sensor_voltage, cfg.sensor_current], 'HS2SS': [cfg.sensor_action, cfg.sensor_battery], @@ -1153,14 +1053,11 @@ const manualMaping = { 'YMF40/YDM4109+': [cfg.lock, cfg.sensor_battery], 'V3-BTZB': [cfg.lock, cfg.sensor_battery], '3RSS008Z': [cfg.switch, cfg.sensor_battery], - '3RSS007Z': [cfg.switch], '99432': [cfg.fan, cfg.light_brightness], 'IM6001-MPP01': [ cfg.sensor_temperature, cfg.binary_sensor_contact, cfg.sensor_battery, ], - '67200BL': [cfg.switch], 'InstaRemote': [cfg.sensor_action], - '100.425.90': [cfg.switch], 'HS1CA-E': [ cfg.binary_sensor_carbon_monoxide, cfg.binary_sensor_battery_low, cfg.sensor_battery, @@ -1168,17 +1065,12 @@ const manualMaping = { '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], '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], 'PSM-29ZBSR': [cfg.switch, cfg.sensor_power], 'SCM-S1': [cfg.cover_position], 'HEIMAN-M1': [cfg.binary_sensor_contact], 'HS3MS': [cfg.binary_sensor_occupancy], - 'DIYRUZ_R4_5': [ - switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), switchEndpoint('center'), - switchEndpoint('top_left'), switchEndpoint('top_right'), - ], 'NCZ-3011-HA': [cfg.binary_sensor_contact, cfg.sensor_battery], 'MEAZON_BIZY_PLUG': [cfg.sensor_power, cfg.switch, cfg.sensor_temperature], 'MEAZON_DINRAIL': [cfg.sensor_power, cfg.switch, cfg.sensor_temperature], @@ -1198,28 +1090,10 @@ const manualMaping = { ], '12050': [cfg.switch, cfg.sensor_power], 'RH3040': [cfg.sensor_battery, cfg.binary_sensor_occupancy], - 'GLSK3ZB-1711': [cfg.switch], - 'GLSK3ZB-1712': [switchEndpoint('top'), switchEndpoint('bottom')], - 'GLSK3ZB-1713': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], - 'GLSK6ZB-1714': [ - switchEndpoint('top_left'), switchEndpoint('bottom_left'), - switchEndpoint('top_right'), switchEndpoint('bottom_right'), - ], - 'GLSK6ZB-1715': [ - switchEndpoint('top_left'), switchEndpoint('center_left'), switchEndpoint('bottom_left'), - switchEndpoint('top_right'), switchEndpoint('bottom_right'), - ], - 'GLSK6ZB-1716': [ - switchEndpoint('top_left'), switchEndpoint('center_left'), switchEndpoint('bottom_left'), - switchEndpoint('top_right'), switchEndpoint('center_right'), switchEndpoint('bottom_right'), - ], - 'LVS-ZB15S': [cfg.switch], 'LZL4BWHL01': [cfg.sensor_action], '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')], - 'LVS-ZB15R': [cfg.switch], 'TH1123ZB': [ climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_local_temperature, cfg.lock_keypad_lockout, cfg.sensor_power, cfg.sensor_energy, @@ -1250,10 +1124,6 @@ const manualMaping = { cfg.sensor_click, cfg.sensor_temperature, cfg.sensor_voltage, cfg.sensor_pressure, cfg.sensor_humidity, cfg.sensor_action, ], - 'DIYRuZ_R4_5': [ - switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), switchEndpoint('top_left'), - switchEndpoint('top_right'), switchEndpoint('center'), - ], 'DIYRuZ_KEYPAD20': [], 'DTB190502A1': [], 'HS1CG-M': [cfg.binary_sensor_gas], @@ -1268,33 +1138,23 @@ const manualMaping = { 'Z3-1BRL': [cfg.sensor_action, cfg.sensor_brightness], 'HS1CG-E': [cfg.binary_sensor_gas], 'ROB_200-008-0': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action], - 'ICZB-IW11SW': [cfg.switch], - 'HGZB-20A': [cfg.switch], 'SZ-ESW01': [cfg.switch, cfg.sensor_power], '2AJZ4KPBS': [cfg.sensor_battery, cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], '2AJZ4KPDR': [cfg.sensor_battery, cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], - '6717-84': [cfg.switch], 'ICZB-KPD18S': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action], 'E1757': [cfg.cover_position, cfg.sensor_battery], 'E1926': [cfg.cover_position, cfg.sensor_battery], - 'GL-W-001Z': [cfg.switch], 'E1766': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action], '3300-P': [cfg.sensor_temperature, cfg.binary_sensor_contact, cfg.sensor_battery], - '929002240401': [cfg.switch], - 'HGZB-20-UK': [cfg.switch], - 'PTAPT-WH02': [cfg.switch], 'DIYRuZ_magnet': [cfg.binary_sensor_contact, cfg.sensor_battery], 'XHS2-SE': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery], - '4000116784070': [cfg.switch], 'YRD210-HA-605': [cfg.lock, cfg.sensor_battery], 'YRD220/YRD221': [cfg.lock, cfg.sensor_battery], 'ZM-CSW032-D': [cfg.cover_position], 'LH-32ZB': [cfg.sensor_humidity, cfg.sensor_temperature, cfg.sensor_battery], 'ZNCLDJ12LM': [cfg.cover_position, cfg.sensor_battery], - '046677552343': [cfg.switch], 'ZWLD-100': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low, cfg.sensor_battery], 'YRD226/246 TSDB': [cfg.lock, cfg.sensor_battery], - 'BASICZBR3': [cfg.switch], 'E1744': [cfg.sensor_action, cfg.sensor_battery], 'TS0201': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'LH07321': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low], @@ -1305,22 +1165,16 @@ const manualMaping = { 'CR11S8UZ': [cfg.sensor_action], 'STS-OUT-US-2': [cfg.switch, cfg.sensor_power], 'UK7004240': [climate(), cfg.sensor_battery], - 'S31ZB': [cfg.switch], - 'SA-003-Zigbee': [cfg.switch], 'SZ-DWS04': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery], 'TS0203': [cfg.sensor_battery, cfg.binary_sensor_contact], 'TS0204': [cfg.binary_sensor_gas], 'TS0205': [cfg.binary_sensor_smoke, cfg.sensor_battery], - 'TS0111': [cfg.switch], - 'TS0001': [cfg.switch], 'TS0207': [cfg.binary_sensor_water_leak, cfg.sensor_battery], 'iL07_1': [cfg.binary_sensor_occupancy, cfg.binary_sensor_tamper, cfg.binary_sensor_battery_low], 'LH-992ZB': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'TS0202': [cfg.binary_sensor_occupancy, cfg.sensor_battery], 'TS0218': [cfg.sensor_action, cfg.sensor_battery], - '404021': [cfg.switch], 'DIYRuZ_rspm': [cfg.switch, cfg.sensor_action, cfg.sensor_power, cfg.sensor_current], - 'ZG9101SAC-HP-Switch': [cfg.switch], 'ZNCZ04LM': [ cfg.switch, cfg.sensor_power, cfg.sensor_consumption, cfg.sensor_current, cfg.sensor_voltage, cfg.sensor_temperature, @@ -1334,10 +1188,6 @@ const manualMaping = { 'TS0043': [cfg.sensor_action, cfg.sensor_battery], 'TS0041': [cfg.sensor_action, cfg.sensor_battery], 'SP-EUC01': [cfg.switch, cfg.sensor_power], - 'TZSW22FW-L4': [switchEndpoint('top'), switchEndpoint('bottom')], - 'TS0011': [cfg.switch], - 'TS0012': [switchEndpoint('left'), switchEndpoint('right')], - 'TS0013': [switchEndpoint('left'), switchEndpoint('center'), switchEndpoint('right')], '6735/6736/6737': [cfg.switch, cfg.sensor_action], 'SZ-SRN12N': [], '9GED18000-009': [cfg.lock, cfg.sensor_battery], @@ -1349,13 +1199,7 @@ const manualMaping = { 'SMHM-I1': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'SKHMP30-I1': [cfg.switch, cfg.sensor_power], '6ARCZABZH': [cfg.sensor_battery, cfg.sensor_action], - 'ZK-EU-2U': [cfg.switch], - '511.202': [cfg.switch], - 'SP 224': [cfg.switch], - 'E1C-NB6': [cfg.switch], 'LVS-SC7': [cfg.sensor_action], - 'ZM-L03E-Z': [switchEndpoint('left'), switchEndpoint('center'), switchEndpoint('right')], - 'DL15S-1BZ': [cfg.switch], 'E1D-G73WNA': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], 'WV704R0A0902': [climate()], '067776': [cfg.cover_position], @@ -1377,9 +1221,7 @@ const manualMaping = { cfg.sensor_local_temperature, cfg.lock_keypad_lockout, ], - '12126': [cfg.switch], '067775': [cfg.switch, cfg.sensor_power], - '064888': [cfg.switch], '412015': [cfg.sensor_power, cfg.binary_sensor_power_alarm_active], 'GZCGQ01LM': [cfg.sensor_battery, cfg.sensor_illuminance, cfg.sensor_illuminance_lux], 'U86KCJ-ZP': [cfg.sensor_action], @@ -1395,19 +1237,12 @@ const manualMaping = { 'GP-WOU019BBDWG': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], '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], - 'TS0601_switch': [ - switchEndpoint('l1'), switchEndpoint('l2'), - switchEndpoint('l3'), switchEndpoint('l4'), - ], - 'TS0601_switch_2_gang': [switchEndpoint('l1'), switchEndpoint('l2')], 'STS-WTR-250': [cfg.binary_sensor_water_leak, cfg.sensor_battery, cfg.sensor_temperature], 'ZG2835RAC': [cfg.light_brightness, cfg.sensor_power, cfg.sensor_energy], 'BW-IS2': [cfg.binary_sensor_contact, cfg.sensor_battery], 'BW-IS3': [cfg.binary_sensor_occupancy], 'SLR1b': [climate()], 'WPT1': [], - 'ROB_200-003-0': [cfg.switch], - '4512704': [cfg.switch], 'AV2010/24A': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low, cfg.binary_sensor_tamper], '902010/24': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low, cfg.binary_sensor_tamper], 'SGMHM-I1': [cfg.binary_sensor_gas, cfg.binary_sensor_battery_low, cfg.binary_sensor_tamper], @@ -1425,10 +1260,7 @@ const manualMaping = { '73743': [cfg.sensor_action, cfg.sensor_battery], 'C4': [cfg.sensor_action], '66492-001': [cfg.lock, cfg.sensor_battery], - 'U202DST600ZB': [lightEndpoint('light_brightness', 'l1'), lightEndpoint('light_brightness', 'l2')], 'SM10ZW': [cfg.binary_sensor_contact, cfg.sensor_battery], - 'SW2500ZB': [cfg.switch], - 'SP2600ZB': [cfg.switch], '4512703': [cfg.sensor_action, cfg.sensor_battery], '4512721': [cfg.sensor_action, cfg.sensor_battery], '4512702': [cfg.sensor_action, cfg.sensor_battery], @@ -1443,17 +1275,6 @@ const manualMaping = { 'MCLH-04': [cfg.binary_sensor_contact, cfg.sensor_battery], '3323-G': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.binary_sensor_battery_low], 'ROB_200-007-0': [cfg.sensor_action, cfg.sensor_battery], - 'PM-S140-ZB': [cfg.switch], - 'PM-S240-ZB': [switchEndpoint('top'), switchEndpoint('bottom')], - 'PM-S340-ZB': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], - 'PM-S140R-ZB': [cfg.switch], - 'PM-S240R-ZB': [switchEndpoint('top'), switchEndpoint('bottom')], - 'PM-S340R-ZB': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], - 'PM-S150-ZB': [cfg.switch], - 'PM-S250-ZB': [switchEndpoint('top'), switchEndpoint('bottom')], - 'PM-S350-ZB': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], - 'U201SRY2KWZB': [cfg.switch], - 'U202SRY2KWZB': [switchEndpoint('l1'), switchEndpoint('l2')], 'ZHS-15': [cfg.switch, cfg.sensor_power, cfg.sensor_current, cfg.sensor_voltage], 'GS361A-H04': [ cfg.lock_child_lock, @@ -1462,7 +1283,6 @@ const manualMaping = { climate(5, 30, 'current_heating_setpoint', 0.5), cfg.sensor_battery, ], - 'HLC614-ZLL': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')], 'EMIZB-132': [ cfg.sensor_power, cfg.sensor_voltage, cfg.sensor_current, cfg.sensor_energy, cfg.sensor_current_phase_b, cfg.sensor_current_phase_c, cfg.sensor_voltage_phase_b, cfg.sensor_voltage_phase_c, @@ -1481,23 +1301,17 @@ const manualMaping = { 'SGA01ZB': [cfg.binary_sensor_gas, cfg.sensor_battery], 'SWA01ZB': [cfg.binary_sensor_water_leak, cfg.sensor_battery], 'SDM01ZB': [cfg.binary_sensor_contact, cfg.sensor_battery], - 'SFS01ZB': [cfg.switch], - 'SLS301ZB_2': [switchEndpoint('left'), switchEndpoint('right')], - 'SLS301ZB_3': [switchEndpoint('left'), switchEndpoint('right'), switchEndpoint('center')], 'SSS401ZB': [cfg.switch, cfg.sensor_action], '4040B': [cfg.sensor_power, switchEndpoint('l1'), switchEndpoint('l2')], '3460-L': [cfg.sensor_action, cfg.sensor_temperature, cfg.sensor_battery], '3157100': [climate(10, 30, 'occupied_heating_setpoint', 1, ['off', 'heat', 'cool'], ['auto', 'on'], [], true, true), cfg.sensor_battery], - '4200-C': [cfg.switch], '4257050-RZHAC': [cfg.switch, cfg.sensor_power], '27087-03': [cfg.switch, cfg.sensor_battery], '99140-002': [cfg.lock, cfg.sensor_battery], '4512706': [cfg.sensor_battery, cfg.sensor_action], - 'RL804QZB': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')], 'RC-2000WH': [climate(10, 30, 'occupied_heating_setpoint', 1, ['off', 'auto', 'heat', 'cool'], ['auto', 'on', 'smart'], [], true, true)], - 'SP 220': [cfg.switch], '511.344': [cfg.sensor_battery, cfg.sensor_action, cfg.sensor_action_color, cfg.sensor_action_color_temperature], 'SMSZB-120': [cfg.binary_sensor_smoke, cfg.sensor_temperature, cfg.sensor_battery], 'DWS003': [cfg.binary_sensor_contact, cfg.sensor_battery, cfg.binary_sensor_battery_low, cfg.sensor_temperature], @@ -1533,24 +1347,16 @@ const manualMaping = { 'ZK03840': [climate()], 'ZS1100400-IN-V1A02': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'MCLH-08': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_eco2, cfg.sensor_voc], - 'ED2004-012': [cfg.switch], 'SLT2': [], 'SLB2': [], '8840100H': [cfg.binary_sensor_water_leak, cfg.sensor_temperature, cfg.sensor_battery], - '9290022408': [cfg.switch], 'HGZB-14A': [cfg.binary_sensor_water_leak, cfg.sensor_battery], 'TERNCY-DC01': [cfg.sensor_temperature, cfg.binary_sensor_contact], 'ZS110050078': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], - 'ECW-100-A03': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], 'DIYRuZ_FreePad': [cfg.sensor_action, cfg.sensor_battery], 'ST20': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'ST21': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], - 'T30W3Z': [switchEndpoint('top'), switchEndpoint('center'), switchEndpoint('bottom')], - 'T21W2Z': [switchEndpoint('top'), switchEndpoint('bottom')], - 'T21W1Z': [cfg.switch], 'W40CZ': [cfg.cover_position], - 'R11W2Z': [switchEndpoint('l1'), switchEndpoint('l2')], - 'R20W2Z': [switchEndpoint('l1'), switchEndpoint('l2')], 'SW21': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low], 'SE21': [cfg.sensor_action], 'LH-990ZB': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], @@ -1559,27 +1365,18 @@ const manualMaping = { 'E1E-G7F': [cfg.sensor_action], 'LH-990F': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'QBKG25LM': [switchEndpoint('left'), switchEndpoint('center'), switchEndpoint('right'), cfg.sensor_action], - 'QBKG26LM': [switchEndpoint('left'), switchEndpoint('center'), switchEndpoint('right')], 'QBKG23LM': [cfg.switch, cfg.sensor_power, cfg.sensor_temperature], 'QBKG24LM': [switchEndpoint('left'), switchEndpoint('right'), cfg.sensor_power], - 'WS-USC01': [cfg.switch], - 'WS-USC02': [switchEndpoint('top'), switchEndpoint('bottom')], - 'WS-USC04': [switchEndpoint('top'), switchEndpoint('bottom')], '100.462.31': [cfg.sensor_action], 'SN10ZW': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'AU-A1ZBPIAB': [cfg.switch, cfg.sensor_voltage, cfg.sensor_current, cfg.sensor_power], 'AU-A1ZBDWS': [cfg.binary_sensor_contact, cfg.sensor_battery], '4058075816459': [cfg.sensor_action, cfg.sensor_battery], - '14592.0': [cfg.switch], 'SAGE206612': [cfg.sensor_action, cfg.sensor_battery], - 'TI0001-switch': [cfg.switch], - 'TI0001-socket': [cfg.switch], '160-01': [cfg.switch, cfg.sensor_power], 'ZS232000178': [cfg.sensor_action], - 'ZS190000118 ': [cfg.switch], 'mcdj3aq': [cfg.cover_position], 'DIYRuZ_Geiger': [cfg.sensor_radioactive_events_per_minute, cfg.sensor_radiation_dose_per_hour, cfg.sensor_action], - '12127': [switchEndpoint('l1'), switchEndpoint('l2')], 'SWO-MOS1PA': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'STS-IRM-251': [cfg.sensor_temperature, cfg.binary_sensor_occupancy, cfg.sensor_battery], 'WSDCGQ12LM': [cfg.sensor_temperature, cfg.sensor_pressure, cfg.sensor_humidity, cfg.sensor_battery], @@ -1591,10 +1388,6 @@ const manualMaping = { cfg.sensor_battery, cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_pressure, cfg.sensor_illuminance, cfg.sensor_illuminance_lux, cfg.binary_sensor_occupancy, cfg.switch, ], - 'DIYRuZ_R8_8': [ - switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3'), switchEndpoint('l4'), - switchEndpoint('l5'), switchEndpoint('l6'), switchEndpoint('l7'), switchEndpoint('l8'), - ], 'DIYRuZ_RT': [cfg.switch, cfg.sensor_temperature], '99100-006': [cfg.lock, cfg.sensor_battery], 'SPE600': [cfg.switch, cfg.sensor_power], @@ -1602,54 +1395,31 @@ const manualMaping = { '067694': [cfg.sensor_action, cfg.sensor_battery], '170-33505': [cfg.switch, cfg.sensor_voltage, cfg.sensor_current, cfg.sensor_power], 'YRL-220L': [cfg.lock, cfg.sensor_battery], - 'TS0115': [ - switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3'), switchEndpoint('l4'), - switchEndpoint('l5'), - ], 'WL4200': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low], - 'LXN59-2S7LX1.0': [switchEndpoint('left'), switchEndpoint('right')], - 'X711A': [cfg.switch], - 'X712A': [switchEndpoint('l1'), switchEndpoint('l2')], - 'X713A': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')], - 'TYZS1L': [cfg.light_colorhs], - '43102': [cfg.switch], 'ROB_200-010-0': [cfg.cover_position], 'AM25': [cfg.cover_position, cfg.sensor_battery], - '43076': [cfg.switch], - 'ZSTY-SM-11ZG-US-W': [cfg.switch], 'ZSTY-SM-1CTZG-US-W': [cfg.cover_position], 'SNTZ009': [cfg.binary_sensor_water_leak], 'NAS-AB02B0': [ cfg.sensor_temperature, cfg.sensor_humidity, cfg.binary_sensor_humidity_alarm, cfg.binary_sensor_temperature_alarm, cfg.binary_sensor_alarm, ], - 'TS0004': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3'), switchEndpoint('l4')], 'U86KWF-ZPSJ': [climate(5, 30, 'current_heating_setpoint', 0.5)], 'D3-DPWK-TY': [climate(5, 30, 'current_heating_setpoint', 0.5)], - '98423051': [cfg.switch], 'TS0215A': [cfg.sensor_battery, cfg.sensor_action], - 'GWA1521': [cfg.switch], - 'GWA1522': [switchEndpoint('l1'), switchEndpoint('l2')], 'GWA1531': [cfg.cover_position], 'TPZRCO2HT-Z3': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery, cfg.sensor_co2], - '43100': [cfg.switch], '3400-D': [cfg.sensor_action, cfg.sensor_battery], - 'TS0121_switch': [cfg.switch], 'ED-10011': [cfg.sensor_action], 'ED-10012': [cfg.sensor_action], - 'QS-Zigbee-S04-2C-LN': [switchEndpoint('l1'), switchEndpoint('l2')], - 'SM308': [cfg.switch], 'SR-ZG9001T4-DIM-EU': [cfg.sensor_action], 'MEG5113-0300/MEG5165-0000': [cfg.cover_position], - '43084': [cfg.switch], 'WSP404': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], - '8718699689308': [cfg.switch], '07047L': [ cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low, cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_illuminance, cfg.sensor_illuminance_lux, ], 'BHT-002-GCLZB': [cfg.lock_child_lock, climate(5, 30, 'current_heating_setpoint', 1)], - 'E220-KR4N0Z0-HA': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3'), switchEndpoint('l4')], '11830304': [cfg.cover_position], '99100-045': [cfg.lock, cfg.sensor_battery], 'QZR-ZIG2400': [], @@ -1658,11 +1428,8 @@ const manualMaping = { 'LeTV.8KEY': [cfg.sensor_action], 'TS0044': [cfg.sensor_action, cfg.sensor_battery], 'HS2CM-N-DC': [cfg.cover_position], - 'ZS190000118': [cfg.switch], 'ZG2835': [cfg.sensor_action], 'CTR.UBX': [cfg.sensor_action], - 'WS-USC03': [cfg.switch], - 'TS0601_switch_3_gang': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')], '4655BC0-R': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], }; @@ -1727,6 +1494,18 @@ class HomeAssistant extends Extension { state_topic_postfix: expose.endpoint ? expose.endpoint : undefined, }, }; + } else if (expose.type === 'switch') { + discoveryEntry = { + type: 'switch', + object_id: expose.endpoint ? `switch_${expose.endpoint}` : 'switch', + discovery_payload: { + payload_off: 'OFF', + payload_on: 'ON', + value_template: `{{ value_json.state${expose.endpoint ? `_${expose.endpoint}` : ''} }}`, + command_topic: true, + command_topic_prefix: expose.endpoint ? expose.endpoint : undefined, + }, + }; } assert(discoveryEntry !== null, `Unsupported expose for '${def.model}': ${stringify(expose)}`);