mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Merge pull request #2298 from MichaelDvP/dev
update for #2294 and #2295
This commit is contained in:
@@ -13,6 +13,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/).
|
|||||||
- Mask bits for bool custom entities
|
- Mask bits for bool custom entities
|
||||||
- thermostat `reduce threshold` [#2288](https://github.com/emsesp/EMS-ESP32/issues/2288)
|
- thermostat `reduce threshold` [#2288](https://github.com/emsesp/EMS-ESP32/issues/2288)
|
||||||
- thermostat `absent` [#1957](https://github.com/emsesp/EMS-ESP32/issues/1957)
|
- thermostat `absent` [#1957](https://github.com/emsesp/EMS-ESP32/issues/1957)
|
||||||
|
- CR11 thermostat [#2295](https://github.com/emsesp/EMS-ESP32/issues/2295)
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/).
|
|||||||
- modbus command path to `api/` [#2276](https://github.com/emsesp/EMS-ESP32/issues/2276)
|
- modbus command path to `api/` [#2276](https://github.com/emsesp/EMS-ESP32/issues/2276)
|
||||||
- info command for devices without entity-commands [#2274](https://github.com/emsesp/EMS-ESP32/issues/2274)
|
- info command for devices without entity-commands [#2274](https://github.com/emsesp/EMS-ESP32/issues/2274)
|
||||||
- CW100 settings telegram 0x241 [#2290](https://github.com/emsesp/EMS-ESP32/issues/2290)
|
- CW100 settings telegram 0x241 [#2290](https://github.com/emsesp/EMS-ESP32/issues/2290)
|
||||||
|
- modbus signed 8bit values [#2294](https://github.com/emsesp/EMS-ESP32/issues/2294)
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
|
|
||||||
// Thermostat - Buderus/Nefit/Bosch specific - 0x17 / 0x10 / 0x18 / 0x19-0x1B for hc2-4 / 0x38
|
// Thermostat - Buderus/Nefit/Bosch specific - 0x17 / 0x10 / 0x18 / 0x19-0x1B for hc2-4 / 0x38
|
||||||
{ 4, DeviceType::THERMOSTAT, "UI800, BC400", DeviceFlags::EMS_DEVICE_FLAG_BC400}, // 0x10
|
{ 4, DeviceType::THERMOSTAT, "UI800, BC400", DeviceFlags::EMS_DEVICE_FLAG_BC400}, // 0x10
|
||||||
|
{ 10, DeviceType::THERMOSTAT, "CR11", DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18
|
||||||
{ 65, DeviceType::THERMOSTAT, "RC10", DeviceFlags::EMS_DEVICE_FLAG_RC20_N},// 0x17
|
{ 65, DeviceType::THERMOSTAT, "RC10", DeviceFlags::EMS_DEVICE_FLAG_RC20_N},// 0x17
|
||||||
{ 67, DeviceType::THERMOSTAT, "RC30", DeviceFlags::EMS_DEVICE_FLAG_RC30_N},// 0x10 - based on RC35
|
{ 67, DeviceType::THERMOSTAT, "RC30", DeviceFlags::EMS_DEVICE_FLAG_RC30_N},// 0x10 - based on RC35
|
||||||
{ 77, DeviceType::THERMOSTAT, "RC20, Moduline 300", DeviceFlags::EMS_DEVICE_FLAG_RC20},// 0x17
|
{ 77, DeviceType::THERMOSTAT, "RC20, Moduline 300", DeviceFlags::EMS_DEVICE_FLAG_RC20},// 0x17
|
||||||
|
|||||||
@@ -1112,6 +1112,9 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// set mode for CR120, BC400, https://github.com/emsesp/EMS-ESP32/discussions/1779
|
// set mode for CR120, BC400, https://github.com/emsesp/EMS-ESP32/discussions/1779
|
||||||
has_update(telegram, hc->mode_new, 21); // for BC400, CR120
|
has_update(telegram, hc->mode_new, 21); // for BC400, CR120
|
||||||
has_bitupdate(telegram, hc->mode, 0, 0); // RC300, RC100
|
has_bitupdate(telegram, hc->mode, 0, 0); // RC300, RC100
|
||||||
|
if (hc->mode == EMS_VALUE_UINT8_NOTSET) {
|
||||||
|
has_update(hc->mode, 0); // set manual for CR11
|
||||||
|
}
|
||||||
has_update(telegram, hc->daytemp, 2); // is * 2
|
has_update(telegram, hc->daytemp, 2); // is * 2
|
||||||
has_update(telegram, hc->nighttemp, 4); // is * 2
|
has_update(telegram, hc->nighttemp, 4); // is * 2
|
||||||
|
|
||||||
@@ -4643,16 +4646,18 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
} else {
|
} else {
|
||||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_control1), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_control1), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||||
}
|
}
|
||||||
register_device_value(tag,
|
if (model != EMSdevice::EMS_DEVICE_FLAG_RC100 && model != EMSdevice::EMS_DEVICE_FLAG_CR120) {
|
||||||
&hc->remotetemp,
|
register_device_value(tag,
|
||||||
DeviceValueType::CMD,
|
&hc->remotetemp,
|
||||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
DeviceValueType::CMD,
|
||||||
FL_(remotetemp),
|
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||||
DeviceValueUOM::DEGREES,
|
FL_(remotetemp),
|
||||||
MAKE_CF_CB(set_remotetemp),
|
DeviceValueUOM::DEGREES,
|
||||||
-1,
|
MAKE_CF_CB(set_remotetemp),
|
||||||
101);
|
-1,
|
||||||
register_device_value(tag, &hc->remotehum, DeviceValueType::CMD, FL_(remotehum), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_remotehum), -1, 101);
|
101);
|
||||||
|
register_device_value(tag, &hc->remotehum, DeviceValueType::CMD, FL_(remotehum), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_remotehum), -1, 101);
|
||||||
|
}
|
||||||
register_device_value(tag, &hc->heatondelay, DeviceValueType::UINT8, FL_(heatondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatondelay), 1, 48);
|
register_device_value(tag, &hc->heatondelay, DeviceValueType::UINT8, FL_(heatondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatondelay), 1, 48);
|
||||||
register_device_value(tag, &hc->heatoffdelay, DeviceValueType::UINT8, FL_(heatoffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatoffdelay), 1, 48);
|
register_device_value(tag, &hc->heatoffdelay, DeviceValueType::UINT8, FL_(heatoffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatoffdelay), 1, 48);
|
||||||
register_device_value(tag, &hc->instantstart, DeviceValueType::UINT8, FL_(instantstart), DeviceValueUOM::K, MAKE_CF_CB(set_instantstart), 1, 10);
|
register_device_value(tag, &hc->instantstart, DeviceValueType::UINT8, FL_(instantstart), DeviceValueUOM::K, MAKE_CF_CB(set_instantstart), 1, 10);
|
||||||
@@ -4669,7 +4674,13 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_switchProgMode));
|
MAKE_CF_CB(set_switchProgMode));
|
||||||
|
|
||||||
register_device_value(tag, &hc->redThreshold, DeviceValueType::INT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(redthreshold), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_redthreshold));
|
register_device_value(tag,
|
||||||
|
&hc->redThreshold,
|
||||||
|
DeviceValueType::INT8,
|
||||||
|
DeviceValueNumOp::DV_NUMOP_DIV2,
|
||||||
|
FL_(redthreshold),
|
||||||
|
DeviceValueUOM::DEGREES,
|
||||||
|
MAKE_CF_CB(set_redthreshold));
|
||||||
break;
|
break;
|
||||||
case EMSdevice::EMS_DEVICE_FLAG_CRF:
|
case EMSdevice::EMS_DEVICE_FLAG_CRF:
|
||||||
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::NONE);
|
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::NONE);
|
||||||
|
|||||||
@@ -1188,7 +1188,7 @@ void EMSdevice::setValueEnum(const void * value_p, const char * const ** options
|
|||||||
if (dv.options != options && Mqtt::ha_enabled()) {
|
if (dv.options != options && Mqtt::ha_enabled()) {
|
||||||
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
||||||
}
|
}
|
||||||
dv.options = options;
|
dv.options = options;
|
||||||
dv.options_size = Helpers::count_items(options);
|
dv.options_size = Helpers::count_items(options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2063,7 +2063,7 @@ int EMSdevice::get_modbus_value(uint8_t tag, const std::string & shortname, std:
|
|||||||
else if (dv.type == DeviceValueType::INT8) {
|
else if (dv.type == DeviceValueType::INT8) {
|
||||||
if (result.size() != 1)
|
if (result.size() != 1)
|
||||||
return -8;
|
return -8;
|
||||||
result[0] = (uint16_t)(uint8_t)(*(int8_t *)(dv.value_p));
|
result[0] = (uint16_t)(int16_t)(*(int8_t *)(dv.value_p));
|
||||||
} else if (dv.type == DeviceValueType::UINT8) {
|
} else if (dv.type == DeviceValueType::UINT8) {
|
||||||
if (result.size() != 1)
|
if (result.size() != 1)
|
||||||
return -9;
|
return -9;
|
||||||
@@ -2136,7 +2136,12 @@ int EMSdevice::modbus_value_to_json(uint8_t tag, const std::string & shortname,
|
|||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonValue["value"] = Helpers::numericoperator2scalefactor(dv.numeric_operator) * (float)((uint16_t)modbus_data[0] << 8 | (uint16_t)modbus_data[1]);
|
if (dv.type == DeviceValueType::INT8 || dv.type == DeviceValueType::INT16) { // handle signed
|
||||||
|
jsonValue["value"] =
|
||||||
|
Helpers::numericoperator2scalefactor(dv.numeric_operator) * (float)(int16_t)((uint16_t)modbus_data[0] << 8 | (uint16_t)modbus_data[1]);
|
||||||
|
} else {
|
||||||
|
jsonValue["value"] = Helpers::numericoperator2scalefactor(dv.numeric_operator) * (float)((uint16_t)modbus_data[0] << 8 | (uint16_t)modbus_data[1]);
|
||||||
|
}
|
||||||
} else if (dv.type == DeviceValueType::UINT24 || dv.type == DeviceValueType::UINT32 || dv.type == DeviceValueType::TIME) {
|
} else if (dv.type == DeviceValueType::UINT24 || dv.type == DeviceValueType::UINT32 || dv.type == DeviceValueType::TIME) {
|
||||||
// these data types are 2 16 bit register
|
// these data types are 2 16 bit register
|
||||||
if (modbus_data.size() != 4) {
|
if (modbus_data.size() != 4) {
|
||||||
|
|||||||
@@ -310,8 +310,11 @@ ModbusMessage Modbus::handleRead(const ModbusMessage & request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code);
|
if (uuid::get_uptime_sec() > 60 || error_code < -2) { // suppress not found messages for the first minute
|
||||||
|
LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code);
|
||||||
|
}
|
||||||
response.setError(request.getServerID(), request.getFunctionCode(), SERVER_DEVICE_FAILURE);
|
response.setError(request.getServerID(), request.getFunctionCode(), SERVER_DEVICE_FAILURE);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.add(request.getServerID());
|
response.add(request.getServerID());
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.7.2-dev.5"
|
#define EMSESP_APP_VERSION "3.7.2-dev.6"
|
||||||
Reference in New Issue
Block a user