mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
@@ -32,6 +32,7 @@
|
|||||||
- min/max in web value setting
|
- min/max in web value setting
|
||||||
- Extend customization to select if an entity is to be shown in the WebUI or forced as read-only [#317](https://github.com/emsesp/EMS-ESP32/issues/317)
|
- Extend customization to select if an entity is to be shown in the WebUI or forced as read-only [#317](https://github.com/emsesp/EMS-ESP32/issues/317)
|
||||||
- Added Moduline 400 installation parameters [PR #449 by @kwertie01](https://github.com/emsesp/EMS-ESP32/pull/449)
|
- Added Moduline 400 installation parameters [PR #449 by @kwertie01](https://github.com/emsesp/EMS-ESP32/pull/449)
|
||||||
|
- Read time from IVT-controller [#439](https://github.com/emsesp/EMS-ESP32/issues/439)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@
|
|||||||
- removed system/pin command, new commands in analogsensors
|
- removed system/pin command, new commands in analogsensors
|
||||||
- system/info device-info split to name/version/brand
|
- system/info device-info split to name/version/brand
|
||||||
- exclude list uses short-names, possible flags for web/api/mqtt excludes, readonly and favorite (selection not yet implemented)
|
- exclude list uses short-names, possible flags for web/api/mqtt excludes, readonly and favorite (selection not yet implemented)
|
||||||
|
- thermostat clock formate date-time: dd.mm.yyyy hh:mm
|
||||||
|
- RC300 summermode as other thermostats `winter/summer` instead of `off/on`
|
||||||
|
|
||||||
## **BREAKING CHANGES:**
|
## **BREAKING CHANGES:**
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ const FirmwareFileUpload: FC<UploadFirmwareProps> = ({ uploadFirmware }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{!uploading && (
|
||||||
<MessageBox
|
<MessageBox
|
||||||
message="Upload a new firmware (.bin) file below to replace the existing firmware"
|
message="Upload a new firmware (.bin) file below to replace the existing firmware"
|
||||||
level="warning"
|
level="warning"
|
||||||
my={2}
|
my={2}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
<SingleUpload
|
<SingleUpload
|
||||||
accept=".bin"
|
accept=".bin"
|
||||||
onDrop={uploadFile}
|
onDrop={uploadFile}
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &totalCompStarts_, DeviceValueType::ULONG, nullptr, FL_(totalCompStarts), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &totalCompStarts_, DeviceValueType::ULONG, nullptr, FL_(totalCompStarts), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &heatingStarts_, DeviceValueType::ULONG, nullptr, FL_(heatingStarts), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &heatingStarts_, DeviceValueType::ULONG, nullptr, FL_(heatingStarts), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &coolingStarts_, DeviceValueType::ULONG, nullptr, FL_(coolingStarts), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &coolingStarts_, DeviceValueType::ULONG, nullptr, FL_(coolingStarts), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &wwStarts2_, DeviceValueType::ULONG, nullptr, FL_(wwStarts2), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwStarts2_, DeviceValueType::ULONG, nullptr, FL_(wwStarts2), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &poolStarts_, DeviceValueType::ULONG, nullptr, FL_(poolStarts), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &poolStarts_, DeviceValueType::ULONG, nullptr, FL_(poolStarts), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &nrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsTotal), DeviceValueUOM::KWH);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &nrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsTotal), DeviceValueUOM::KWH);
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &nrgConsCompTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompTotal), DeviceValueUOM::KWH);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &nrgConsCompTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompTotal), DeviceValueUOM::KWH);
|
||||||
|
|||||||
@@ -24,6 +24,28 @@ REGISTER_FACTORY(Controller, EMSdevice::DeviceType::CONTROLLER);
|
|||||||
|
|
||||||
Controller::Controller(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)
|
Controller::Controller(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) {
|
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
||||||
|
// IVT broadcasts Thermostat time from controller (0x09) if display is off.
|
||||||
|
register_telegram_type(0x06, F("RCTime"), false, MAKE_PF_CB(process_dateTime));
|
||||||
|
register_device_value(DeviceValueTAG::TAG_NONE, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// process_dateTime - type 0x06 - date and time from a thermostat - 14 bytes long, IVT only
|
||||||
|
void Controller::process_dateTime(std::shared_ptr<const Telegram> telegram) {
|
||||||
|
if (telegram->offset > 0 || telegram->message_length < 5) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char newdatetime[sizeof(dateTime_)];
|
||||||
|
// publich as dd.mm.yyyy hh:mmF
|
||||||
|
snprintf(newdatetime,
|
||||||
|
sizeof(dateTime_),
|
||||||
|
"%02d.%02d.%04d %02d:%02d",
|
||||||
|
telegram->message_data[3],
|
||||||
|
telegram->message_data[1] - 1,
|
||||||
|
(telegram->message_data[0] & 0x7F) + 2000,
|
||||||
|
telegram->message_data[2],
|
||||||
|
telegram->message_data[4]);
|
||||||
|
has_update(dateTime_, newdatetime, sizeof(dateTime_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
@@ -26,6 +26,10 @@ namespace emsesp {
|
|||||||
class Controller : public EMSdevice {
|
class Controller : public EMSdevice {
|
||||||
public:
|
public:
|
||||||
Controller(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);
|
Controller(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);
|
||||||
|
|
||||||
|
void process_dateTime(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|
||||||
|
char dateTime_[25];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -1221,28 +1221,6 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// render date to HH:MM:SS DD/MM/YYYY
|
|
||||||
// had to create separate buffers because of how printf works
|
|
||||||
char date[sizeof(dateTime_)];
|
|
||||||
char buf1[6];
|
|
||||||
char buf2[6];
|
|
||||||
char buf3[6];
|
|
||||||
char buf4[6];
|
|
||||||
char buf5[6];
|
|
||||||
char buf6[6];
|
|
||||||
snprintf(date,
|
|
||||||
sizeof(date),
|
|
||||||
"%s:%s:%s %s.%s.%s",
|
|
||||||
Helpers::smallitoa(buf1, telegram->message_data[2]), // hour
|
|
||||||
Helpers::smallitoa(buf2, telegram->message_data[4]), // minute
|
|
||||||
Helpers::smallitoa(buf3, telegram->message_data[5]), // second
|
|
||||||
Helpers::smallitoa(buf4, telegram->message_data[3]), // day
|
|
||||||
Helpers::smallitoa(buf5, telegram->message_data[1]), // month
|
|
||||||
// IVT reports Year with high bit set.?
|
|
||||||
Helpers::itoa((telegram->message_data[0] & 0x7F) + 2000, buf6) // year
|
|
||||||
);
|
|
||||||
has_update(dateTime_, date, sizeof(dateTime_));
|
|
||||||
|
|
||||||
// check clock
|
// check clock
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
tm * tm_ = localtime(&now);
|
tm * tm_ = localtime(&now);
|
||||||
@@ -1254,8 +1232,14 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
|||||||
tm_->tm_min = telegram->message_data[4];
|
tm_->tm_min = telegram->message_data[4];
|
||||||
tm_->tm_sec = telegram->message_data[5];
|
tm_->tm_sec = telegram->message_data[5];
|
||||||
tm_->tm_isdst = telegram->message_data[7] & 0x01;
|
tm_->tm_isdst = telegram->message_data[7] & 0x01;
|
||||||
time_t ttime = mktime(tm_); // thermostat time
|
|
||||||
|
// render date to DD.MM.YYYY HH:MM and publish
|
||||||
|
char newdatetime[sizeof(dateTime_)];
|
||||||
|
strftime(newdatetime, sizeof(dateTime_), "%d.%m.%G %H:%M", tm_);
|
||||||
|
has_update(dateTime_, newdatetime, sizeof(dateTime_));
|
||||||
|
|
||||||
bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439
|
bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439
|
||||||
|
time_t ttime = mktime(tm_); // thermostat time
|
||||||
// correct thermostat clock if we have valid ntp time, and could write the command
|
// correct thermostat clock if we have valid ntp time, and could write the command
|
||||||
if (!ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
|
if (!ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
|
||||||
double difference = difftime(now, ttime);
|
double difference = difftime(now, ttime);
|
||||||
@@ -1879,7 +1863,7 @@ bool Thermostat::set_party(const char * value, const int8_t id) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set date&time as string hh:mm:ss-dd.mm.yyyy-dw-dst or "NTP" for setting to internet-time
|
// set date&time as string dd.mm.yyyy-hh:mm:ss-dw-dst or "NTP" for setting to internet-time
|
||||||
// dw - day of week (0..6), dst- summertime (0/1)
|
// dw - day of week (0..6), dst- summertime (0/1)
|
||||||
// id is ignored
|
// id is ignored
|
||||||
bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
||||||
@@ -1907,25 +1891,20 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
|||||||
data[5] = tm_->tm_sec;
|
data[5] = tm_->tm_sec;
|
||||||
data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su
|
data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su
|
||||||
data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock
|
data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock
|
||||||
// char time_string[25];
|
|
||||||
// strftime(time_string, 25, "%FT%T%z", tm_);
|
|
||||||
// LOG_INFO(F("Date and time: %s"), time_string);
|
|
||||||
} else if (dt.length() == 23) {
|
} else if (dt.length() == 23) {
|
||||||
data[0] = (dt[16] - '0') * 100 + (dt[17] - '0') * 10 + (dt[18] - '0'); // year
|
data[0] = (dt[7] - '0') * 100 + (dt[8] - '0') * 10 + (dt[9] - '0'); // year
|
||||||
data[1] = (dt[12] - '0') * 10 + (dt[13] - '0'); // month
|
data[1] = (dt[3] - '0') * 10 + (dt[4] - '0'); // month
|
||||||
data[2] = (dt[0] - '0') * 10 + (dt[1] - '0'); // hour
|
data[2] = (dt[11] - '0') * 10 + (dt[12] - '0'); // hour
|
||||||
data[3] = (dt[9] - '0') * 10 + (dt[10] - '0'); // day
|
data[3] = (dt[0] - '0') * 10 + (dt[1] - '0'); // day
|
||||||
data[4] = (dt[3] - '0') * 10 + (dt[4] - '0'); // min
|
data[4] = (dt[14] - '0') * 10 + (dt[15] - '0'); // min
|
||||||
data[5] = (dt[6] - '0') * 10 + (dt[7] - '0'); // sec
|
data[5] = (dt[17] - '0') * 10 + (dt[18] - '0'); // sec
|
||||||
data[6] = (dt[20] - '0'); // day of week, Mo:0
|
data[6] = (dt[20] - '0'); // day of week, Mo:0
|
||||||
data[7] = (dt[22] - '0') + 2; // DST and flag
|
data[7] = (dt[22] - '0') + 2; // DST and flag
|
||||||
// LOG_INFO(F("Date and time: %02d.%02d.2%03d-%02d:%02d:%02d"), data[3], data[1], data[0], data[2], data[4], data[5]);
|
|
||||||
} else {
|
} else {
|
||||||
LOG_WARNING(F("Set date: invalid data, wrong length"));
|
LOG_WARNING(F("Set date: invalid data, wrong length"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) {
|
if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) {
|
||||||
// LOG_WARNING(F("Set date: invalid data"));
|
|
||||||
LOG_WARNING(F("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]);
|
LOG_WARNING(F("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3123,7 +3102,8 @@ void Thermostat::register_device_values() {
|
|||||||
FL_(ibaClockOffset),
|
FL_(ibaClockOffset),
|
||||||
DeviceValueUOM::SECONDS,
|
DeviceValueUOM::SECONDS,
|
||||||
MAKE_CF_CB(set_clockoffset)); // offset (in sec) to clock, 0xff=-1s, 0x02=2s
|
MAKE_CF_CB(set_clockoffset)); // offset (in sec) to clock, 0xff=-1s, 0x02=2s
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &autodst_, DeviceValueType::BOOL, nullptr, FL_(autodst), DeviceValueUOM::NONE, MAKE_CF_CB(set_autodst));
|
register_device_value(
|
||||||
|
DeviceValueTAG::TAG_THERMOSTAT_DATA, &autodst_, DeviceValueType::BOOL, nullptr, FL_(autodst), DeviceValueUOM::NONE, MAKE_CF_CB(set_autodst));
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
||||||
&ibaLanguage_,
|
&ibaLanguage_,
|
||||||
DeviceValueType::ENUM,
|
DeviceValueType::ENUM,
|
||||||
@@ -3137,7 +3117,8 @@ void Thermostat::register_device_values() {
|
|||||||
FL_(enum_ibaMainDisplay),
|
FL_(enum_ibaMainDisplay),
|
||||||
FL_(ibaMainDisplay),
|
FL_(ibaMainDisplay),
|
||||||
DeviceValueUOM::NONE);
|
DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &backlight_, DeviceValueType::BOOL, nullptr, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight));
|
register_device_value(
|
||||||
|
DeviceValueTAG::TAG_THERMOSTAT_DATA, &backlight_, DeviceValueType::BOOL, nullptr, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight));
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
||||||
&brightness_,
|
&brightness_,
|
||||||
DeviceValueType::INT,
|
DeviceValueType::INT,
|
||||||
@@ -3170,7 +3151,13 @@ void Thermostat::register_device_values() {
|
|||||||
FL_(heatingPID),
|
FL_(heatingPID),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_heatingpid));
|
MAKE_CF_CB(set_heatingpid));
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &preheating_, DeviceValueType::BOOL, nullptr, FL_(preheating), DeviceValueUOM::NONE, MAKE_CF_CB(set_preheating));
|
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
||||||
|
&preheating_,
|
||||||
|
DeviceValueType::BOOL,
|
||||||
|
nullptr,
|
||||||
|
FL_(preheating),
|
||||||
|
DeviceValueUOM::NONE,
|
||||||
|
MAKE_CF_CB(set_preheating));
|
||||||
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA,
|
||||||
&ibaCalIntTemperature_,
|
&ibaCalIntTemperature_,
|
||||||
DeviceValueType::INT,
|
DeviceValueType::INT,
|
||||||
@@ -3499,7 +3486,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::NONE, MAKE_CF_CB(set_heatingtype));
|
tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::NONE, MAKE_CF_CB(set_heatingtype));
|
||||||
register_device_value(
|
register_device_value(
|
||||||
tag, &hc->summer_setmode, DeviceValueType::ENUM, FL_(enum_summermode), FL_(summersetmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_summermode));
|
tag, &hc->summer_setmode, DeviceValueType::ENUM, FL_(enum_summermode), FL_(summersetmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_summermode));
|
||||||
register_device_value(tag, &hc->summermode, DeviceValueType::BOOL, nullptr, FL_(summermode), DeviceValueUOM::NONE);
|
register_device_value(tag, &hc->summermode, DeviceValueType::ENUM, FL_(enum_summer), FL_(summermode), DeviceValueUOM::NONE);
|
||||||
register_device_value(
|
register_device_value(
|
||||||
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_controlmode));
|
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_controlmode));
|
||||||
register_device_value(tag, &hc->program, DeviceValueType::ENUM, FL_(enum_progMode), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
register_device_value(tag, &hc->program, DeviceValueType::ENUM, FL_(enum_progMode), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ void EMSdevice::publish_value(void * value_p) const {
|
|||||||
Helpers::render_value(payload, *(uint32_t *)(value_p), divider, fahrenheit);
|
Helpers::render_value(payload, *(uint32_t *)(value_p), divider, fahrenheit);
|
||||||
break;
|
break;
|
||||||
case DeviceValueType::BOOL: {
|
case DeviceValueType::BOOL: {
|
||||||
Helpers::render_boolean(payload, (bool)(*(uint8_t *)(value_p)));
|
Helpers::render_boolean(payload, (bool)*(uint8_t *)(value_p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DeviceValueType::TIME:
|
case DeviceValueType::TIME:
|
||||||
@@ -646,12 +646,10 @@ void EMSdevice::generate_values_web(JsonObject & output) {
|
|||||||
JsonObject obj = data.createNestedObject(); // create the object, we know there is a value
|
JsonObject obj = data.createNestedObject(); // create the object, we know there is a value
|
||||||
uint8_t fahrenheit = 0;
|
uint8_t fahrenheit = 0;
|
||||||
|
|
||||||
// handle Booleans (true, false)
|
// handle Booleans (true, false), use strings, no native true/false)
|
||||||
if (dv.type == DeviceValueType::BOOL) {
|
if (dv.type == DeviceValueType::BOOL) {
|
||||||
bool value_b = *(bool *)(dv.value_p);
|
bool value_b = (bool)*(uint8_t *)(dv.value_p);
|
||||||
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
||||||
obj["v"] = value_b ? "true" : "false";
|
|
||||||
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
|
||||||
obj["v"] = value_b ? 1 : 0;
|
obj["v"] = value_b ? 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
char s[7];
|
char s[7];
|
||||||
@@ -765,12 +763,10 @@ void EMSdevice::generate_values_web_all(JsonArray & output) {
|
|||||||
|
|
||||||
// create the value
|
// create the value
|
||||||
if (dv.hasValue()) {
|
if (dv.hasValue()) {
|
||||||
// handle Booleans (true, false)
|
// handle Booleans (true, false), use strings, no native true/false)
|
||||||
if (dv.type == DeviceValueType::BOOL) {
|
if (dv.type == DeviceValueType::BOOL) {
|
||||||
bool value_b = *(bool *)(dv.value_p);
|
bool value_b = (bool)*(uint8_t *)(dv.value_p);
|
||||||
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
||||||
obj["v"] = value_b;
|
|
||||||
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
|
||||||
obj["v"] = value_b ? 1 : 0;
|
obj["v"] = value_b ? 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
char s[7];
|
char s[7];
|
||||||
@@ -975,7 +971,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8
|
|||||||
|
|
||||||
case DeviceValueType::BOOL:
|
case DeviceValueType::BOOL:
|
||||||
if (Helpers::hasValue(*(uint8_t *)(dv.value_p), EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(*(uint8_t *)(dv.value_p), EMS_VALUE_BOOL)) {
|
||||||
auto value_b = (bool)(*(uint8_t *)(dv.value_p));
|
bool value_b = (bool)*(uint8_t *)(dv.value_p);
|
||||||
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
||||||
json[value] = value_b;
|
json[value] = value_b;
|
||||||
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
||||||
@@ -1108,7 +1104,7 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
|
|||||||
// handle Booleans
|
// handle Booleans
|
||||||
if (dv.type == DeviceValueType::BOOL && Helpers::hasValue(*(uint8_t *)(dv.value_p), EMS_VALUE_BOOL)) {
|
if (dv.type == DeviceValueType::BOOL && Helpers::hasValue(*(uint8_t *)(dv.value_p), EMS_VALUE_BOOL)) {
|
||||||
// see how to render the value depending on the setting
|
// see how to render the value depending on the setting
|
||||||
auto value_b = (bool)*(uint8_t *)(dv.value_p);
|
bool value_b = (bool)*(uint8_t *)(dv.value_p);
|
||||||
if (Mqtt::ha_enabled() && (output_target == OUTPUT_TARGET::MQTT)) {
|
if (Mqtt::ha_enabled() && (output_target == OUTPUT_TARGET::MQTT)) {
|
||||||
char s[7];
|
char s[7];
|
||||||
json[name] = Helpers::render_boolean(s, value_b); // for HA always render as string
|
json[name] = Helpers::render_boolean(s, value_b); // for HA always render as string
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ MAKE_PSTR(functioning_mode, "functioning mode")
|
|||||||
MAKE_PSTR(smoke_temperature, "Abgastemperatur")
|
MAKE_PSTR(smoke_temperature, "Abgastemperatur")
|
||||||
|
|
||||||
// thermostat lists
|
// thermostat lists
|
||||||
MAKE_PSTR_LIST(tpl_datetime, F("Format: < hh:mm:ss dd/mm/yyyy-dw-dst | NTP >"))
|
MAKE_PSTR_LIST(tpl_datetime, F("Format: < NTP | dd.mm.yyyy-hh:mm:ss-dw-dst >"))
|
||||||
MAKE_PSTR_LIST(tpl_switchtime, F("Format: < nn.d.o.hh:mm >"))
|
MAKE_PSTR_LIST(tpl_switchtime, F("Format: < nn.d.o.hh:mm >"))
|
||||||
MAKE_PSTR_LIST(tpl_holidays, F("Format: < dd.mm.yyyy-dd.mm.yyyy >"))
|
MAKE_PSTR_LIST(tpl_holidays, F("Format: < dd.mm.yyyy-dd.mm.yyyy >"))
|
||||||
MAKE_PSTR_LIST(enum_ibaMainDisplay,
|
MAKE_PSTR_LIST(enum_ibaMainDisplay,
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ MAKE_PSTR(functioning_mode, "functioning mode")
|
|||||||
MAKE_PSTR(smoke_temperature, "smoke temperature")
|
MAKE_PSTR(smoke_temperature, "smoke temperature")
|
||||||
|
|
||||||
// thermostat lists
|
// thermostat lists
|
||||||
MAKE_PSTR_LIST(tpl_datetime, F("Format: < NTP | hh:mm:ss dd.mm.yyyy-dw-dst >"))
|
MAKE_PSTR_LIST(tpl_datetime, F("Format: < NTP | dd.mm.yyyy-hh:mm:ss-dw-dst >"))
|
||||||
MAKE_PSTR_LIST(tpl_switchtime, F("Format: <nn> [ not_set | day hh:mm on|off ]"))
|
MAKE_PSTR_LIST(tpl_switchtime, F("Format: <nn> [ not_set | day hh:mm on|off ]"))
|
||||||
MAKE_PSTR_LIST(tpl_holidays, F("format: < dd.mm.yyyy-dd.mm.yyyy >"))
|
MAKE_PSTR_LIST(tpl_holidays, F("format: < dd.mm.yyyy-dd.mm.yyyy >"))
|
||||||
MAKE_PSTR_LIST(enum_ibaMainDisplay,
|
MAKE_PSTR_LIST(enum_ibaMainDisplay,
|
||||||
@@ -541,7 +541,7 @@ MAKE_PSTR_LIST(wwSetPumpPower, F("wwsetpumppower"), F("set pump power"))
|
|||||||
MAKE_PSTR_LIST(wwMixerTemp, F("wwmixertemp"), F("mixer temperature"))
|
MAKE_PSTR_LIST(wwMixerTemp, F("wwmixertemp"), F("mixer temperature"))
|
||||||
MAKE_PSTR_LIST(wwCylMiddleTemp, F("wwcylmiddletemp"), F("cylinder middle temperature (TS3)"))
|
MAKE_PSTR_LIST(wwCylMiddleTemp, F("wwcylmiddletemp"), F("cylinder middle temperature (TS3)"))
|
||||||
MAKE_PSTR_LIST(wwStarts, F("wwstarts"), F("starts"))
|
MAKE_PSTR_LIST(wwStarts, F("wwstarts"), F("starts"))
|
||||||
MAKE_PSTR_LIST(wwStarts2, F("wwstarts2"), F("control starts"))
|
MAKE_PSTR_LIST(wwStarts2, F("wwstarts2"), F("control starts2"))
|
||||||
MAKE_PSTR_LIST(wwWorkM, F("wwworkm"), F("active time"))
|
MAKE_PSTR_LIST(wwWorkM, F("wwworkm"), F("active time"))
|
||||||
MAKE_PSTR_LIST(wwHystOn, F("wwhyston"), F("hysteresis on temperature"))
|
MAKE_PSTR_LIST(wwHystOn, F("wwhyston"), F("hysteresis on temperature"))
|
||||||
MAKE_PSTR_LIST(wwHystOff, F("wwhystoff"), F("hysteresis off temperature"))
|
MAKE_PSTR_LIST(wwHystOff, F("wwhystoff"), F("hysteresis off temperature"))
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
|||||||
// Ignore Contoller
|
// Ignore Contoller
|
||||||
JsonArray devices = root.createNestedArray("devices");
|
JsonArray devices = root.createNestedArray("devices");
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice && emsdevice->device_type() != EMSdevice::DeviceType::CONTROLLER) {
|
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::CONTROLLER || emsdevice->count_entities() > 0)) {
|
||||||
JsonObject obj = devices.createNestedObject();
|
JsonObject obj = devices.createNestedObject();
|
||||||
obj["i"] = emsdevice->unique_id(); // a unique id
|
obj["i"] = emsdevice->unique_id(); // a unique id
|
||||||
obj["t"] = emsdevice->device_type_name(); // type
|
obj["t"] = emsdevice->device_type_name(); // type
|
||||||
|
|||||||
Reference in New Issue
Block a user