fix date format

This commit is contained in:
MichaelDvP
2024-05-04 13:32:04 +02:00
parent e84bf9a181
commit 9a2d635c62
2 changed files with 26 additions and 2 deletions

View File

@@ -2503,6 +2503,29 @@ bool Thermostat::set_RC30Vacation(const char * value, const int8_t id) {
return true; return true;
} }
// set R3000 holiday as string dd.mm.yyyy-dd.mm.yyyy
// RC30 and rego 3000
bool Thermostat::set_R3000Holiday(const char * value, const int8_t id) {
if (strlen(value) != 21) {
return false;
}
uint8_t data[6];
data[2] = (value[0] - '0') * 10 + (value[1] - '0');
data[1] = (value[3] - '0') * 10 + (value[4] - '0');
data[0] = (value[7] - '0') * 100 + (value[8] - '0') * 10 + (value[9] - '0');
data[5] = (value[11] - '0') * 10 + (value[12] - '0');
data[4] = (value[14] - '0') * 10 + (value[15] - '0');
data[3] = (value[18] - '0') * 100 + (value[19] - '0') * 10 + (value[20] - '0');
if (!data[2] || data[2] > 31 || !data[1] || data[1] > 12 || !data[5] || data[5] > 31 || !data[4] || data[4] > 12) {
return false;
}
write_command(0x269, 0, data, 6, 0x269);
return true;
}
// set pause in hours // set pause in hours
bool Thermostat::set_pause(const char * value, const int8_t id) { bool Thermostat::set_pause(const char * value, const int8_t id) {
auto hc = heating_circuit(id); auto hc = heating_circuit(id);
@@ -3934,9 +3957,9 @@ void Thermostat::register_device_values() {
&vacation[0], &vacation[0],
DeviceValueType::STRING, DeviceValueType::STRING,
FL_(tpl_holidays), FL_(tpl_holidays),
FL_(holiday), FL_(vacations),
DeviceValueUOM::NONE, DeviceValueUOM::NONE,
MAKE_CF_CB(set_RC30Vacation)); MAKE_CF_CB(set_R3000Holiday));
} }
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&hybridStrategy_, &hybridStrategy_,

View File

@@ -580,6 +580,7 @@ class Thermostat : public EMSdevice {
bool set_wwDailyHeating(const char * value, const int8_t id); bool set_wwDailyHeating(const char * value, const int8_t id);
bool set_wwDailyHeatTime(const char * value, const int8_t id); bool set_wwDailyHeatTime(const char * value, const int8_t id);
bool set_wwwhenmodeoff(const char * value, const int8_t id); bool set_wwwhenmodeoff(const char * value, const int8_t id);
bool set_R3000Holiday(const char * value, const int8_t id);
inline bool set_wwVacation(const char * value, const int8_t id) { inline bool set_wwVacation(const char * value, const int8_t id) {
return set_holiday(value, DeviceValueTAG::TAG_DHW1, true); return set_holiday(value, DeviceValueTAG::TAG_DHW1, true);
} }