mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
@@ -9,7 +9,8 @@
|
||||
- Add RC300 second summermode telegram [#108](https://github.com/emsesp/EMS-ESP32/issues/108)
|
||||
- Add support for the RC25 thermostat [#106](https://github.com/emsesp/EMS-ESP32/issues/106)
|
||||
- Add new command 'entities' for a device, e.g. http://ems-esp/api/boiler/entities to show the shortname, description and HA Entity name (if HA enabled) [#116](https://github.com/emsesp/EMS-ESP32/issues/116)
|
||||
- Junkers program and remote (fb10/fb110) temperature
|
||||
- Support for Junkers program and remote (fb10/fb110) temperature
|
||||
- Home Assistant `state_class` attribute for Wh, kWh, W and KW [#129](https://github.com/emsesp/EMS-ESP32/issues/129)
|
||||
|
||||
## Fixed
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
- rename `fastheatupfactor` to `fastheatup` and add percent [#122]
|
||||
- "unit" renamed to "uom" in API call to recall a Device Value
|
||||
- initial backend React changes to replace the class components (HOCs) with React Hooks
|
||||
- program-names instead of numbers
|
||||
- Use program-names instead of numbers
|
||||
|
||||
## **BREAKING CHANGES**
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ my_build_flags =
|
||||
; upload_port = 10.10.10.101
|
||||
|
||||
; to prevent the web UI from building each time, comment out this next line
|
||||
extra_scripts =
|
||||
extra_scripts = scripts/rename_fw.py ; don't build WebUI
|
||||
|
||||
; pio run -e debug
|
||||
; or from Visual Studio Code do PIO -> Project Tasks -> debug -> General -> Upload and Monitor
|
||||
|
||||
@@ -1051,7 +1051,7 @@ bool EMSdevice::generate_values_json(JsonObject & root, const uint8_t tag_filter
|
||||
void EMSdevice::publish_mqtt_ha_sensor() {
|
||||
for (auto & dv : devicevalues_) {
|
||||
if (dv.ha == DeviceValueHA::HA_VALUE) {
|
||||
Mqtt::publish_ha_sensor(dv.type, dv.tag, dv.full_name, device_type_, dv.short_name, dv.uom);
|
||||
Mqtt::publish_ha_sensor(dv.type, dv.tag, dv.full_name, dv.device_type, dv.short_name, dv.uom, dv.has_cmd);
|
||||
dv.ha |= DeviceValueHA::HA_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
42
src/mqtt.cpp
42
src/mqtt.cpp
@@ -721,7 +721,7 @@ void Mqtt::ha_status() {
|
||||
DeviceValueUOM::PERCENT);
|
||||
}
|
||||
|
||||
publish_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Uptime"), EMSdevice::DeviceType::SYSTEM, F("uptime"));
|
||||
publish_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Uptime"), EMSdevice::DeviceType::SYSTEM, F("uptime"), DeviceValueUOM::NONE);
|
||||
publish_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Uptime (sec)"), EMSdevice::DeviceType::SYSTEM, F("uptime_sec"), DeviceValueUOM::SECONDS);
|
||||
publish_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Free memory"), EMSdevice::DeviceType::SYSTEM, F("freemem"), DeviceValueUOM::KB);
|
||||
publish_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("# MQTT fails"), EMSdevice::DeviceType::SYSTEM, F("mqttfails"), DeviceValueUOM::NONE);
|
||||
@@ -929,7 +929,8 @@ void Mqtt::publish_ha_sensor(uint8_t type, // EMSdevice::Dev
|
||||
const __FlashStringHelper * name,
|
||||
const uint8_t device_type, // EMSdevice::DeviceType
|
||||
const __FlashStringHelper * entity,
|
||||
const uint8_t uom) { // EMSdevice::DeviceValueUOM (0=NONE)
|
||||
const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE)
|
||||
const bool has_cmd) {
|
||||
// ignore if name (fullname) is empty
|
||||
if (name == nullptr) {
|
||||
return;
|
||||
@@ -1002,8 +1003,8 @@ void Mqtt::publish_ha_sensor(uint8_t type, // EMSdevice::Dev
|
||||
// normal HA sensor, not a boolean one
|
||||
snprintf(topic, sizeof(topic), "sensor/%s/%s/config", mqtt_base_.c_str(), uniq.c_str()); // topic
|
||||
|
||||
uint8_t set_state_class = 0;
|
||||
enum uint8_t { MEASURE = 1, TOTAL };
|
||||
enum uint8_t { STATE_CLASS_NONE, STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL_INCREASING };
|
||||
uint8_t set_state_class = STATE_CLASS_NONE; // default
|
||||
|
||||
// unit of measure and map the HA icon
|
||||
if (uom != DeviceValueUOM::NONE) {
|
||||
@@ -1012,12 +1013,10 @@ void Mqtt::publish_ha_sensor(uint8_t type, // EMSdevice::Dev
|
||||
|
||||
switch (uom) {
|
||||
case DeviceValueUOM::DEGREES:
|
||||
doc["ic"] = F_(icondegrees);
|
||||
set_state_class = MEASURE;
|
||||
doc["ic"] = F_(icondegrees);
|
||||
break;
|
||||
case DeviceValueUOM::PERCENT:
|
||||
doc["ic"] = F_(iconpercent);
|
||||
set_state_class = MEASURE;
|
||||
doc["ic"] = F_(iconpercent);
|
||||
break;
|
||||
case DeviceValueUOM::SECONDS:
|
||||
case DeviceValueUOM::MINUTES:
|
||||
@@ -1028,26 +1027,23 @@ void Mqtt::publish_ha_sensor(uint8_t type, // EMSdevice::Dev
|
||||
doc["ic"] = F_(iconkb);
|
||||
break;
|
||||
case DeviceValueUOM::LMIN:
|
||||
doc["ic"] = F_(iconlmin);
|
||||
set_state_class = MEASURE;
|
||||
doc["ic"] = F_(iconlmin);
|
||||
break;
|
||||
case DeviceValueUOM::WH:
|
||||
case DeviceValueUOM::KWH:
|
||||
doc["ic"] = F_(iconkwh);
|
||||
set_state_class = TOTAL;
|
||||
set_state_class = STATE_CLASS_TOTAL_INCREASING;
|
||||
break;
|
||||
case DeviceValueUOM::UA:
|
||||
doc["ic"] = F_(iconua);
|
||||
set_state_class = MEASURE;
|
||||
doc["ic"] = F_(iconua);
|
||||
break;
|
||||
case DeviceValueUOM::BAR:
|
||||
doc["ic"] = F_(iconbar);
|
||||
set_state_class = MEASURE;
|
||||
doc["ic"] = F_(iconbar);
|
||||
break;
|
||||
case DeviceValueUOM::W:
|
||||
case DeviceValueUOM::KW:
|
||||
doc["ic"] = F_(iconkw);
|
||||
set_state_class = MEASURE;
|
||||
set_state_class = STATE_CLASS_MEASUREMENT;
|
||||
break;
|
||||
case DeviceValueUOM::DBM:
|
||||
doc["ic"] = F_(icondbm);
|
||||
@@ -1055,18 +1051,20 @@ void Mqtt::publish_ha_sensor(uint8_t type, // EMSdevice::Dev
|
||||
case DeviceValueUOM::NONE:
|
||||
if (type == DeviceValueType::INT || type == DeviceValueType::UINT || type == DeviceValueType::SHORT || type == DeviceValueType::USHORT
|
||||
|| type == DeviceValueType::ULONG) {
|
||||
doc["ic"] = F_(iconnum);
|
||||
set_state_class = TOTAL;
|
||||
doc["ic"] = F_(iconnum);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// see if we need to set the state_class
|
||||
if (set_state_class == MEASURE) {
|
||||
doc["state_class"] = F("measurement");
|
||||
} else if (set_state_class == TOTAL) {
|
||||
doc["state_class"] = F("total_increasing");
|
||||
// ignore any commands
|
||||
if (!has_cmd) {
|
||||
if (set_state_class == STATE_CLASS_MEASUREMENT) {
|
||||
doc["state_class"] = F("measurement");
|
||||
} else if (set_state_class == STATE_CLASS_TOTAL_INCREASING) {
|
||||
doc["state_class"] = F("total_increasing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,8 @@ class Mqtt {
|
||||
const __FlashStringHelper * name,
|
||||
const uint8_t device_type,
|
||||
const __FlashStringHelper * entity,
|
||||
const uint8_t uom = 0);
|
||||
const uint8_t uom,
|
||||
const bool has_cmd = false);
|
||||
static void register_command(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_p cb, uint8_t flags = 0);
|
||||
|
||||
static void show_topic_handlers(uuid::console::Shell & shell, const uint8_t device_type);
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.2.2b8"
|
||||
#define EMSESP_APP_VERSION "3.2.2b10"
|
||||
|
||||
Reference in New Issue
Block a user