Merge pull request #690 from MichaelDvP/dev

solar temperature sensor and some fixes
This commit is contained in:
Proddy
2022-10-17 15:00:47 +02:00
committed by GitHub
7 changed files with 19 additions and 1 deletions

View File

@@ -577,6 +577,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(wwSelTempSingle), FL_(wwSelTempSingle),
DeviceValueUOM::DEGREES, DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_ww_temp_single)); MAKE_CF_CB(set_ww_temp_single));
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwSolarTemp_, DeviceValueType::USHORT, FL_(wwSolarTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwType_, DeviceValueType::ENUM, FL_(enum_flow), FL_(wwType), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwType_, DeviceValueType::ENUM, FL_(enum_flow), FL_(wwType), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
&wwComfort_, &wwComfort_,
@@ -873,6 +874,7 @@ void Boiler::process_UBAMonitorWW(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, wwType_, 8); has_update(telegram, wwType_, 8);
has_update(telegram, wwCurFlow_, 9); has_update(telegram, wwCurFlow_, 9);
has_update(telegram, wwSolarTemp_, 17);
has_update(telegram, wwWorkM_, 10, 3); // force to 3 bytes has_update(telegram, wwWorkM_, 10, 3); // force to 3 bytes
has_update(telegram, wwStarts_, 13, 3); // force to 3 bytes has_update(telegram, wwStarts_, 13, 3); // force to 3 bytes

View File

@@ -90,6 +90,7 @@ class Boiler : public EMSdevice {
uint8_t wwTapActivated_; // maintenance-mode to switch DHW off uint8_t wwTapActivated_; // maintenance-mode to switch DHW off
uint16_t wwMixerTemp_; // mixing temperature uint16_t wwMixerTemp_; // mixing temperature
uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3) uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3)
uint16_t wwSolarTemp_;
// main // main
uint8_t reset_; // for reset command uint8_t reset_; // for reset command

View File

@@ -340,7 +340,7 @@ bool DeviceValue::get_custom_min(int16_t & val) {
if (fahrenheit) { if (fahrenheit) {
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
} }
if (v > max) { if (max > 0 && v > max) {
return false; return false;
} }
val = v; val = v;

View File

@@ -1191,6 +1191,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
LOG_ERROR("Last Tx write rejected by host"); LOG_ERROR("Last Tx write rejected by host");
txservice_.send_poll(); // close the bus txservice_.send_poll(); // close the bus
txservice_.reset_retry_count(); txservice_.reset_retry_count();
tx_successful = true;
} }
} else if (tx_state == Telegram::Operation::TX_READ) { } else if (tx_state == Telegram::Operation::TX_READ) {
// got a telegram with data in it. See if the src/dest matches that from the last one we sent and continue to process it // got a telegram with data in it. See if the src/dest matches that from the last one we sent and continue to process it

View File

@@ -457,6 +457,7 @@ MAKE_PSTR_LIST(wwProgMode, "wwprogmode", "program", "Programmmodus", "Programma"
MAKE_PSTR_LIST(wwCircProg, "wwcircprog", "circulation program", "Zirkulationsprogramm", "Circulatieprogramma", "Cirkulationsprogram", "program cyrkulacji c.w.u.") MAKE_PSTR_LIST(wwCircProg, "wwcircprog", "circulation program", "Zirkulationsprogramm", "Circulatieprogramma", "Cirkulationsprogram", "program cyrkulacji c.w.u.")
MAKE_PSTR_LIST(wwMaxTemp, "wwmaxtemp", "maximum temperature", "Maximale Temperatur", "Maximale temperatuur", "Maximal Temperatur", "temperatura maksymalna") MAKE_PSTR_LIST(wwMaxTemp, "wwmaxtemp", "maximum temperature", "Maximale Temperatur", "Maximale temperatuur", "Maximal Temperatur", "temperatura maksymalna")
MAKE_PSTR_LIST(wwOneTimeKey, "wwonetimekey", "one time key function", "Einmalladungstaste", "Knop voor eenmalig laden buffer", "Engångsfunktion", "przycisk jednorazowego ogrzania") MAKE_PSTR_LIST(wwOneTimeKey, "wwonetimekey", "one time key function", "Einmalladungstaste", "Knop voor eenmalig laden buffer", "Engångsfunktion", "przycisk jednorazowego ogrzania")
MAKE_PSTR_LIST(wwSolarTemp, "wwsolartemp", "solar boiler temperature", "Solarboiler Temperatur", "Zonneboiler temperatuur", "", "")
// mqtt values / commands // mqtt values / commands

View File

@@ -55,6 +55,9 @@ uint8_t Mqtt::connectcount_ = 0;
uint32_t Mqtt::mqtt_message_id_ = 0; uint32_t Mqtt::mqtt_message_id_ = 0;
char will_topic_[Mqtt::MQTT_TOPIC_MAX_SIZE]; // because MQTT library keeps only char pointer char will_topic_[Mqtt::MQTT_TOPIC_MAX_SIZE]; // because MQTT library keeps only char pointer
std::string Mqtt::lasttopic_ = "";
std::string Mqtt::lastpayload_ = "";
// Home Assistant specific // Home Assistant specific
// icons from https://materialdesignicons.com used with the UOMs (unit of measurements) // icons from https://materialdesignicons.com used with the UOMs (unit of measurements)
MAKE_PSTR_WORD(measurement) MAKE_PSTR_WORD(measurement)
@@ -277,6 +280,11 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons
} }
return; return;
} }
// for misconfigured mqtt servers and publish2command ignore echos
if (publish_single_ && publish_single2cmd_ && lasttopic_ == topic && lastpayload_ == message) {
LOG_DEBUG("Received echo message %s: %s", topic, message);
return;
}
// check first against any of our subscribed topics // check first against any of our subscribed topics
for (const auto & mf : mqtt_subfunctions_) { for (const auto & mf : mqtt_subfunctions_) {
@@ -857,6 +865,8 @@ void Mqtt::process_queue() {
// else try and publish it // else try and publish it
uint16_t packet_id = mqttClient_->publish(topic, mqtt_qos_, message->retain, message->payload.c_str(), message->payload.size(), false, mqtt_message.id_); uint16_t packet_id = mqttClient_->publish(topic, mqtt_qos_, message->retain, message->payload.c_str(), message->payload.size(), false, mqtt_message.id_);
lasttopic_ = topic;
lastpayload_ = message->payload;
LOG_DEBUG("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)", LOG_DEBUG("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)",
topic, topic,
mqtt_message.id_, mqtt_message.id_,

View File

@@ -297,6 +297,9 @@ class Mqtt {
static uint8_t connectcount_; static uint8_t connectcount_;
static bool ha_climate_reset_; static bool ha_climate_reset_;
static std::string lasttopic_;
static std::string lastpayload_;
// settings, copied over // settings, copied over
static std::string mqtt_base_; static std::string mqtt_base_;
static std::string mqtt_basename_; static std::string mqtt_basename_;