ptvo.switch - updated HA integration settings. (#3880)

* ptvo.switch - updated HA integration settings.

* Update homeassistant.js

Co-authored-by: ptvoinfo <xagga@ya.ru>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
ptvo 2020-07-09 22:10:10 +03:00 committed by GitHub
parent c72ccf1bd7
commit 4fbfec3fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'),