From da1ade731c2517091699b4766f830d1059dbe2e8 Mon Sep 17 00:00:00 2001 From: jonyii Date: Sat, 9 Nov 2019 00:22:17 +0100 Subject: [PATCH] Fix SeaPressure unit for HASS autodiscovery --- tasmota/xdrv_12_home_assistant.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index ce51e978e..8cfe4ecde 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -96,7 +96,7 @@ const char HASS_DISCOVER_SENSOR_HUM[] PROGMEM = const char HASS_DISCOVER_SENSOR_PRESS[] PROGMEM = ",\"unit_of_meas\":\"%s\"," // PressureUnit() setting - "\"val_tpl\":\"{{value_json['%s'].Pressure}}\"," // "BME280":{"Temperature":19.7,"Humidity":27.8,"Pressure":990.1} -> {{ value_json['BME280'].Pressure }} + "\"val_tpl\":\"{{value_json['%s'].%s}}\"," // "BME280":{"Temperature":19.7,"Humidity":27.8,"Pressure":990.1} -> {{ value_json['BME280'].Pressure }} "\"dev_cla\":\"pressure\""; // pressure //ENERGY @@ -448,8 +448,9 @@ void HAssAnnounceSensor(const char* sensorname, const char* subsensortype) TryResponseAppend_P(HASS_DISCOVER_SENSOR_TEMP, TempUnit(), sensorname); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_HUMIDITY))) { TryResponseAppend_P(HASS_DISCOVER_SENSOR_HUM, sensorname); - } else if (!strcmp_P(subsensortype, PSTR(D_JSON_PRESSURE))) { - TryResponseAppend_P(HASS_DISCOVER_SENSOR_PRESS, PressureUnit().c_str(), sensorname); + } else if (!strcmp_P(subsensortype, PSTR(D_JSON_PRESSURE)) + || !strcmp_P(subsensortype, PSTR(D_JSON_PRESSUREATSEALEVEL))) { + TryResponseAppend_P(HASS_DISCOVER_SENSOR_PRESS, PressureUnit().c_str(), sensorname, subsensortype); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_TOTAL)) || !strcmp_P(subsensortype, PSTR(D_JSON_TODAY)) || !strcmp_P(subsensortype, PSTR(D_JSON_YESTERDAY))){