diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index 116d17fd..9a8a4c3f 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -686,6 +686,16 @@ const lightEndpoint = (configType, endpointName) => { return config; }; +const sensorEndpoint = (endpointName) => { + return { + type: 'sensor', + object_id: `sensor_${endpointName}`, + discovery_payload: { + value_template: `{{ value_json.${endpointName} }}`, + }, + }; +}; + const thermostat = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heating_setpoint', tempStep=1) => { return { type: 'climate', @@ -1269,8 +1279,14 @@ const mapping = { 'PM-B530-ZB': [cfg.sensor_power, cfg.switch], 'PM-B430-ZB': [cfg.sensor_power, cfg.switch], 'ptvo.switch': [ - switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), switchEndpoint('top_left'), - switchEndpoint('top_right'), switchEndpoint('center'), cfg.sensor_click, + switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3'), + switchEndpoint('l4'), switchEndpoint('l5'), switchEndpoint('l6'), + switchEndpoint('l7'), switchEndpoint('l8'), + sensorEndpoint('l1'), sensorEndpoint('l2'), sensorEndpoint('l3'), + sensorEndpoint('l4'), sensorEndpoint('l5'), sensorEndpoint('l6'), + sensorEndpoint('l7'), sensorEndpoint('l8'), + cfg.sensor_click, cfg.sensor_temperature, cfg.sensor_voltage, + cfg.sensor_pressure, cfg.sensor_humidity, ], 'DIYRuZ_R4_5': [ switchEndpoint('bottom_left'), switchEndpoint('bottom_right'), switchEndpoint('top_left'),