mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-12 10:49:54 +03:00
solar heat assistance, rounding custom entities #2763
This commit is contained in:
@@ -895,6 +895,8 @@ MAKE_TRANSLATION(cyl3BottomTemp, "cyl3bottomtemp", "third cylinder bottom temper
|
||||
MAKE_TRANSLATION(cylTopTemp, "cyltoptemp", "cylinder top temperature (TS10)", "Speichertemperatur oben (TS10)", "", "Cylindertemperatur Toppen (TS10)", "", "", "", "", "", "horná teplota valca (TS10)", "") // TODO translate
|
||||
MAKE_TRANSLATION(transferPumpMod, "transferpumpmod", "transfer pump modulation", "Transferpumpenmodulation", "", "Överföringspumpmodulering", "", "", "", "", "", "modulácia prenosového čerpadla", "") // TODO translate
|
||||
MAKE_TRANSLATION(transferPump, "transferpump", "transfer pump", "Transferpumpe", "", "Överföringspump", "", "", "", "", "", "prenosové čerpadlo", "") // TODO translate
|
||||
MAKE_TRANSLATION(heatAssistOn, "heatassiston", "heat assistance on", "Einschaltdiff. Rücklaufanh.")
|
||||
MAKE_TRANSLATION(heatAssistOff, "heatassistoff", "heat assistance off", "Ausschaltdiff. Rücklaufanh.")
|
||||
|
||||
// solar dhw
|
||||
MAKE_TRANSLATION(wwColdTemp, "coldtemp", "cold water", "Kaltwasser", "", "kallvatten", "zimna woda", "", "", "", "", "studená voda", "studená voda") // TODO translate
|
||||
|
||||
@@ -417,6 +417,20 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(swapRetTemp),
|
||||
DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&heatAssistOn_,
|
||||
DeviceValueType::INT8,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(heatAssistOn),
|
||||
DeviceValueUOM::K,
|
||||
MAKE_CF_CB(set_solarHeatAssistOn));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&heatAssistOff_,
|
||||
DeviceValueType::INT8,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(heatAssistOff),
|
||||
DeviceValueUOM::K,
|
||||
MAKE_CF_CB(set_solarHeatAssistOn));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,7 +554,8 @@ void Solar::process_SM100Circuit2Config(std::shared_ptr<const Telegram> telegram
|
||||
|
||||
// type 0x35C Heat assistance
|
||||
void Solar::process_SM100HeatAssist(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, solarHeatAssist_, 0); // is *10
|
||||
has_update(telegram, heatAssistOn_, 0); // is *10
|
||||
has_update(telegram, heatAssistOff_, 1); // is *10
|
||||
}
|
||||
|
||||
// type 0x361 differential control
|
||||
@@ -1103,4 +1118,22 @@ bool Solar::set_diffControl(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Solar::set_solarHeatAssistOn(const char * value, const int8_t id) {
|
||||
float t;
|
||||
if (!Helpers::value2float(value, t)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x35C, 0, (uint8_t)(t * 10), 0x35C);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Solar::set_solarHeatAssistOff(const char * value, const int8_t id) {
|
||||
float t;
|
||||
if (!Helpers::value2float(value, t)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x35C, 1, (uint8_t)(t * 10), 0x35C);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -105,7 +105,8 @@ class Solar : public EMSdevice {
|
||||
uint8_t solarPump2Mode_; // 00=off, 01=PWM, 02=10V
|
||||
|
||||
// telegram 0x35C Heat assistance
|
||||
uint8_t solarHeatAssist_; // is *10
|
||||
int8_t heatAssistOn_; // is *10
|
||||
int8_t heatAssistOff_; // is *10
|
||||
|
||||
// telegram 0x035F
|
||||
uint8_t cylPriority_; // 0 or 1
|
||||
@@ -195,6 +196,8 @@ class Solar : public EMSdevice {
|
||||
bool set_cylPriority(const char * value, const int8_t id);
|
||||
bool set_heatAssist(const char * value, const int8_t id);
|
||||
bool set_diffControl(const char * value, const int8_t id);
|
||||
bool set_solarHeatAssistOn(const char * value, const int8_t id);
|
||||
bool set_solarHeatAssistOff(const char * value, const int8_t id);
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -196,7 +196,7 @@ bool WebCustomEntityService::command_setvalue(const char * value, const int8_t i
|
||||
if (!Helpers::value2float(value, f)) {
|
||||
return false;
|
||||
}
|
||||
int v = f / entityItem.factor;
|
||||
int v = (f / entityItem.factor + 0.5);
|
||||
if (entityItem.value_type == DeviceValueType::UINT8 || entityItem.value_type == DeviceValueType::INT8) {
|
||||
EMSESP::send_write_request(entityItem.type_id, entityItem.device_id, entityItem.offset, v, 0);
|
||||
} else if (entityItem.value_type == DeviceValueType::UINT16 || entityItem.value_type == DeviceValueType::INT16) {
|
||||
|
||||
Reference in New Issue
Block a user