Skip to content

Commit fae8cf8

Browse files
authored
Merge branch 'emsesp:dev' into dev
2 parents 5a69ac0 + 15f0560 commit fae8cf8

13 files changed

+380
-252
lines changed

interface/.typesafe-i18n.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"adapter": "react",
33
"baseLocale": "pl",
4-
"$schema": "https://unpkg.com/typesafe-i18n@5.17.1/schema/typesafe-i18n.json"
4+
"$schema": "https://unpkg.com/typesafe-i18n@5.17.2/schema/typesafe-i18n.json"
55
}

interface/package-lock.json

+253-228
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@mui/material": "^5.11.0",
1212
"@table-library/react-table-library": "4.0.23",
1313
"@types/lodash": "^4.14.191",
14-
"@types/node": "^18.11.16",
14+
"@types/node": "^18.11.17",
1515
"@types/react": "^18.0.26",
1616
"@types/react-dom": "^18.0.9",
1717
"@types/react-router-dom": "^5.3.3",
@@ -30,7 +30,7 @@
3030
"react-router-dom": "^6.5.0",
3131
"react-scripts": "5.0.1",
3232
"sockette": "^2.0.6",
33-
"typesafe-i18n": "^5.17.1",
33+
"typesafe-i18n": "^5.17.2",
3434
"typescript": "^4.9.4"
3535
},
3636
"scripts": {

interface/src/project/types.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ export enum DeviceValueUOM {
180180
SQM,
181181
M3,
182182
L,
183-
KMIN
183+
KMIN,
184+
K
184185
}
185186

186187
export const DeviceValueUOM_s = [
@@ -205,7 +206,8 @@ export const DeviceValueUOM_s = [
205206
'm²',
206207
'm³',
207208
'l',
208-
'K*min'
209+
'K*min',
210+
'K'
209211
];
210212

211213
export enum AnalogType {

src/devices/boiler.cpp

+72-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
184184

185185
register_telegram_type(0x488, "HPValve", true, MAKE_PF_CB(process_HpValve));
186186
register_telegram_type(0x484, "HPSilentMode", true, MAKE_PF_CB(process_HpSilentMode));
187+
register_telegram_type(0x48B, "HPPumps", true, MAKE_PF_CB(process_HpPumps));
187188
register_telegram_type(0x491, "HPAdditionalHeater", true, MAKE_PF_CB(process_HpAdditionalHeater));
189+
register_telegram_type(0x499, "HPDhwSettings", true, MAKE_PF_CB(process_HpDhwSettings));
188190
}
189191

190192
/*
@@ -625,6 +627,41 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
625627
DeviceValueUOM::DEGREES,
626628
MAKE_CF_CB(set_tempParMode));
627629
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &auxHeatMixValve_, DeviceValueType::INT, FL_(auxHeatMixValve), DeviceValueUOM::PERCENT);
630+
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
631+
&tempDiffHeat_,
632+
DeviceValueType::UINT,
633+
DeviceValueNumOp::DV_NUMOP_DIV10,
634+
FL_(tempDiffHeat),
635+
DeviceValueUOM::K,
636+
MAKE_CF_CB(set_tempDiffHeat),
637+
3,
638+
10);
639+
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
640+
&tempDiffCool_,
641+
DeviceValueType::UINT,
642+
DeviceValueNumOp::DV_NUMOP_DIV10,
643+
FL_(tempDiffCool),
644+
DeviceValueUOM::K,
645+
MAKE_CF_CB(set_tempDiffCool),
646+
3,
647+
10);
648+
// heatpump DHW settings
649+
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
650+
&wwComfOffTemp_,
651+
DeviceValueType::UINT,
652+
FL_(wwComfOffTemp),
653+
DeviceValueUOM::DEGREES,
654+
MAKE_CF_CB(set_wwComfOffTemp),
655+
15,
656+
65);
657+
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
658+
&wwEcoOffTemp_,
659+
DeviceValueType::UINT,
660+
FL_(wwEcoOffTemp),
661+
DeviceValueUOM::DEGREES,
662+
MAKE_CF_CB(set_wwEcoOffTemp),
663+
15,
664+
65);
628665
}
629666

630667
// dhw - DEVICE_DATA_ww topic
@@ -1267,6 +1304,7 @@ void Boiler::process_HpInConfig(std::shared_ptr<const Telegram> telegram) {
12671304
has_update(hpInput[3].option, option, 12);
12681305
}
12691306

1307+
// Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0492), data: 03 00 00 04 00
12701308
void Boiler::process_HpHeaterConfig(std::shared_ptr<const Telegram> telegram) {
12711309
has_update(maxHeatComp_, 2);
12721310
has_update(maxHeatHeat_, 3);
@@ -1537,6 +1575,12 @@ void Boiler::process_HpValve(std::shared_ptr<const Telegram> telegram) {
15371575
has_update(telegram, auxHeatMixValve_, 7);
15381576
}
15391577

1578+
// Boiler(0x08) -B-> All(0x00), ?(0x048B), data: 00 00 0A 1E 4E 00 1E 01 2C 00 01 64 55 05 12 50 50 50 00 00 1E 01 2C 00
1579+
// Boiler(0x08) -B-> All(0x00), ?(0x048B), data: 00 1E 00 96 00 1E (offset 24)
1580+
void Boiler::process_HpPumps(std::shared_ptr<const Telegram> telegram) {
1581+
has_update(telegram, tempDiffHeat_, 4); // is * 10
1582+
has_update(telegram, tempDiffCool_, 3); // is * 10
1583+
}
15401584

15411585
// Boiler(0x08) -> All(0x00), ?(0x0491), data: 03 01 00 00 00 02 64 00 00 14 01 2C 00 0A 00 1E 00 1E 00 00 1E 0A 1E 05 05
15421586
void Boiler::process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram) {
@@ -1546,6 +1590,13 @@ void Boiler::process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram
15461590
has_update(telegram, auxHeaterDelay_, 16); // is / 10
15471591
}
15481592

1593+
// DHW 0x499
1594+
// Boiler(0x08) -B-> All(0x00), ?(0x0499), data: 31 33 3F 3B 01
1595+
void Boiler::process_HpDhwSettings(std::shared_ptr<const Telegram> telegram) {
1596+
has_update(telegram, wwComfOffTemp_, 1);
1597+
has_update(telegram, wwEcoOffTemp_, 0);
1598+
}
1599+
15491600
// Settings AM200
15501601

15511602
// pos 12: off(00)/Keelbypass(01)/(hc1pump(02) only standalone)
@@ -2526,7 +2577,7 @@ bool Boiler::set_tempParMode(const char * value, const int8_t id) {
25262577
bool Boiler::set_additionalHeaterDelay(const char * value, const int8_t id) {
25272578
int v;
25282579
if (Helpers::value2number(value, v)) {
2529-
v /= 5;
2580+
v /= 10;
25302581
uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v};
25312582
write_command(0x491, 16, data, 2, 0x491);
25322583
return true;
@@ -2537,11 +2588,30 @@ bool Boiler::set_additionalHeaterDelay(const char * value, const int8_t id) {
25372588
bool Boiler::set_hpHyst(const char * value, const int8_t id) {
25382589
int v;
25392590
if (Helpers::value2number(value, v)) {
2540-
v /= 10;
2591+
v /= 5;
25412592
uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v};
25422593
write_command(0x484, id, data, 2, 0x484);
25432594
return true;
25442595
}
25452596
return false;
25462597
}
2598+
2599+
bool Boiler::set_tempDiff(const char * value, const int8_t id) {
2600+
float v;
2601+
if (Helpers::value2float(value, v)) {
2602+
write_command(0x48B, id, (uint8_t)(v * 10), 0x48B);
2603+
return true;
2604+
}
2605+
return false;
2606+
}
2607+
2608+
bool Boiler::set_wwOffTemp(const char * value, const int8_t id) {
2609+
int v;
2610+
if (Helpers::value2number(value, v)) {
2611+
write_command(0x499, id, v, 0x499);
2612+
return true;
2613+
}
2614+
return false;
2615+
}
2616+
25472617
} // namespace emsesp

src/devices/boiler.h

+21
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ class Boiler : public EMSdevice {
253253
uint16_t hpHystHeat_;
254254
uint16_t hpHystCool_;
255255
uint16_t hpHystPool_;
256+
uint8_t tempDiffHeat_;
257+
uint8_t tempDiffCool_;
258+
259+
uint8_t wwComfOffTemp_;
260+
uint8_t wwEcoOffTemp_;
256261

257262
/*
258263
// Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat
@@ -308,6 +313,8 @@ class Boiler : public EMSdevice {
308313
void process_HpSilentMode(std::shared_ptr<const Telegram> telegram);
309314
void process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram);
310315
void process_HpValve(std::shared_ptr<const Telegram> telegram);
316+
void process_HpPumps(std::shared_ptr<const Telegram> telegram);
317+
void process_HpDhwSettings(std::shared_ptr<const Telegram> telegram);
311318

312319
// commands - none of these use the additional id parameter
313320
bool set_ww_mode(const char * value, const int8_t id);
@@ -409,6 +416,20 @@ class Boiler : public EMSdevice {
409416
inline bool set_hpHystPool(const char * value, const int8_t id) {
410417
return set_hpHyst(value, 33);
411418
}
419+
bool set_tempDiff(const char * value, const int8_t id);
420+
inline bool set_tempDiffHeat(const char * value, const int8_t id) {
421+
return set_tempDiff(value, 4);
422+
}
423+
inline bool set_tempDiffCool(const char * value, const int8_t id) {
424+
return set_tempDiff(value, 3);
425+
}
426+
bool set_wwOffTemp(const char * value, const int8_t id);
427+
inline bool set_wwComfOffTemp(const char * value, const int8_t id) {
428+
return set_wwOffTemp(value, 1);
429+
}
430+
inline bool set_wwEcoOffTemp(const char * value, const int8_t id) {
431+
return set_wwOffTemp(value, 0);
432+
}
412433

413434
/*
414435
bool set_hybridStrategy(const char * value, const int8_t id);

src/emsdevicevalue.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ DeviceValue::DeviceValue(uint8_t device_type,
105105
// must be an int of 4 bytes, 32bit aligned
106106
const char * DeviceValue::DeviceValueUOM_s[] = {
107107

108-
F_(uom_blank), F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0],
109-
FL_(minutes)[0], F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm),
110-
F_(uom_fahrenheit), F_(uom_mv), F_(uom_sqm), F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_blank) // connectivity
108+
F_(uom_blank), F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0], FL_(minutes)[0],
109+
F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm), F_(uom_fahrenheit), F_(uom_mv),
110+
F_(uom_sqm), F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_blank)
111111

112112
};
113113

src/emsdevicevalue.h

+13-12
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,28 @@ class DeviceValue {
4949
enum DeviceValueUOM : uint8_t {
5050
NONE = 0, // 0
5151
DEGREES, // 1
52-
DEGREES_R, // 2
52+
DEGREES_R, // 2 - relative temperature
5353
PERCENT, // 3
54-
LMIN, // 4
55-
KWH, // 5
56-
WH, // 6
54+
LMIN, // 4 - l/min
55+
KWH, // 5 - kWh
56+
WH, // 6 - Wh
5757
HOURS, // 7
5858
MINUTES, // 8
59-
UA, // 9
59+
UA, // 9 - µA
6060
BAR, // 10
61-
KW, // 11
61+
KW, // 11 - kW
6262
W, // 12
6363
KB, // 13
6464
SECONDS, // 14
65-
DBM, // 15
65+
DBM, // 15 - dBm
6666
FAHRENHEIT, // 16
67-
MV, // 17
68-
SQM, // 18 square meter
69-
M3, // 19 cubic meter
70-
L, // 20
67+
MV, // 17 - mV
68+
SQM, // 18 - square meter
69+
M3, // 19 - cubic meter
70+
L, // 20 - liter
7171
KMIN, // 21 - Kelvin * minutes
72-
CONNECTIVITY // 22 - used in HA
72+
K, // 22 - Kelvin
73+
CONNECTIVITY // 23 - used in HA
7374
};
7475

7576
// TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp

src/helpers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ bool Helpers::hasValue(const uint16_t & value) {
522522
}
523523

524524
bool Helpers::hasValue(const uint32_t & value) {
525-
return (value != EMS_VALUE_ULONG_NOTSET);
525+
return (value < EMS_VALUE_ULONG_NOTSET);
526526
}
527527

528528
// checks if we can convert a char string to an int value

src/locale_common.h

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ MAKE_PSTR(uom_sqm, "m²")
216216
MAKE_PSTR(uom_m3, "m³")
217217
MAKE_PSTR(uom_l, "l")
218218
MAKE_PSTR(uom_kmin, "K*min")
219+
MAKE_PSTR(uom_k, "K")
219220

220221
// MQTT topics and prefixes
221222
MAKE_PSTR(heating_active, "heating_active")

src/locale_translations.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,14 @@ MAKE_PSTR_LIST(auxHeaterDelay, "auxheaterdelay", "auxilliary heater on delay", "
376376
MAKE_PSTR_LIST(minTempSilent, "mintempsilent", "min. outside temp. for silent mode", "Minimale Aussentemperatur Silentmodus", " Stiller gebruik min. buitentemp", "", "", "", "Fct silencieux: Temp. extérieure min.")
377377
MAKE_PSTR_LIST(tempParMode, "tempparmode", "outside temp. parallel mode", "Aussentemperatur Parallelmodus", "Buitentemp. parallelbedr", "", "", "", "Temp. ext. fct parallèle")
378378
MAKE_PSTR_LIST(auxHeatMixValve, "auxheatmix", "aux. heater mixing valve", "Mischer Zusatzheizer", "Bijverwarming menger", "", "", "", "Chauffage auxiliaire mélangeur")
379-
MAKE_PSTR_LIST(hpHystHeat, "hphystheat", "HP on/off hyst heat", "Schalthysterese Heizen", "Aan/uit-hysteresis in verw. bedrijf", "På/av-hystereses Husv.", "Histerez wł/wył Ogrzew.", "På/av-hysterese Oppvar.", "Hystérésis Marche en mode chauffage")
379+
MAKE_PSTR_LIST(hpHystHeat, "hphystheat", "on/off hyst heat", "Schalthysterese Heizen", "Aan/uit-hysteresis in verw. bedrijf", "På/av-hystereses Husv.", "Histerez wł/wył Ogrzew.", "På/av-hysterese Oppvar.", "Hystérésis Marche en mode chauffage")
380380
MAKE_PSTR_LIST(hpHystCool, "hphystcool", "on/off hyst cool", "Schalthysterese Kühlen", "Aan/uit-hysteresis in koelbedrijf ", "", "", "", "Hystérésis Marche en mode refroidissement")
381381
MAKE_PSTR_LIST(hpHystPool, "hphystpool", "on/off hyst pool", "Schalthysterese Pool", "an/uit-hysteresis in zwembadbedri", "", "", "", "Hystérésis Marche en mode piscine")
382+
MAKE_PSTR_LIST(tempDiffHeat, "tempdiffheat", "temp. diff. TC3/TC0 heat", "Temp.diff. TC3/TC0 Heizen", "Temp.vers. TC3/TC0 verw", "", "", "", "Delta T TC3/TC0 Chauff")
383+
MAKE_PSTR_LIST(tempDiffCool, "tempdiffcool", "temp. diff. TC3/TC0 cool", "Temp.diff. TC3/TC0 Kühlen", "Temp.vers. TC3/TC0 koel.", "", "", "", "Delta T TC3/TC0 Refroid.")
384+
385+
MAKE_PSTR_LIST(wwComfOffTemp, "wwcomfoff", "comfort switch off", "Komfort Ausschalttemp", "Comfort Uitschakeltemp.", "", "", "", "Confort Temp. d'arrêt")
386+
MAKE_PSTR_LIST(wwEcoOffTemp, "wwecooff", "eco switch off", "ECO Ausschalttemp", "Eco Uitschakeltemp.", "", "", "", "Eco Temp. d'arrêt")
382387

383388
// hybrid heatpump
384389
MAKE_PSTR_LIST(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid Strategie", "Hybride strategie", "Hybrid kontrollstrategi", "strategia sterowania hybrydowego", "hybrid kontrollstrategi", "stratégie contrôle hybride")

src/mqtt.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
11191119
switch (uom) {
11201120
case DeviceValueUOM::DEGREES:
11211121
case DeviceValueUOM::DEGREES_R:
1122+
case DeviceValueUOM::K:
11221123
doc[ic_ha] = F_(icondegrees);
11231124
break;
11241125
case DeviceValueUOM::PERCENT:
@@ -1184,6 +1185,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
11841185
switch (uom) {
11851186
case DeviceValueUOM::DEGREES:
11861187
case DeviceValueUOM::DEGREES_R:
1188+
case DeviceValueUOM::K:
11871189
doc[sc_ha] = F_(measurement);
11881190
doc[dc_ha] = "temperature"; // no icon needed
11891191
break;

src/telegram.h

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static constexpr int8_t EMS_VALUE_INT_NOTSET = 0x7F; // for signed 8-
4747
static constexpr uint16_t EMS_VALUE_USHORT_NOTSET = 0x7D00; // 32000: for 2-byte unsigned shorts
4848
static constexpr int16_t EMS_VALUE_SHORT_NOTSET = 0x7D00; // 32000: for 2-byte signed shorts
4949
static constexpr uint32_t EMS_VALUE_ULONG_NOTSET = 0x00FFFFFF; // for 3-byte and 4-byte longs
50+
// 4 byte value is 21474836 (0x147AE14), we use only the lower one, see https://github.com/emsesp/EMS-ESP32/issues/820
5051

5152
static constexpr uint8_t EMS_MAX_TELEGRAM_LENGTH = 32; // max length of a complete EMS telegram
5253
static constexpr uint8_t EMS_MAX_TELEGRAM_MESSAGE_LENGTH = 27; // max length of message block, assuming EMS1.0

0 commit comments

Comments
 (0)