diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index a67ca648a..c608d764b 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -311,15 +311,6 @@ const cfg = { value_template: '{{ value_json.temperature }}', }, }, - 'sensor_soil_moisture': { - type: 'sensor', - object_id: 'soil_moisture', - discovery_payload: { - unit_of_measurement: '%', - icon: 'mdi:water-percent', - value_template: '{{ value_json.soil_moisture }}', - }, - }, 'sensor_device_temperature': { type: 'sensor', object_id: 'device_temperature', @@ -918,32 +909,13 @@ const manualMaping = { 'STS-PRS-251': [cfg.binary_sensor_presence, cfg.sensor_battery], 'STSS-PRES-001': [cfg.binary_sensor_presence, cfg.sensor_battery], 'HS1SA': [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], 'HS3SA': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low], - 'HS1DS/HS3DS': [cfg.binary_sensor_contact], - 'HS3DS': [ - cfg.binary_sensor_contact, cfg.sensor_battery, cfg.binary_sensor_battery_low, - cfg.binary_sensor_tamper], - 'HS1WL/HS3WL': [cfg.binary_sensor_water_leak], - 'HS1-WL-E': [cfg.binary_sensor_water_leak], - 'HS1WL-N': [ - cfg.binary_sensor_water_leak, cfg.sensor_battery, cfg.binary_sensor_battery_low, - cfg.binary_sensor_tamper], - 'HS1VS-N': [ - cfg.binary_sensor_vibration, cfg.sensor_battery, cfg.binary_sensor_battery_low, - cfg.binary_sensor_tamper], '3321-S': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery], - 'ZPIR-8000': [cfg.binary_sensor_occupancy, cfg.sensor_battery], - '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], 'AIRAM-CTR.U': [], @@ -951,7 +923,6 @@ const manualMaping = { 'E1524/E1810': [cfg.sensor_action, cfg.sensor_battery], 'AC0251100NJ/AC0251700NJ': [cfg.sensor_action, cfg.sensor_battery], 'MLI-404011': [cfg.sensor_action], - 'HS1DS-E': [cfg.binary_sensor_contact], 'SP600': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], '1613V': [cfg.switch, cfg.sensor_power], 'SPZB0001': [climate(5, 30, 'current_heating_setpoint', 0.5), cfg.sensor_battery], @@ -961,7 +932,6 @@ const manualMaping = { 'RADON TriTech ZB': [ cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_battery_low, ], - 'E1746': [], 'YRD426NRSC': [cfg.lock, cfg.sensor_battery], 'BE468': [cfg.lock, cfg.sensor_battery], 'YRD246HA20BP': [cfg.lock, cfg.sensor_battery], @@ -1029,7 +999,6 @@ const manualMaping = { ], 'HGZB-1S': [cfg.switch, cfg.sensor_click, cfg.sensor_action], 'HGZB-045': [cfg.switch, cfg.sensor_click, cfg.sensor_action], - 'MCT-350 SMA': [cfg.binary_sensor_contact], '3310-S': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'IM6001-WLP01': [ cfg.sensor_temperature, cfg.binary_sensor_water_leak, @@ -1051,12 +1020,10 @@ const manualMaping = { 'HGZB-02S': [cfg.sensor_click, cfg.sensor_action, cfg.switch], 'IM6001-MTP01': [cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_occupancy], '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, ], - '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], '45853GE': [cfg.switch, cfg.sensor_power], @@ -1070,9 +1037,6 @@ const manualMaping = { 'V3-BTZB': [cfg.lock, cfg.sensor_battery], '3RSS008Z': [cfg.switch, cfg.sensor_battery], '99432': [cfg.fan, cfg.light_brightness], - 'IM6001-MPP01': [ - cfg.sensor_temperature, cfg.binary_sensor_contact, cfg.sensor_battery, - ], 'InstaRemote': [cfg.sensor_action], 'HS1CA-E': [ cfg.binary_sensor_carbon_monoxide, cfg.binary_sensor_battery_low, @@ -1085,15 +1049,11 @@ const manualMaping = { '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], - '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], 'HS1CA-M': [cfg.binary_sensor_carbon_monoxide, cfg.binary_sensor_battery_low], '12031': [cfg.cover_position], 'LS12128': [cfg.cover_position], - 'HS2WD-E': [cfg.sensor_battery], 'ZNMS12LM': [ cfg.sensor_action, cfg.binary_sensor_lock, cfg.binary_sensor_lock_reverse, cfg.sensor_battery, @@ -1109,7 +1069,6 @@ const manualMaping = { '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], 'TH1123ZB': [ climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_local_temperature, cfg.lock_keypad_lockout, cfg.sensor_power, cfg.sensor_energy, @@ -1167,13 +1126,9 @@ const manualMaping = { '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], - 'ZWLD-100': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low, cfg.sensor_battery], 'YRD226/246 TSDB': [cfg.lock, cfg.sensor_battery], '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], 'TERNCY-PP01': [ cfg.sensor_temperature, cfg.binary_sensor_occupancy, cfg.sensor_illuminance, cfg.sensor_illuminance_lux, cfg.sensor_click, cfg.sensor_action, @@ -1182,12 +1137,8 @@ const manualMaping = { 'STS-OUT-US-2': [cfg.switch, cfg.sensor_power], 'UK7004240': [climate(), cfg.sensor_battery], '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], - '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], 'DIYRuZ_rspm': [cfg.switch, cfg.sensor_action, cfg.sensor_power, cfg.sensor_current], @@ -1205,18 +1156,11 @@ const manualMaping = { 'TS0041': [cfg.sensor_action, cfg.sensor_battery], 'SP-EUC01': [cfg.switch, cfg.sensor_power], '6735/6736/6737': [cfg.switch, cfg.sensor_action], - 'SZ-SRN12N': [], '9GED18000-009': [cfg.lock, cfg.sensor_battery], '9GED21500-005': [cfg.lock, cfg.sensor_battery], - 'MP-841': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], - 'MCT-370 SMA': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], - 'SOHM-I1': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], - 'SWHM-I1': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low], - '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], 'LVS-SC7': [cfg.sensor_action], - 'E1D-G73WNA': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], 'WV704R0A0902': [climate()], '067776': [cfg.cover_position], '067773': [cfg.sensor_action, cfg.sensor_battery], @@ -1242,7 +1186,6 @@ const manualMaping = { 'GZCGQ01LM': [cfg.sensor_battery, cfg.sensor_illuminance, cfg.sensor_illuminance_lux], 'U86KCJ-ZP': [cfg.sensor_action], 'HS1HT': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], - 'HS1HT-N': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'HS2ESK-E': [cfg.switch, cfg.sensor_power], 'HS2AQ-EM': [ cfg.sensor_battery, cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery_state, @@ -1251,14 +1194,11 @@ const manualMaping = { 'HS2IRC': [cfg.sensor_battery], 'B01M7Y8BP9': [cfg.sensor_action], '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], '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': [], '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], @@ -1269,14 +1209,12 @@ const manualMaping = { 'SNZB-02': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'SNZB-03': [cfg.binary_sensor_occupancy, cfg.sensor_battery], '07046L': [cfg.sensor_action], - '07045L': [cfg.binary_sensor_contact, cfg.binary_sensor_tamper, cfg.binary_sensor_battery_low], 'TERNCY-SD01': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action, cfg.sensor_direction], '07048L': [cfg.switch, cfg.sensor_power], 'ICZB-KPD14S': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action], '73743': [cfg.sensor_action, cfg.sensor_battery], 'C4': [cfg.sensor_action], '66492-001': [cfg.lock, cfg.sensor_battery], - 'SM10ZW': [cfg.binary_sensor_contact, cfg.sensor_battery], '4512703': [cfg.sensor_action, cfg.sensor_battery], '4512721': [cfg.sensor_action, cfg.sensor_battery], '4512702': [cfg.sensor_action, cfg.sensor_battery], @@ -1287,9 +1225,6 @@ const manualMaping = { switchEndpoint('left'), switchEndpoint('right'), switchEndpoint('center'), cfg.sensor_device_temperature, ], - 'MCLH-07': [cfg.binary_sensor_water_leak, cfg.sensor_battery], - '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], 'ZHS-15': [cfg.switch, cfg.sensor_power, cfg.sensor_current, cfg.sensor_voltage], 'GS361A-H04': [ @@ -1310,13 +1245,10 @@ const manualMaping = { cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery, ], 'SEB01ZB': [cfg.binary_sensor_sos, cfg.sensor_battery], - 'SBM01ZB': [cfg.binary_sensor_occupancy, cfg.sensor_battery], 'STH01ZB': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'SSA01ZB': [cfg.binary_sensor_smoke, cfg.sensor_battery], 'SCA01ZB': [cfg.binary_sensor_carbon_monoxide, cfg.sensor_battery], '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], '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], @@ -1330,7 +1262,6 @@ const manualMaping = { ['auto', 'on', 'smart'], [], true, true)], '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], 'MOT003': [cfg.binary_sensor_occupancy, cfg.sensor_temperature, cfg.sensor_battery, cfg.binary_sensor_battery_low], 'AU-A1ZBPIA': [cfg.switch, cfg.sensor_power, cfg.sensor_voltage, cfg.sensor_current], 'GreenPower_On_Off_Switch': [cfg.sensor_action], @@ -1353,54 +1284,38 @@ const manualMaping = { 'WXKG07LM': [cfg.sensor_action, cfg.sensor_battery], 'MCLH-03': [cfg.switch, cfg.sensor_voltage, cfg.sensor_power, cfg.sensor_current], '752189': [cfg.sensor_action, cfg.sensor_battery], - 'XBee': [], - 'ZBHT-1': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], 'MCLH-05': [cfg.binary_sensor_occupancy, cfg.sensor_battery], '5AA-SS-ZA-H0': [cfg.binary_sensor_occupancy, cfg.sensor_illuminance, cfg.sensor_illuminance_lux], - 'MOSZB-130': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], 'AU-A1ZBRC': [cfg.sensor_action, cfg.sensor_battery], - 'AU-A1ZBPIRS': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low, cfg.sensor_illuminance_lux], 'TS0121_plug': [cfg.switch, cfg.sensor_voltage, cfg.sensor_power, cfg.sensor_current], '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], - 'SLT2': [], - 'SLB2': [], '8840100H': [cfg.binary_sensor_water_leak, cfg.sensor_temperature, cfg.sensor_battery], - '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], '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], 'W40CZ': [cfg.cover_position], - '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], - 'HO-09ZB': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], '500.67': [cfg.sensor_action], '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], 'QBKG23LM': [cfg.switch, cfg.sensor_power, cfg.sensor_temperature], 'QBKG24LM': [switchEndpoint('left'), switchEndpoint('right'), cfg.sensor_power], '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], 'SAGE206612': [cfg.sensor_action, cfg.sensor_battery], '160-01': [cfg.switch, cfg.sensor_power], 'ZS232000178': [cfg.sensor_action], 'mcdj3aq': [cfg.cover_position], 'DIYRuZ_Geiger': [cfg.sensor_radioactive_events_per_minute, cfg.sensor_radiation_dose_per_hour, cfg.sensor_action], - '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], 'SJCGQ12LM': [cfg.sensor_battery, cfg.binary_sensor_water_leak], 'DJT12LM': [cfg.sensor_action], 'AV2010/22A': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], - 'RS-23ZBS': [cfg.sensor_temperature, cfg.sensor_humidity], 'KMPCIL_RES005': [ 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, @@ -1412,7 +1327,6 @@ 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], - 'WL4200': [cfg.binary_sensor_water_leak, cfg.binary_sensor_battery_low], 'ROB_200-010-0': [cfg.cover_position], 'AM25': [cfg.cover_position, cfg.sensor_battery], 'ZSTY-SM-1CTZG-US-W': [cfg.cover_position], @@ -1432,10 +1346,6 @@ const manualMaping = { 'SR-ZG9001T4-DIM-EU': [cfg.sensor_action], 'MEG5113-0300/MEG5165-0000': [cfg.cover_position], 'WSP404': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], - '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), @@ -1444,19 +1354,11 @@ const manualMaping = { '99100-045': [cfg.lock, cfg.sensor_battery], 'QZR-ZIG2400': [], 'HDM40PV620': [cfg.cover_position], - 'TS0207_repeater': [], 'LeTV.8KEY': [cfg.sensor_action], 'TS0044': [cfg.sensor_action, cfg.sensor_battery], 'HS2CM-N-DC': [cfg.cover_position], 'ZG2835': [cfg.sensor_action], 'CTR.UBX': [cfg.sensor_action], - '4655BC0-R': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low], - 'STSS-IRM-001': [cfg.binary_sensor_occupancy, cfg.binary_sensor_battery_low], - 'DIYRuZ_Flower': [ - cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_illuminance, cfg.sensor_pressure, - cfg.sensor_battery, cfg.sensor_soil_moisture, - ], - 'SLT3': [], 'SLR2': [ climate(7, 30, 'occupied_heating_setpoint', 1, ['off', 'auto', 'heat'], [], [], false, false, 'heat'), climate(7, 30, 'occupied_heating_setpoint', 1, ['off', 'auto', 'heat'], [], [], false, false, 'cool'), @@ -1536,6 +1438,52 @@ class HomeAssistant extends Extension { command_topic_prefix: expose.endpoint ? expose.endpoint : undefined, }, }; + } else if (expose.type === 'boolean') { + const lookup = { + occupancy: {payload_on: true, payload_off: false, device_class: 'motion'}, + battery_low: {payload_on: true, payload_off: false, device_class: 'battery'}, + tamper: {payload_on: true, payload_off: false}, + water_leak: {payload_on: true, payload_off: false, device_class: 'moisture'}, + vibration: {payload_on: true, payload_off: false, device_class: 'vibration'}, + contact: {payload_on: false, payload_off: true, device_class: 'door'}, + }; + + assert(!expose.endpoint, `Endpoint not supported for boolean type`); + assert(lookup[expose.property], `${expose.property} not in lookup`); + + discoveryEntry = { + type: 'binary_sensor', + object_id: expose.property, + discovery_payload: { + value_template: `{{ value_json.${expose.property} }}`, + ...lookup[expose.property], + }, + }; + } else if (expose.type === 'numeric') { + const lookup = { + battery: {device_class: 'battery'}, + temperature: {device_class: 'temperature'}, + humidity: {device_class: 'humidity'}, + illuminance_lux: {device_class: 'illuminance'}, + illuminance: {device_class: 'illuminance'}, + soil_moisture: {icon: 'mdi:water-percent'}, + pressure: {device_class: 'pressure'}, + }; + + assert(!expose.endpoint, `Endpoint not supported for numeric type`); + assert(lookup[expose.property], `${expose.property} not in lookup`); + + discoveryEntry = { + type: 'sensor', + object_id: expose.property, + discovery_payload: { + unit_of_measurement: expose.unit ? expose.unit : '-', + value_template: `{{ value_json.${expose.property} }}`, + ...lookup[expose.property], + }, + }; + } else { + throw new Error(`Unsupported exposes type: '${expose.type}'`); } assert(discoveryEntry !== null, `Unsupported expose for '${def.model}': ${stringify(expose)}`); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 8395c7d72..6d6c19d39 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -15837,9 +15837,9 @@ } }, "zigbee-herdsman-converters": { - "version": "12.0.202", - "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.202.tgz", - "integrity": "sha512-hcBvLFXqhJwPe/C+GAbPM4f2GrztHUSaiLytydPNNQ+FQ/pHSMuN+Tumg1vhfPBGWQh611FHw0XcOh/Af9cf7A==", + "version": "12.0.203", + "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.203.tgz", + "integrity": "sha512-Iy28X1/ULrpTBA2KFVvpSapRRHOsMZyniWuR5wzoVW4gvevdXwRV8u6z1V047w2P4jjSbNxxH1pTbEHFowfKPA==", "requires": { "axios": "^0.20.0", "buffer-crc32": "^0.2.13", diff --git a/package.json b/package.json index 5a6983e3b..780a8ab22 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "winston-syslog": "^2.4.4", "ws": "^7.3.1", "zigbee-herdsman": "0.13.13", - "zigbee-herdsman-converters": "12.0.202", + "zigbee-herdsman-converters": "12.0.203", "zigbee2mqtt-frontend": "0.2.24" }, "devDependencies": {