Merge branch 'dev2x' into dev2

This commit is contained in:
MichaelDvP
2023-11-14 10:57:43 +01:00
6 changed files with 33 additions and 17 deletions

View File

@@ -530,7 +530,14 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
if (return_code == CommandRet::OK && json.size()) { if (return_code == CommandRet::OK && json.size()) {
if (json.containsKey("api_data")) { if (json.containsKey("api_data")) {
JsonVariant data = json["api_data"]; JsonVariant data = json["api_data"];
shell.println(data.as<const char *>()); if (data.is<int>()) {
shell.printfln("%d", data.as<int>());
} else if (data.is<float>()) {
char s[10];
shell.println(Helpers::render_value(s, data.as<float>(), 1));
} else {
shell.println(data.as<const char *>());
}
return; return;
} }
serializeJsonPretty(doc, shell); serializeJsonPretty(doc, shell);

View File

@@ -25,6 +25,7 @@ REGISTER_FACTORY(Extension, EMSdevice::DeviceType::EXTENSION);
Extension::Extension(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) Extension::Extension(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * 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) {
register_telegram_type(0x935, "EM100SetMessage", true, MAKE_PF_CB(process_EM100SetMessage)); register_telegram_type(0x935, "EM100SetMessage", true, MAKE_PF_CB(process_EM100SetMessage));
register_telegram_type(0x936, "EM100OutMessage", false, MAKE_PF_CB(process_EM100OutMessage));
register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage)); register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage));
register_telegram_type(0x938, "EM100InputMessage", false, MAKE_PF_CB(process_EM100InputMessage)); register_telegram_type(0x938, "EM100InputMessage", false, MAKE_PF_CB(process_EM100InputMessage));
register_telegram_type(0x939, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage)); register_telegram_type(0x939, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage));
@@ -36,7 +37,7 @@ Extension::Extension(uint8_t device_type, uint8_t device_id, uint8_t product_id,
DeviceValueNumOp::DV_NUMOP_DIV10, DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(flowTempVf), FL_(flowTempVf),
DeviceValueUOM::DEGREES); DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &input_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(input), DeviceValueUOM::VOLTS); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &input_, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(input), DeviceValueUOM::VOLTS);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::UINT, FL_(outPower), DeviceValueUOM::PERCENT); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::UINT, FL_(outPower), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPower_, DeviceValueType::UINT, FL_(setPower), DeviceValueUOM::PERCENT); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPower_, DeviceValueType::UINT, FL_(setPower), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPoint_, DeviceValueType::UINT, FL_(setPoint), DeviceValueUOM::DEGREES); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPoint_, DeviceValueType::UINT, FL_(setPoint), DeviceValueUOM::DEGREES);
@@ -61,7 +62,8 @@ Extension::Extension(uint8_t device_type, uint8_t device_id, uint8_t product_id,
} }
// 0x935 needs fetch // extension(0x15) -W-> Me(0x0B), EM100SetMessage(0x0935), data: 00 00 64 50 14
// need to be fetched
void Extension::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram) { void Extension::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, minV_, 1); // Input for off, is / 10 has_update(telegram, minV_, 1); // Input for off, is / 10
has_update(telegram, maxV_, 2); // Input for 100%, is / 10 has_update(telegram, maxV_, 2); // Input for 100%, is / 10
@@ -69,18 +71,22 @@ void Extension::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram
has_update(telegram, maxT_, 4); // max temp has_update(telegram, maxT_, 4); // max temp
} }
// alert(0x15) -B-> All(0x00), ?(0x093A), data: 00 00 00 00 00 00 00 00 00 03 01 // extension(0x15) -B-> All(0x00), ?(0x0936), data: 00 00 00 00 28 00 (offset 1)
void Extension::process_EM100OutMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, outPower_, 5); // power monitor %
}
// extension(0x15) -B-> All(0x00), ?(0x093A), data: 00 00 00 00 00 00 00 00 00 03 01
void Extension::process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram) { void Extension::process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, dip_, 9); has_update(telegram, dip_, 9);
} }
// alert(0x15) -B-> All(0x00), ?(0x0938), data: 01 62 // extension(0x15) -B-> All(0x00), ?(0x0938), data: 01 62
void Extension::process_EM100InputMessage(std::shared_ptr<const Telegram> telegram) { void Extension::process_EM100InputMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, outPower_, 0); // IO1
has_update(telegram, input_, 1); has_update(telegram, input_, 1);
} }
// alert(0x15) -B-> All(0x00), ?(0x0939), data: 64 4E 00 00 // extension(0x15) -B-> All(0x00), ?(0x0939), data: 64 4E 00 00
void Extension::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) { void Extension::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, setPower_, 0); // percent has_update(telegram, setPower_, 0); // percent
has_update(telegram, setPoint_, 1); // °C has_update(telegram, setPoint_, 1); // °C
@@ -88,7 +94,7 @@ void Extension::process_EM100MonitorMessage(std::shared_ptr<const Telegram> tele
// has_update(telegram, errorPump_, 3); // IE0 // has_update(telegram, errorPump_, 3); // IE0
} }
// alert(0x15) -B-> All(0x00), ?(0x0937), data: 80 00 // extension(0x15) -B-> All(0x00), ?(0x0937), data: 80 00
void Extension::process_EM100TempMessage(std::shared_ptr<const Telegram> telegram) { void Extension::process_EM100TempMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, headerTemp_, 0); has_update(telegram, headerTemp_, 0);
} }
@@ -129,4 +135,4 @@ bool Extension::set_maxT(const char * value, const int8_t id) {
return true; return true;
} }
} // namespace emsesp } // namespace emsesp

