Merge pull request #7311 from effelle/development

ADC0 Moisture discovery for HA
This commit is contained in:
Theo Arends 2019-12-24 17:26:03 +01:00 committed by GitHub
commit 75a62cd3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -100,6 +100,12 @@ const char HASS_DISCOVER_SENSOR_HUM[] PROGMEM =
"\"val_tpl\":\"{{value_json['%s'].Humidity}}\"," // "SI7021-14":{"Temperature":null,"Humidity":null} -> {{ value_json['SI7021-14'].Humidity }}
"\"dev_cla\":\"humidity\""; // humidity
const char HASS_DISCOVER_SENSOR_MOIST[] PROGMEM =
",\"unit_of_meas\":\"%%\"," // %
"\"val_tpl\":\"{{value_json['%s'].Moisture}}\"," // "ANALOG":{"Moisture":78} -> {{ value_json['ANALOG'].Moisture }}
"\"dev_cla\":\"humidity\"," // humidity
"\"ic\":\"mdi:cup-water\""; // cup-water icon
const char HASS_DISCOVER_SENSOR_PRESS[] PROGMEM =
",\"unit_of_meas\":\"%s\"," // PressureUnit() setting
"\"val_tpl\":\"{{value_json['%s'].%s}}\"," // "BME280":{"Temperature":19.7,"Humidity":27.8,"Pressure":990.1} -> {{ value_json['BME280'].Pressure }}
@ -473,6 +479,8 @@ void HAssAnnounceSensor(const char* sensorname, const char* subsensortype)
TryResponseAppend_P(HASS_DISCOVER_SENSOR_AMPERE, sensorname, subsensortype);
} else if (!strcmp_P(subsensortype, PSTR(D_JSON_ILLUMINANCE))){
TryResponseAppend_P(HASS_DISCOVER_SENSOR_ILLUMINANCE, sensorname, subsensortype);
} else if (!strcmp_P(subsensortype, PSTR(D_JSON_MOISTURE))){
TryResponseAppend_P(HASS_DISCOVER_SENSOR_MOIST, sensorname, subsensortype);
} else {
if (is_sensor){
TryResponseAppend_P(PSTR(",\"unit_of_meas\":\" \"")); // " " As unit of measurement to get a value graph (not available for binary sensors)