move rf sensor to thermostat #624

This commit is contained in:
MichaelDvP
2022-09-19 15:45:00 +02:00
parent ef842b6c52
commit b22473d0d0
4 changed files with 16 additions and 23 deletions

View File

@@ -26,21 +26,6 @@ uuid::log::Logger Generic::logger_{F_(generic), uuid::log::Facility::CONSOLE};
Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand)
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
// RF-Sensor 0x40 sending temperature in telegram 0x435, see https://github.com/emsesp/EMS-ESP32/issues/103
if (device_id == 0x40) {
register_telegram_type(0x435, F("RFSensorMessage"), false, MAKE_PF_CB(process_RFSensorMessage));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&rfTemp_,
DeviceValueType::SHORT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(RFTemp),
DeviceValueUOM::DEGREES);
}
}
// type 0x435 rf remote sensor
void Generic::process_RFSensorMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, rfTemp_, 0); // is * 10
}
} // namespace emsesp

View File

@@ -29,10 +29,6 @@ class Generic : public EMSdevice {
private:
static uuid::log::Logger logger_;
int16_t rfTemp_;
void process_RFSensorMessage(std::shared_ptr<const Telegram> telegram);
};
} // namespace emsesp

View File

@@ -28,8 +28,13 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
uint8_t model = this->model();
// remote thermostats with humidity
if (device_id >= 0x38 && device_id <= 0x3F) { // RC100H remote
// RF remote sensor seen at 0x40, maybe this is also for different hc with id 0x40 - 0x47? emsesp.cpp maps only 0x40
if (device_id >= 0x40 && device_id <= 0x47) {
register_telegram_type(0x0435, F("RFTemp"), false, MAKE_PF_CB(process_RemoteTemp));
return;
}
// remote thermostats with humidity: RC100H remote
if (device_id >= 0x38 && device_id <= 0x3F) {
register_telegram_type(0x042B, F("RemoteTemp"), false, MAKE_PF_CB(process_RemoteTemp));
register_telegram_type(0x047B, F("RemoteHumidity"), false, MAKE_PF_CB(process_RemoteHumidity));
register_telegram_type(0x0273, F("RemoteCorrection"), true, MAKE_PF_CB(process_RemoteCorrection));
@@ -3321,6 +3326,12 @@ bool Thermostat::set_remoteseltemp(const char * value, const int8_t id) {
// register main device values, top level for all thermostats (excluding heating circuits)
// as these are done in void Thermostat::register_device_values_hc()
void Thermostat::register_device_values() {
// RF remote sensor seen at 0x40, maybe this is also for different hc with id 0x40 - 0x47? emsesp.cpp maps only 0x40
if (device_id() >= 0x40 && device_id() <= 0x47) {
uint8_t tag = DeviceValueTAG::TAG_HC1 + device_id() - 0x40;
register_device_value(tag, &tempsensor1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(RFTemp), DeviceValueUOM::DEGREES);
return;
}
// RC100H remote with humidity, this is also EMS_DEVICE_FLAG_RC100 for set_calinttemp
if (device_id() >= 0x38 && device_id() <= 0x3F) {
// each device controls only one hc, so we tag the values

View File

@@ -991,8 +991,9 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
if (product_id == 0) {
// check for known device IDs
if (device_id == 0x40) {
// see: https://github.com/emsesp/EMS-ESP32/issues/103#issuecomment-911717342
name = "rf room temperature sensor"; // generic
// see: https://github.com/emsesp/EMS-ESP32/issues/103#issuecomment-911717342 and https://github.com/emsesp/EMS-ESP32/issues/624
name = "rf room temperature sensor";
device_type = DeviceType::THERMOSTAT;
} else if (device_id == 0x17) {
name = "generic thermostat";
device_type = DeviceType::THERMOSTAT;