View File

@@ -29,6 +29,7 @@ class Extension : public EMSdevice {
private: private:
void process_EM100SetMessage(std::shared_ptr<const Telegram> telegram); void process_EM100SetMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100OutMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram); void process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100TempMessage(std::shared_ptr<const Telegram> telegram); void process_EM100TempMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100InputMessage(std::shared_ptr<const Telegram> telegram); void process_EM100InputMessage(std::shared_ptr<const Telegram> telegram);
@@ -41,7 +42,7 @@ class Extension : public EMSdevice {
int16_t headerTemp_; // T0 int16_t headerTemp_; // T0
int16_t input_; // IO1 uint8_t input_; // IO1
uint8_t errorState_; // OE1 uint8_t errorState_; // OE1
uint8_t errorPump_; // IE0 uint8_t errorPump_; // IE0
uint8_t outPower_; // IO1 uint8_t outPower_; // IO1

View File

@@ -976,7 +976,8 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
has_update(telegram, hc->roomTemp, 0); // is * 10 has_update(telegram, hc->roomTemp, 0); // is * 10
has_bitupdate(telegram, hc->modetype, 10, 1); has_bitupdate(telegram, hc->modetype, 10, 1);
// has_bitupdate(telegram, hc->mode, 10, 0); // bit 1, mode (auto=1 or manual=0) // auto status, read mode in settings
// has_bitupdate(telegram, hc->mode, 10, 0); // bit 0, mode (auto=1 or manual=0)
// if manual, take the current setpoint temp at pos 6 // if manual, take the current setpoint temp at pos 6
// if auto, take the next setpoint temp at pos 7 // if auto, take the next setpoint temp at pos 7
@@ -1022,12 +1023,13 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, hc->selTemp, 10, 1); // single byte conversion, value is * 2 - manual // has_update(telegram, hc->selTemp, 10, 1); // single byte conversion, value is * 2 - manual
telegram->read_value(hc->mode_new, 21); // 0-off, 1-manual, 2-auto telegram->read_value(hc->mode_new, 21); // 0-off, 1-manual, 2-auto
if (hc->mode_new < 3) { if (hc->mode_new <= 2) {
has_update(hc->mode, hc->mode_new); has_update(hc->mode, hc->mode_new);
} else { } else {
uint8_t mode = EMS_VALUE_UINT_NOTSET; uint8_t mode = hc->mode == 2 ? 0xFF : 0; // auto : manual
telegram->read_value(mode, 0); if (telegram->read_value(mode, 0)) {
has_update(hc->mode, mode == 0xFF ? 2 : 1); has_update(hc->mode, mode == 0xFF ? 2 : 1);
}
} }
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

View File

@@ -347,7 +347,7 @@ bool EMSdevice::is_fetch(uint16_t telegram_id) const {
return false; return false;
} }
// get received status of telegramID // get receive status of telegramID
bool EMSdevice::is_received(uint16_t telegram_id) const { bool EMSdevice::is_received(uint16_t telegram_id) const {
for (const auto & tf : telegram_functions_) { for (const auto & tf : telegram_functions_) {
if (tf.telegram_type_id_ == telegram_id) { if (tf.telegram_type_id_ == telegram_id) {

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.6.3-dev.8a" #define EMSESP_APP_VERSION "3.6.3-dev.8b"