diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index 7ce2cf3f9..fdf75966a 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -95,36 +95,6 @@ const cfg = { device_class: 'vibration', }, }, - 'binary_sensor_smoke': { - type: 'binary_sensor', - object_id: 'smoke', - discovery_payload: { - payload_on: true, - payload_off: false, - value_template: '{{ value_json.smoke }}', - device_class: 'smoke', - }, - }, - 'binary_sensor_gas': { - type: 'binary_sensor', - object_id: 'gas', - discovery_payload: { - payload_on: true, - payload_off: false, - value_template: '{{ value_json.gas }}', - device_class: 'gas', - }, - }, - 'binary_sensor_carbon_monoxide': { - type: 'binary_sensor', - object_id: 'carbon_monoxide', - discovery_payload: { - payload_on: true, - payload_off: false, - value_template: '{{ value_json.carbon_monoxide }}', - device_class: 'safety', - }, - }, 'binary_sensor_led': { type: 'binary_sensor', object_id: 'led', @@ -145,15 +115,6 @@ const cfg = { device_class: 'battery', }, }, - 'binary_sensor_moving': { - type: 'binary_sensor', - object_id: 'moving', - discovery_payload: { - payload_on: true, - payload_off: false, - value_template: '{{ value_json.moving}}', - }, - }, 'binary_sensor_update_available': { type: 'binary_sensor', object_id: 'update_available', @@ -601,45 +562,8 @@ const cfg = { optimistic: true, }, }, - 'cover_position': { - type: 'cover', - object_id: 'cover', - discovery_payload: { - command_topic: true, - position_topic: true, - set_position_topic: true, - set_position_template: '{ "position": {{ position }} }', - value_template: '{{ value_json.position }}', - state_topic: false, - }, - }, - 'cover_position_tilt': { - type: 'cover', - object_id: 'cover', - discovery_payload: { - state_topic: false, - command_topic: true, - set_position_topic: true, - set_position_template: '{ "position": {{ position }} }', - tilt_command_topic: true, - position_topic: true, - value_template: '{{ value_json.position }}', - tilt_status_topic: true, - tilt_status_template: '{{ value_json.tilt }}', - }, - }, // Lock - 'lock': { - type: 'lock', - object_id: 'lock', - discovery_payload: { - command_topic: true, - value_template: '{{ value_json.state }}', - state_locked: 'LOCK', - state_unlocked: 'UNLOCK', - }, - }, 'lock_keypad_lockout': { type: 'lock', object_id: 'keypad_lock', @@ -849,11 +773,6 @@ const manualMaping = { '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], - 'HS1SA': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low], - 'HS3SA': [cfg.binary_sensor_smoke, cfg.binary_sensor_battery_low], - '3321-S': [cfg.binary_sensor_contact, cfg.sensor_temperature, cfg.sensor_battery], - 'TS0601_curtain': [cfg.cover_position], - 'TS0601_curtain_switch': [cfg.cover_position], 'TS0003_curtain_switch': [cfg.cover], 'AV2010/25': [cfg.switch, cfg.sensor_power], '1TST-EU': [climate(), cfg.sensor_battery], @@ -865,9 +784,6 @@ const manualMaping = { 'SP600': [cfg.switch, cfg.sensor_power, cfg.sensor_energy], 'SPZB0001': [climate(5, 30, 'current_heating_setpoint', 0.5), cfg.sensor_battery], '81825': [cfg.sensor_action], - 'YRD426NRSC': [cfg.lock, cfg.sensor_battery], - 'BE468': [cfg.lock, cfg.sensor_battery], - 'YRD246HA20BP': [cfg.lock, cfg.sensor_battery], 'E1743': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_battery], '9290019758': [ cfg.binary_sensor_occupancy, cfg.sensor_temperature, @@ -883,46 +799,26 @@ const manualMaping = { cfg.sensor_requested_brightness_percent, ], 'ZYCT-202': [cfg.sensor_action], - '3300-S': [ - cfg.sensor_temperature, cfg.binary_sensor_contact, - cfg.sensor_battery, cfg.binary_sensor_battery_low, - ], 'IM6001-BTP01': [cfg.sensor_click, cfg.sensor_action, cfg.sensor_temperature, cfg.sensor_battery], 'AV2010/34': [cfg.sensor_click, cfg.sensor_action], 'PP-WHT-US': [ cfg.switch, cfg.sensor_power, cfg.sensor_current, cfg.sensor_voltage, ], - 'CR701-YZ': [ - cfg.binary_sensor_battery_low, cfg.binary_sensor_carbon_monoxide, - cfg.binary_sensor_gas, - ], 'HGZB-1S': [cfg.switch, cfg.sensor_click, cfg.sensor_action], 'HGZB-045': [cfg.switch, cfg.sensor_click, cfg.sensor_action], '3310-S': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery], - 'F-MLT-US-2': [ - cfg.sensor_temperature, cfg.binary_sensor_contact, - cfg.sensor_battery, cfg.binary_sensor_battery_low, cfg.binary_sensor_moving, - ], 'SWO-KEF1PA': [cfg.sensor_action], 'HGZB-02S': [cfg.sensor_click, cfg.sensor_action, cfg.switch], 'HS1RC-N': [cfg.sensor_action, cfg.sensor_battery], 'HS2SS': [cfg.sensor_action, cfg.sensor_battery], 'N2G-SP': [cfg.sensor_power, cfg.switch, cfg.sensor_energy], - 'SCM-5ZBS': [cfg.cover_position], - 'YRD226HA2619': [cfg.sensor_battery, cfg.lock], - 'YMF40/YDM4109+': [cfg.lock, cfg.sensor_battery], - 'V3-BTZB': [cfg.lock, cfg.sensor_battery], '99432': [cfg.fan, cfg.light_brightness], 'InstaRemote': [cfg.sensor_action], 'ZGRC-KEY-013': [cfg.sensor_click, cfg.sensor_action], - 'YRD256HA20BP': [cfg.sensor_battery, cfg.lock], 'SZ-ESW01-AU': [cfg.sensor_power, cfg.switch], - 'SCM-S1': [cfg.cover_position], 'MEAZON_BIZY_PLUG': [cfg.sensor_power, cfg.switch, cfg.sensor_temperature], 'MEAZON_DINRAIL': [cfg.sensor_power, cfg.switch, cfg.sensor_temperature], - '12031': [cfg.cover_position], - 'LS12128': [cfg.cover_position], 'ZNMS12LM': [ cfg.sensor_action, cfg.binary_sensor_lock, cfg.binary_sensor_lock_reverse, cfg.sensor_battery, @@ -966,19 +862,12 @@ const manualMaping = { 'DTB190502A1': [], 'ZWallRemote0': [cfg.sensor_click, cfg.sensor_action], 'D1': [cfg.light_brightness, cfg.sensor_power], - 'J1': [cfg.cover_position_tilt, cfg.sensor_power], 'Z3-1BRL': [cfg.sensor_action, cfg.sensor_brightness], 'ROB_200-008-0': [cfg.sensor_battery, cfg.sensor_click, cfg.sensor_action], 'SZ-ESW01': [cfg.switch, cfg.sensor_power], '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], 'E1766': [cfg.sensor_click, cfg.sensor_battery, cfg.sensor_action], 'DIYRuZ_magnet': [cfg.binary_sensor_contact, cfg.sensor_battery], - 'YRD210-HA-605': [cfg.lock, cfg.sensor_battery], - 'YRD220/YRD221': [cfg.lock, cfg.sensor_battery], - 'ZM-CSW032-D': [cfg.cover_position], - 'YRD226/246 TSDB': [cfg.lock, cfg.sensor_battery], 'E1744': [cfg.sensor_action, cfg.sensor_battery], 'TERNCY-PP01': [ cfg.sensor_temperature, cfg.binary_sensor_occupancy, cfg.sensor_illuminance, cfg.sensor_illuminance_lux, @@ -995,13 +884,10 @@ const manualMaping = { 'TS0043': [cfg.sensor_action, cfg.sensor_battery], 'TS0041': [cfg.sensor_action, cfg.sensor_battery], '6735/6736/6737': [cfg.switch, cfg.sensor_action], - '9GED18000-009': [cfg.lock, cfg.sensor_battery], - '9GED21500-005': [cfg.lock, cfg.sensor_battery], 'SKHMP30-I1': [cfg.switch, cfg.sensor_power], '6ARCZABZH': [cfg.sensor_battery, cfg.sensor_action], 'LVS-SC7': [cfg.sensor_action], 'WV704R0A0902': [climate()], - '067776': [cfg.cover_position], '067773': [cfg.sensor_action, cfg.sensor_battery], '064873': [cfg.sensor_action], 'K4003C/L4003C/N4003C/NT4003C': [cfg.switch, cfg.sensor_action], @@ -1023,10 +909,6 @@ const manualMaping = { '067775': [cfg.switch, cfg.sensor_power], '412015': [cfg.sensor_power, cfg.binary_sensor_power_alarm_active], 'U86KCJ-ZP': [cfg.sensor_action], - 'HS2AQ-EM': [ - cfg.sensor_battery, cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery_state, - cfg.sensor_voc, cfg.sensor_pm25, cfg.sensor_pm10, cfg.sensor_hcho, cfg.sensor_aqi, - ], 'HS2IRC': [cfg.sensor_battery], 'B01M7Y8BP9': [cfg.sensor_action], 'ZG2835RAC': [cfg.light_brightness, cfg.sensor_power, cfg.sensor_energy], @@ -1039,7 +921,6 @@ const manualMaping = { '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], '4512703': [cfg.sensor_action, cfg.sensor_battery], '4512721': [cfg.sensor_action, cfg.sensor_battery], '4512702': [cfg.sensor_action, cfg.sensor_battery], @@ -1068,7 +949,6 @@ const manualMaping = { '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], - '99140-002': [cfg.lock, cfg.sensor_battery], '4512706': [cfg.sensor_battery, cfg.sensor_action], 'RC-2000WH': [climate(10, 30, 'occupied_heating_setpoint', 1, ['off', 'auto', 'heat', 'cool'], ['auto', 'on', 'smart'], [], true, true)], @@ -1104,7 +984,6 @@ const manualMaping = { '8840100H': [cfg.binary_sensor_water_leak, cfg.sensor_temperature, cfg.sensor_battery], 'TERNCY-DC01': [cfg.sensor_temperature, cfg.binary_sensor_contact], 'DIYRuZ_FreePad': [cfg.sensor_action, cfg.sensor_battery], - 'W40CZ': [cfg.cover_position], 'SE21': [cfg.sensor_action], '500.67': [cfg.sensor_action], 'E1E-G7F': [cfg.sensor_action], @@ -1115,20 +994,14 @@ const manualMaping = { '4058075816459': [cfg.sensor_action, cfg.sensor_battery], 'SAGE206612': [cfg.sensor_action, cfg.sensor_battery], '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], 'DJT12LM': [cfg.sensor_action], '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, ], - '99100-006': [cfg.lock, cfg.sensor_battery], '067774': [cfg.sensor_action, cfg.sensor_battery], '067694': [cfg.sensor_action, cfg.sensor_battery], - 'YRL-220L': [cfg.lock, cfg.sensor_battery], - 'ROB_200-010-0': [cfg.cover_position], - 'AM25': [cfg.cover_position, cfg.sensor_battery], - '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, @@ -1137,20 +1010,15 @@ const manualMaping = { 'U86KWF-ZPSJ': [climate(5, 30, 'current_heating_setpoint', 0.5)], 'D3-DPWK-TY': [climate(5, 30, 'current_heating_setpoint', 0.5)], 'TS0215A': [cfg.sensor_battery, cfg.sensor_action], - 'GWA1531': [cfg.cover_position], 'TPZRCO2HT-Z3': [cfg.sensor_temperature, cfg.sensor_humidity, cfg.sensor_battery, cfg.sensor_co2], '3400-D': [cfg.sensor_action, cfg.sensor_battery], 'ED-10011': [cfg.sensor_action], 'ED-10012': [cfg.sensor_action], 'SR-ZG9001T4-DIM-EU': [cfg.sensor_action], - 'MEG5113-0300/MEG5165-0000': [cfg.cover_position], 'BHT-002-GCLZB': [ cfg.lock_child_lock, climate(5, 30, 'current_heating_setpoint', 1, ['off', 'heat'], [], ['hold', 'program']), ], - '11830304': [cfg.cover_position], - '99100-045': [cfg.lock, cfg.sensor_battery], 'QZR-ZIG2400': [], - 'HDM40PV620': [cfg.cover_position], 'LeTV.8KEY': [cfg.sensor_action], 'TS0044': [cfg.sensor_action, cfg.sensor_battery], 'ZG2835': [cfg.sensor_action], @@ -1162,7 +1030,6 @@ const manualMaping = { 'SEA801-Zigbee': [ climate(5, 30, 'current_heating_setpoint', 0.5, ['off', 'heat'], [], ['manual', 'program']), ], - 'TS0601_roller_blind': [cfg.cover_position], 'JS-SLK2-ZB': [cfg.sensor_action], 'TS0216': [cfg.sensor_battery], }; @@ -1246,6 +1113,18 @@ class HomeAssistant extends Extension { command_topic_prefix: expose.endpoint ? expose.endpoint : undefined, }, }; + } else if (expose.type === 'lock') { + assert(!expose.endpoint, `Endpoint not supported for lock type`); + discoveryEntry = { + type: 'lock', + object_id: 'lock', + discovery_payload: { + command_topic: true, + value_template: '{{ value_json.state }}', + state_locked: 'LOCK', + state_unlocked: 'UNLOCK', + }, + }; } else if (expose.type === 'cover') { assert(!expose.endpoint, `Endpoint not supported for cover type`); const hasPosition = expose.features.find((e) => e.name === 'position'); @@ -1285,6 +1164,7 @@ class HomeAssistant extends Extension { occupancy: {device_class: 'motion'}, battery_low: {device_class: 'battery'}, tamper: {}, + moving: {}, sos: {}, water_leak: {device_class: 'moisture'}, vibration: {device_class: 'vibration'}, @@ -1327,6 +1207,11 @@ class HomeAssistant extends Extension { energy: {icon: 'mdi:power-plug'}, smoke_density: {icon: 'mdi:google-circles-communities'}, gas_density: {icon: 'mdi:google-circles-communities'}, + pm25: {icon: 'mdi:air-filter'}, + pm10: {icon: 'mdi:air-filter'}, + voc: {icon: 'mdi:air-filter'}, + aqi: {icon: 'mdi:air-filter'}, + hcho: {icon: 'mdi:air-filter'}, }; assert(!expose.endpoint, `Endpoint not supported for numeric type`); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a7f544484..ed2c9bfdd 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -15887,9 +15887,9 @@ } }, "zigbee-herdsman-converters": { - "version": "12.0.215", - "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.215.tgz", - "integrity": "sha512-zZJnrluVPmPtqKPSjH74hg2D88POKNvYpH5j0TqaQnU0Fap1ruGX7WtEoVK8kP+HvQ4Tj9PCmlUx09oZZ1cCbQ==", + "version": "12.0.216", + "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.216.tgz", + "integrity": "sha512-JX1JF6/7FVEZdsT149sGVsH83k3MoiPhoJcbEpZkgtaKeNyyYqFa3h5ugWmodLJt0DUkN6I7CgNjeYxr7Z3GSw==", "requires": { "axios": "^0.20.0", "buffer-crc32": "^0.2.13", diff --git a/package.json b/package.json index c5dff7965..eb75863c0 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "winston-syslog": "^2.4.4", "ws": "^7.3.1", "zigbee-herdsman": "0.13.18", - "zigbee-herdsman-converters": "12.0.215", + "zigbee-herdsman-converters": "12.0.216", "zigbee2mqtt-frontend": "0.2.33" }, "devDependencies": {