mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
@@ -45,6 +45,7 @@ interface LogEventControllerState {
|
|||||||
compact: boolean;
|
compact: boolean;
|
||||||
level: number;
|
level: number;
|
||||||
max_messages: number;
|
max_messages: number;
|
||||||
|
last_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
type LogEventControllerProps = RestControllerProps<LogSettings>;
|
type LogEventControllerProps = RestControllerProps<LogSettings>;
|
||||||
@@ -62,7 +63,8 @@ class LogEventController extends Component<
|
|||||||
events: [],
|
events: [],
|
||||||
compact: false,
|
compact: false,
|
||||||
level: 6,
|
level: 6,
|
||||||
max_messages: 25
|
max_messages: 25,
|
||||||
|
last_id: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +159,10 @@ class LogEventController extends Component<
|
|||||||
const rawData = event.data;
|
const rawData = event.data;
|
||||||
if (typeof rawData === 'string' || rawData instanceof String) {
|
if (typeof rawData === 'string' || rawData instanceof String) {
|
||||||
const event = JSON.parse(rawData as string) as LogEvent;
|
const event = JSON.parse(rawData as string) as LogEvent;
|
||||||
this.setState((state) => ({ events: [...state.events, event] }));
|
if (event.i > this.state.last_id) {
|
||||||
|
this.setState({ last_id: event.i });
|
||||||
|
this.setState((state) => ({ events: [...state.events, event] }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -210,9 +210,6 @@ bool DallasSensor::temperature_convert_complete() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
||||||
|
|
||||||
int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) {
|
int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) {
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
if (!bus_.reset()) {
|
if (!bus_.reset()) {
|
||||||
@@ -276,8 +273,6 @@ int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
const std::vector<DallasSensor::Sensor> DallasSensor::sensors() const {
|
const std::vector<DallasSensor::Sensor> DallasSensor::sensors() const {
|
||||||
return sensors_;
|
return sensors_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,9 +657,9 @@ void Thermostat::process_RC10Monitor(std::shared_ptr<const Telegram> telegram) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t mode = hc->mode * 2;
|
uint8_t mode = 1 << hc->mode;
|
||||||
has_update(telegram->read_value(mode, 0)); // 1: nofrost, 2: night, 4: day
|
has_update(telegram->read_value(mode, 0)); // 1: nofrost, 2: night, 4: day
|
||||||
hc->mode = mode / 2; // for enum 0, 1, 2
|
hc->mode = mode >> 1; // for enum 0, 1, 2
|
||||||
has_update(telegram->read_value(hc->setpoint_roomTemp, 1, 1)); // is * 2, force as single byte
|
has_update(telegram->read_value(hc->setpoint_roomTemp, 1, 1)); // is * 2, force as single byte
|
||||||
has_update(telegram->read_value(hc->curr_roomTemp, 2)); // is * 10
|
has_update(telegram->read_value(hc->curr_roomTemp, 2)); // is * 10
|
||||||
has_update(telegram->read_value(hc->reduceminutes, 5));
|
has_update(telegram->read_value(hc->reduceminutes, 5));
|
||||||
@@ -680,9 +680,26 @@ void Thermostat::process_RC10Set(std::shared_ptr<const Telegram> telegram) {
|
|||||||
has_update(telegram->read_value(hc->nighttemp, 3));
|
has_update(telegram->read_value(hc->nighttemp, 3));
|
||||||
has_update(telegram->read_value(hc->daytemp, 4));
|
has_update(telegram->read_value(hc->daytemp, 4));
|
||||||
has_update(telegram->read_value(hc->reducehours, 5));
|
has_update(telegram->read_value(hc->reducehours, 5));
|
||||||
has_update(telegram->read_value(ibaBuildingType_, 6));
|
has_update(telegram->read_value(heatingpid_, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
|
|
||||||
|
// type 0xB2, mode setting Data: 04 00
|
||||||
|
// not used, we read mode from monitor 0xB1
|
||||||
|
void Thermostat::process_RC10Set_2(std::shared_ptr<const Telegram> telegram) {
|
||||||
|
// std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
|
||||||
|
// if (hc == nullptr) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// uint8_t mode = 1 << hc->mode;
|
||||||
|
// has_update(telegram->read_value(mode, 0)); // 1: nofrost, 2: night, 4: day
|
||||||
|
// hc->mode = mode >> 1; // for enum 0, 1, 2
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
// 0xA8 - for reading the mode from the RC20 thermostat (0x17)
|
// 0xA8 - for reading the mode from the RC20 thermostat (0x17)
|
||||||
void Thermostat::process_RC20Set(std::shared_ptr<const Telegram> telegram) {
|
void Thermostat::process_RC20Set(std::shared_ptr<const Telegram> telegram) {
|
||||||
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
|
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
|
||||||
@@ -1326,9 +1343,7 @@ bool Thermostat::set_building(const char * value, const int8_t id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG_INFO(F("Setting building to %s"), value);
|
LOG_INFO(F("Setting building to %s"), value);
|
||||||
if (model() == EMS_DEVICE_FLAG_RC10) {
|
if ((model() == EMS_DEVICE_FLAG_RC300) || (model() == EMS_DEVICE_FLAG_RC100)) {
|
||||||
write_command(0xB0, 6, bd, 0xB0);
|
|
||||||
} else if ((model() == EMS_DEVICE_FLAG_RC300) || (model() == EMS_DEVICE_FLAG_RC100)) {
|
|
||||||
write_command(0x240, 9, bd + 1, 0x240);
|
write_command(0x240, 9, bd + 1, 0x240);
|
||||||
} else {
|
} else {
|
||||||
write_command(EMS_TYPE_IBASettings, 6, bd, EMS_TYPE_IBASettings);
|
write_command(EMS_TYPE_IBASettings, 6, bd, EMS_TYPE_IBASettings);
|
||||||
@@ -1336,6 +1351,20 @@ bool Thermostat::set_building(const char * value, const int8_t id) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0xB0 - Set RC10 heating pid
|
||||||
|
bool Thermostat::set_heatingpid(const char * value, const int8_t id) {
|
||||||
|
uint8_t pid = 0;
|
||||||
|
if (!Helpers::value2enum(value, pid, FL_(enum_PID))) {
|
||||||
|
LOG_WARNING(F("Set heating pid: Invalid value"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
LOG_INFO(F("Setting heating pid to %s"), value);
|
||||||
|
if (model() == EMS_DEVICE_FLAG_RC10) {
|
||||||
|
write_command(0xB0, 6, pid, 0xB0);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 0xA5 - Set the building settings
|
// 0xA5 - Set the building settings
|
||||||
bool Thermostat::set_damping(const char * value, const int8_t id) {
|
bool Thermostat::set_damping(const char * value, const int8_t id) {
|
||||||
bool dmp;
|
bool dmp;
|
||||||
@@ -1765,6 +1794,9 @@ bool Thermostat::set_mode(const char * value, const int8_t id) {
|
|||||||
if (value[0] >= '0' && value[0] <= '9') {
|
if (value[0] >= '0' && value[0] <= '9') {
|
||||||
uint8_t num = value[0] - '0';
|
uint8_t num = value[0] - '0';
|
||||||
switch (model()) {
|
switch (model()) {
|
||||||
|
case EMSdevice::EMS_DEVICE_FLAG_RC10:
|
||||||
|
mode = uuid::read_flash_string(FL_(enum_mode6)[num]);
|
||||||
|
break;
|
||||||
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
||||||
case EMSdevice::EMS_DEVICE_FLAG_RC20_N:
|
case EMSdevice::EMS_DEVICE_FLAG_RC20_N:
|
||||||
mode = uuid::read_flash_string(FL_(enum_mode2)[num]);
|
mode = uuid::read_flash_string(FL_(enum_mode2)[num]);
|
||||||
@@ -1842,6 +1874,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
|
|||||||
uint8_t set_mode_value, offset;
|
uint8_t set_mode_value, offset;
|
||||||
uint16_t validate_typeid = 0;
|
uint16_t validate_typeid = 0;
|
||||||
uint8_t hc_p = hc->hc_num() - 1;
|
uint8_t hc_p = hc->hc_num() - 1;
|
||||||
|
uint16_t set_typeid = set_typeids[hc->hc_num() - 1];
|
||||||
|
|
||||||
// set the value to send via EMS depending on the mode type
|
// set the value to send via EMS depending on the mode type
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@@ -1865,6 +1898,18 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (model()) {
|
switch (model()) {
|
||||||
|
case EMSdevice::EMS_DEVICE_FLAG_RC10:
|
||||||
|
offset = 0;
|
||||||
|
validate_typeid = 0xB1;
|
||||||
|
set_typeid = 0xB2;
|
||||||
|
if (mode == HeatingCircuit::Mode::NOFROST) {
|
||||||
|
set_mode_value = 1;
|
||||||
|
} else if (mode == HeatingCircuit::Mode::NIGHT) {
|
||||||
|
set_mode_value = 2;
|
||||||
|
} else { // DAY
|
||||||
|
set_mode_value = 4;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
||||||
offset = EMS_OFFSET_RC20Set_mode;
|
offset = EMS_OFFSET_RC20Set_mode;
|
||||||
validate_typeid = set_typeids[hc_p];
|
validate_typeid = set_typeids[hc_p];
|
||||||
@@ -1918,7 +1963,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
|
|||||||
|
|
||||||
// add the write command to the Tx queue
|
// add the write command to the Tx queue
|
||||||
// post validate is the corresponding monitor or set type IDs as they can differ per model
|
// post validate is the corresponding monitor or set type IDs as they can differ per model
|
||||||
write_command(set_typeids[hc->hc_num() - 1], offset, set_mode_value, validate_typeid);
|
write_command(set_typeid, offset, set_mode_value, validate_typeid);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2627,12 +2672,12 @@ void Thermostat::register_device_values() {
|
|||||||
DeviceValueUOM::DEGREES,
|
DeviceValueUOM::DEGREES,
|
||||||
MAKE_CF_CB(set_calinttemp));
|
MAKE_CF_CB(set_calinttemp));
|
||||||
register_device_value(TAG_THERMOSTAT_DATA,
|
register_device_value(TAG_THERMOSTAT_DATA,
|
||||||
&ibaBuildingType_,
|
&heatingpid_,
|
||||||
DeviceValueType::ENUM,
|
DeviceValueType::ENUM,
|
||||||
FL_(enum_ibaBuildingType),
|
FL_(enum_PID),
|
||||||
FL_(ibaBuildingType),
|
FL_(heatingPID),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_building));
|
MAKE_CF_CB(set_heatingpid));
|
||||||
register_device_value(TAG_THERMOSTAT_DATA, &backlight_, DeviceValueType::BOOL, nullptr, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight));
|
register_device_value(TAG_THERMOSTAT_DATA, &backlight_, DeviceValueType::BOOL, nullptr, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight));
|
||||||
register_device_value(TAG_DEVICE_DATA_WW, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode));
|
register_device_value(TAG_DEVICE_DATA_WW, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode));
|
||||||
break;
|
break;
|
||||||
@@ -2843,7 +2888,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
|
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case EMS_DEVICE_FLAG_RC10:
|
case EMS_DEVICE_FLAG_RC10:
|
||||||
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode6), FL_(mode), DeviceValueUOM::NONE);
|
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode6), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode));
|
||||||
register_device_value(tag, &hc->daytemp, DeviceValueType::UINT, FL_(div2), FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp));
|
register_device_value(tag, &hc->daytemp, DeviceValueType::UINT, FL_(div2), FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp));
|
||||||
register_device_value(tag, &hc->nighttemp, DeviceValueType::UINT, FL_(div2), FL_(nighttemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_nighttemp));
|
register_device_value(tag, &hc->nighttemp, DeviceValueType::UINT, FL_(div2), FL_(nighttemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_nighttemp));
|
||||||
register_device_value(tag, &hc->reducehours, DeviceValueType::UINT, nullptr, FL_(reducehours), DeviceValueUOM::HOURS, MAKE_CF_CB(set_reducehours));
|
register_device_value(tag, &hc->reducehours, DeviceValueType::UINT, nullptr, FL_(reducehours), DeviceValueUOM::HOURS, MAKE_CF_CB(set_reducehours));
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ class Thermostat : public EMSdevice {
|
|||||||
int8_t ibaClockOffset_; // offset (in sec) to clock, 0xff = -1 s, 0x02 = 2 s
|
int8_t ibaClockOffset_; // offset (in sec) to clock, 0xff = -1 s, 0x02 = 2 s
|
||||||
uint8_t ibaDamping_; // damping 0-off, 0xff-on
|
uint8_t ibaDamping_; // damping 0-off, 0xff-on
|
||||||
uint8_t backlight_;
|
uint8_t backlight_;
|
||||||
|
uint8_t heatingpid_;
|
||||||
|
|
||||||
int8_t dampedoutdoortemp_;
|
int8_t dampedoutdoortemp_;
|
||||||
uint16_t tempsensor1_;
|
uint16_t tempsensor1_;
|
||||||
@@ -298,6 +299,7 @@ class Thermostat : public EMSdevice {
|
|||||||
void process_RC20Set_2(std::shared_ptr<const Telegram> telegram);
|
void process_RC20Set_2(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_RC10Monitor(std::shared_ptr<const Telegram> telegram);
|
void process_RC10Monitor(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_RC10Set(std::shared_ptr<const Telegram> telegram);
|
void process_RC10Set(std::shared_ptr<const Telegram> telegram);
|
||||||
|
void process_RC10Set_2(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_CRFMonitor(std::shared_ptr<const Telegram> telegram);
|
void process_CRFMonitor(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_RC300Monitor(std::shared_ptr<const Telegram> telegram);
|
void process_RC300Monitor(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_RC300Set(std::shared_ptr<const Telegram> telegram);
|
void process_RC300Set(std::shared_ptr<const Telegram> telegram);
|
||||||
@@ -384,6 +386,7 @@ class Thermostat : public EMSdevice {
|
|||||||
bool set_heatingtype(const char * value, const int8_t id);
|
bool set_heatingtype(const char * value, const int8_t id);
|
||||||
bool set_reducehours(const char * value, const int8_t id);
|
bool set_reducehours(const char * value, const int8_t id);
|
||||||
bool set_backlight(const char * value, const int8_t id);
|
bool set_backlight(const char * value, const int8_t id);
|
||||||
|
bool set_heatingpid(const char * value, const int8_t id);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -326,6 +326,7 @@ MAKE_PSTR_LIST(enum_ibaMainDisplay,
|
|||||||
MAKE_PSTR_LIST(enum_ibaLanguage, F_(german), F_(dutch), F_(french), F_(italian))
|
MAKE_PSTR_LIST(enum_ibaLanguage, F_(german), F_(dutch), F_(french), F_(italian))
|
||||||
MAKE_PSTR_LIST(enum_floordrystatus, F_(off), F_(start), F_(heat), F_(hold), F_(cool), F_(end))
|
MAKE_PSTR_LIST(enum_floordrystatus, F_(off), F_(start), F_(heat), F_(hold), F_(cool), F_(end))
|
||||||
MAKE_PSTR_LIST(enum_ibaBuildingType, F_(light), F_(medium), F_(heavy))
|
MAKE_PSTR_LIST(enum_ibaBuildingType, F_(light), F_(medium), F_(heavy))
|
||||||
|
MAKE_PSTR_LIST(enum_PID, F("fast"), F_(medium), F("slow"))
|
||||||
MAKE_PSTR_LIST(enum_wwMode, F_(off), F_(low), F_(high), F_(auto), F_(own_prog))
|
MAKE_PSTR_LIST(enum_wwMode, F_(off), F_(low), F_(high), F_(auto), F_(own_prog))
|
||||||
MAKE_PSTR_LIST(enum_wwCircMode, F_(off), F_(on), F_(auto), F_(own_prog))
|
MAKE_PSTR_LIST(enum_wwCircMode, F_(off), F_(on), F_(auto), F_(own_prog))
|
||||||
MAKE_PSTR_LIST(enum_wwMode2, F_(off), F_(on), F_(auto))
|
MAKE_PSTR_LIST(enum_wwMode2, F_(off), F_(on), F_(auto))
|
||||||
@@ -541,6 +542,7 @@ MAKE_PSTR_LIST(ibaMainDisplay, F("display"), F("display"))
|
|||||||
MAKE_PSTR_LIST(ibaLanguage, F("language"), F("language"))
|
MAKE_PSTR_LIST(ibaLanguage, F("language"), F("language"))
|
||||||
MAKE_PSTR_LIST(ibaClockOffset, F("clockoffset"), F("clock offset"))
|
MAKE_PSTR_LIST(ibaClockOffset, F("clockoffset"), F("clock offset"))
|
||||||
MAKE_PSTR_LIST(ibaBuildingType, F("building"), F("building"))
|
MAKE_PSTR_LIST(ibaBuildingType, F("building"), F("building"))
|
||||||
|
MAKE_PSTR_LIST(heatingPID, F("heatingpid"), F("heating PID"))
|
||||||
MAKE_PSTR_LIST(ibaCalIntTemperature, F("intoffset"), F("offset internal temperature"))
|
MAKE_PSTR_LIST(ibaCalIntTemperature, F("intoffset"), F("offset internal temperature"))
|
||||||
MAKE_PSTR_LIST(ibaMinExtTemperature, F("minexttemp"), F("minimal external temperature"))
|
MAKE_PSTR_LIST(ibaMinExtTemperature, F("minexttemp"), F("minimal external temperature"))
|
||||||
MAKE_PSTR_LIST(backlight, F("backlight"), F("key backlight"))
|
MAKE_PSTR_LIST(backlight, F("backlight"), F("key backlight"))
|
||||||
|
|||||||
Reference in New Issue
Block a user