Merge branch 'esp32_dev' of https://github.com/proddy/EMS-ESP into esp32_dev

This commit is contained in:
proddy
2021-03-09 23:25:37 +01:00
2 changed files with 17 additions and 9 deletions

View File

@@ -465,8 +465,8 @@ void Boiler::process_UBAMonitorSlowPlus(std::shared_ptr<const Telegram> telegram
void Boiler::process_UBAParametersPlus(std::shared_ptr<const Telegram> telegram) {
has_update(telegram->read_value(heatingActivated_, 0));
has_update(telegram->read_value(heatingTemp_, 1));
has_update(telegram->read_value(burnMaxPower_, 6));
has_update(telegram->read_value(burnMinPower_, 7));
has_update(telegram->read_value(burnMaxPower_, 4));
has_update(telegram->read_value(burnMinPower_, 5));
has_update(telegram->read_value(boilHystOff_, 8));
has_update(telegram->read_value(boilHystOn_, 9));
has_update(telegram->read_value(burnMinPeriod_, 10));
@@ -730,7 +730,7 @@ bool Boiler::set_min_power(const char * value, const int8_t id) {
LOG_INFO(F("Setting boiler min power to %d %%"), v);
if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) {
write_command(EMS_TYPE_UBAParametersPlus, 7, v, EMS_TYPE_UBAParametersPlus);
write_command(EMS_TYPE_UBAParametersPlus, 5, v, EMS_TYPE_UBAParametersPlus);
} else {
write_command(EMS_TYPE_UBAParameters, 3, v, EMS_TYPE_UBAParameters);
}
@@ -748,7 +748,7 @@ bool Boiler::set_max_power(const char * value, const int8_t id) {
LOG_INFO(F("Setting boiler max power to %d %%"), v);
if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) {
write_command(EMS_TYPE_UBAParametersPlus, 6, v, EMS_TYPE_UBAParametersPlus);
write_command(EMS_TYPE_UBAParametersPlus, 4, v, EMS_TYPE_UBAParametersPlus);
} else {
write_command(EMS_TYPE_UBAParameters, 2, v, EMS_TYPE_UBAParameters);
}

View File

@@ -862,11 +862,19 @@ void Mqtt::publish_mqtt_ha_sensor(uint8_t type, // EMSdevice
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/binary_sensor/%s/%s/config"), mqtt_base_.c_str(), uniq.c_str()); // topic
// how to render boolean
EMSESP::webSettingsService.read([&](WebSettings & settings) {
char result[10];
doc[F("payload_on")] = Helpers::render_boolean(result, true);
doc[F("payload_off")] = Helpers::render_boolean(result, false);
});
if (bool_format_ == BOOL_FORMAT_ONOFF) {
doc[F("payload_on")] = FJSON("on");
doc[F("payload_off")] = FJSON("off");
} else if (bool_format_ == BOOL_FORMAT_ONOFF_CAP) {
doc[F("payload_on")] = FJSON("ON");
doc[F("payload_off")] = FJSON("OFF");
} else if (bool_format_ == BOOL_FORMAT_TRUEFALSE) {
doc[F("payload_on")] = true;
doc[F("payload_off")] = false;
} else {
doc[F("payload_on")] = 1;
doc[F("payload_off")] = 0;
}
} else {
// normal HA sensor, not a boolean one
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/%s/config"), mqtt_base_.c_str(), uniq.c_str()); // topic