mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Merge pull request #1234 from MichaelDvP/dev2
add cooling state, make mqtt on_message more clear
This commit is contained in:
@@ -69,7 +69,7 @@
|
|||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.0",
|
||||||
"rollup-plugin-visualizer": "^5.9.2",
|
"rollup-plugin-visualizer": "^5.9.2",
|
||||||
"terser": "^5.19.2",
|
"terser": "^5.19.2",
|
||||||
"vite": "^4.4.6",
|
"vite": "^4.4.7",
|
||||||
"vite-plugin-svgr": "^3.2.0",
|
"vite-plugin-svgr": "^3.2.0",
|
||||||
"vite-tsconfig-paths": "^4.2.0"
|
"vite-tsconfig-paths": "^4.2.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2010,7 +2010,7 @@ __metadata:
|
|||||||
terser: ^5.19.2
|
terser: ^5.19.2
|
||||||
typesafe-i18n: ^5.25.1
|
typesafe-i18n: ^5.25.1
|
||||||
typescript: ^5.1.6
|
typescript: ^5.1.6
|
||||||
vite: ^4.4.6
|
vite: ^4.4.7
|
||||||
vite-plugin-svgr: ^3.2.0
|
vite-plugin-svgr: ^3.2.0
|
||||||
vite-tsconfig-paths: ^4.2.0
|
vite-tsconfig-paths: ^4.2.0
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -6764,9 +6764,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"vite@npm:^4.4.6":
|
"vite@npm:^4.4.7":
|
||||||
version: 4.4.6
|
version: 4.4.7
|
||||||
resolution: "vite@npm:4.4.6"
|
resolution: "vite@npm:4.4.7"
|
||||||
dependencies:
|
dependencies:
|
||||||
esbuild: ^0.18.10
|
esbuild: ^0.18.10
|
||||||
fsevents: ~2.3.2
|
fsevents: ~2.3.2
|
||||||
@@ -6800,7 +6800,7 @@ __metadata:
|
|||||||
optional: true
|
optional: true
|
||||||
bin:
|
bin:
|
||||||
vite: bin/vite.js
|
vite: bin/vite.js
|
||||||
checksum: 121144e8e9f95a3ec159dde072fefddc076cbf516bcc2078032c63b4f5b9babe760cf0cbc0c4808e02e568e8e7b1d74b742fcf4546fe2e148c4a84fb42a9089a
|
checksum: f0cd995ffd6d0311af98fa28a5ed8502c29d3aa4b3a12c812030e688f327ec17a95db0994e569bfddd6cfa602608b6892fc18d2944cbc1150d75c1ab3299bc5c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
@@ -976,6 +976,7 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
|
|||||||
}
|
}
|
||||||
has_update(telegram, hc->targetflowtemp, 4);
|
has_update(telegram, hc->targetflowtemp, 4);
|
||||||
has_update(telegram, hc->curroominfl, 27);
|
has_update(telegram, hc->curroominfl, 27);
|
||||||
|
has_update(telegram, hc->coolingon, 32);
|
||||||
|
|
||||||
add_ha_climate(hc);
|
add_ha_climate(hc);
|
||||||
}
|
}
|
||||||
@@ -4194,6 +4195,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
register_device_value(tag, &hc->reducetemp, DeviceValueType::INT, FL_(reducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_reducetemp));
|
register_device_value(tag, &hc->reducetemp, DeviceValueType::INT, FL_(reducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_reducetemp));
|
||||||
register_device_value(tag, &hc->wwprio, DeviceValueType::BOOL, FL_(wwprio), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwprio));
|
register_device_value(tag, &hc->wwprio, DeviceValueType::BOOL, FL_(wwprio), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwprio));
|
||||||
register_device_value(tag, &hc->cooling, DeviceValueType::BOOL, FL_(hpcooling), DeviceValueUOM::NONE, MAKE_CF_CB(set_cooling));
|
register_device_value(tag, &hc->cooling, DeviceValueType::BOOL, FL_(hpcooling), DeviceValueUOM::NONE, MAKE_CF_CB(set_cooling));
|
||||||
|
register_device_value(tag, &hc->coolingon, DeviceValueType::BOOL, FL_(coolingOn), DeviceValueUOM::NONE);
|
||||||
|
|
||||||
register_device_value(tag, &hc->hpmode, DeviceValueType::ENUM, FL_(enum_hpmode), FL_(hpmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_hpmode));
|
register_device_value(tag, &hc->hpmode, DeviceValueType::ENUM, FL_(enum_hpmode), FL_(hpmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_hpmode));
|
||||||
register_device_value(tag, &hc->dewoffset, DeviceValueType::UINT, FL_(dewoffset), DeviceValueUOM::K, MAKE_CF_CB(set_dewoffset), 2, 10);
|
register_device_value(tag, &hc->dewoffset, DeviceValueType::UINT, FL_(dewoffset), DeviceValueUOM::K, MAKE_CF_CB(set_dewoffset), 2, 10);
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ class Thermostat : public EMSdevice {
|
|||||||
uint8_t hpminflowtemp;
|
uint8_t hpminflowtemp;
|
||||||
uint8_t hpmode;
|
uint8_t hpmode;
|
||||||
uint8_t cooling;
|
uint8_t cooling;
|
||||||
|
uint8_t coolingon;
|
||||||
|
|
||||||
uint8_t hc_num() const {
|
uint8_t hc_num() const {
|
||||||
return hc_num_;
|
return hc_num_;
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ MAKE_TRANSLATION(auxElecHeatNrgConsPool, "auxelecheatnrgconspool", "aux elec. he
|
|||||||
MAKE_TRANSLATION(hpCompOn, "hpcompon", "hp compressor", "WP Kompressor", "WP compressor", "VP Kompressor", "sprężarka pompy ciepła", "vp kompressor", "compresseur pompe à chaleur", "", "compressore pompa calore")
|
MAKE_TRANSLATION(hpCompOn, "hpcompon", "hp compressor", "WP Kompressor", "WP compressor", "VP Kompressor", "sprężarka pompy ciepła", "vp kompressor", "compresseur pompe à chaleur", "", "compressore pompa calore")
|
||||||
MAKE_TRANSLATION(hpHeatingOn, "hpheatingon", "hp heating", "WP Heizen", "WP verwarmingsbedrijf", "VP Uppvärmning", "pompa ciepła, ogrzewanie", "vp oppvarmning", "chauffe pompe à chaleur", "riscaldamento pompa calore")
|
MAKE_TRANSLATION(hpHeatingOn, "hpheatingon", "hp heating", "WP Heizen", "WP verwarmingsbedrijf", "VP Uppvärmning", "pompa ciepła, ogrzewanie", "vp oppvarmning", "chauffe pompe à chaleur", "riscaldamento pompa calore")
|
||||||
MAKE_TRANSLATION(hpCoolingOn, "hpcoolingon", "hp cooling", "WP Kühlen", "WP koelbedrijf", "VP Kyla", "pompa ciepła, chłodzenie", "vp kjøling", "refroidissement pompe à chaleur", "raffreddamento pompa calore")
|
MAKE_TRANSLATION(hpCoolingOn, "hpcoolingon", "hp cooling", "WP Kühlen", "WP koelbedrijf", "VP Kyla", "pompa ciepła, chłodzenie", "vp kjøling", "refroidissement pompe à chaleur", "raffreddamento pompa calore")
|
||||||
|
MAKE_TRANSLATION(coolingOn, "coolingon", "cooling", "Kühlen", "koelbedrijf", "Kyla", "chłodzenie", "kjøling", "refroidissement", "calore")
|
||||||
MAKE_TRANSLATION(hpWwOn, "hpwwon", "hp dhw", "WP Warmwasser", "WP warmwaterbedrijf", "VP Varmvatten", "pompa ciepła, c.w.u.", "vp varmvatten", "eau chaude pompe à chaleur", "acqua calda pompa calore")
|
MAKE_TRANSLATION(hpWwOn, "hpwwon", "hp dhw", "WP Warmwasser", "WP warmwaterbedrijf", "VP Varmvatten", "pompa ciepła, c.w.u.", "vp varmvatten", "eau chaude pompe à chaleur", "acqua calda pompa calore")
|
||||||
MAKE_TRANSLATION(hpPoolOn, "hppoolon", "hp pool", "WP Pool", "WP zwembadbedrijf", "VP Pool", "pompa ciepła, podgrzewanie basenu", "vp basseng", "pompe à chaleur piscine", "pompa calore piscina")
|
MAKE_TRANSLATION(hpPoolOn, "hppoolon", "hp pool", "WP Pool", "WP zwembadbedrijf", "VP Pool", "pompa ciepła, podgrzewanie basenu", "vp basseng", "pompe à chaleur piscine", "pompa calore piscina")
|
||||||
MAKE_TRANSLATION(hpBrinePumpSpd, "hpbrinepumpspd", "brine pump speed", "Solepumpen-Geschw.", "Snelheid pekelpomp", "Hastighet Brine-pump", "wysterowanie pompy glikolu", "hastighet brine-pumpe", "vitesse pompe à saumure", "", "velocità pompa sbrinamento")
|
MAKE_TRANSLATION(hpBrinePumpSpd, "hpbrinepumpspd", "brine pump speed", "Solepumpen-Geschw.", "Snelheid pekelpomp", "Hastighet Brine-pump", "wysterowanie pompy glikolu", "hastighet brine-pumpe", "vitesse pompe à saumure", "", "velocità pompa sbrinamento")
|
||||||
|
|||||||
16
src/mqtt.cpp
16
src/mqtt.cpp
@@ -203,7 +203,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
|||||||
// simulate receiving a MQTT message, used only for testing
|
// simulate receiving a MQTT message, used only for testing
|
||||||
void Mqtt::incoming(const char * topic, const char * payload) {
|
void Mqtt::incoming(const char * topic, const char * payload) {
|
||||||
if (payload != nullptr) {
|
if (payload != nullptr) {
|
||||||
on_message(topic, payload, strlen(payload));
|
on_message(topic, (const uint8_t *) payload, strlen(payload));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -211,15 +211,13 @@ void Mqtt::incoming(const char * topic, const char * payload) {
|
|||||||
// received an MQTT message that we subscribed too
|
// received an MQTT message that we subscribed too
|
||||||
// topic is the full path
|
// topic is the full path
|
||||||
// payload is json or a single string and converted to a json with key 'value'
|
// payload is json or a single string and converted to a json with key 'value'
|
||||||
void Mqtt::on_message(const char * topic, const char * payload, size_t len) const {
|
void Mqtt::on_message(const char * topic, const uint8_t * payload, size_t len) const {
|
||||||
// the payload is not terminated correctly, so make a copy
|
// the payload is not terminated
|
||||||
// convert payload to a null-terminated char string
|
// convert payload to a null-terminated char string
|
||||||
|
// see https://www.emelis.net/espMqttClient/#code-samples
|
||||||
char message[len + 1];
|
char message[len + 1];
|
||||||
if (payload != nullptr) {
|
memcpy(message, payload, len);
|
||||||
strlcpy(message, payload, len + 1);
|
message[len] = '\0';
|
||||||
} else {
|
|
||||||
message[0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
if (len) {
|
if (len) {
|
||||||
@@ -390,7 +388,7 @@ void Mqtt::start() {
|
|||||||
|
|
||||||
EMSESP::esp8266React.onMessage(
|
EMSESP::esp8266React.onMessage(
|
||||||
[this](const espMqttClientTypes::MessageProperties & properties, const char * topic, const uint8_t * payload, size_t len, size_t index, size_t total) {
|
[this](const espMqttClientTypes::MessageProperties & properties, const char * topic, const uint8_t * payload, size_t len, size_t index, size_t total) {
|
||||||
on_message(topic, (const char *)payload, len); // receiving mqtt
|
on_message(topic, payload, len); // receiving mqtt
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class Mqtt {
|
|||||||
static void queue_unsubscribe_message(const std::string & topic);
|
static void queue_unsubscribe_message(const std::string & topic);
|
||||||
|
|
||||||
void on_publish(uint16_t packetId) const;
|
void on_publish(uint16_t packetId) const;
|
||||||
void on_message(const char * topic, const char * payload, size_t len) const;
|
void on_message(const char * topic, const uint8_t * payload, size_t len) const;
|
||||||
|
|
||||||
// function handlers for MQTT subscriptions
|
// function handlers for MQTT subscriptions
|
||||||
struct MQTTSubFunction {
|
struct MQTTSubFunction {
|
||||||
|
|||||||
Reference in New Issue
Block a user