mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #858 from proddy/dev
fix for #828 - show thermostat hc1 and mixer wwc
This commit is contained in:
8
interface/package-lock.json
generated
8
interface/package-lock.json
generated
@@ -20,7 +20,7 @@
|
|||||||
"@types/react-dom": "^18.0.10",
|
"@types/react-dom": "^18.0.10",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.2.5",
|
"async-validator": "^4.2.5",
|
||||||
"axios": "^1.2.1",
|
"axios": "^1.2.2",
|
||||||
"http-proxy-middleware": "^2.0.6",
|
"http-proxy-middleware": "^2.0.6",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
@@ -5081,9 +5081,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz",
|
||||||
"integrity": "sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==",
|
"integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.0",
|
"follow-redirects": "^1.15.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"@types/react-dom": "^18.0.10",
|
"@types/react-dom": "^18.0.10",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.2.5",
|
"async-validator": "^4.2.5",
|
||||||
"axios": "^1.2.1",
|
"axios": "^1.2.2",
|
||||||
"http-proxy-middleware": "^2.0.6",
|
"http-proxy-middleware": "^2.0.6",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ extra_scripts =
|
|||||||
; options for debugging are: EMSESP_DEBUG EMSESP_UART_DEBUG EMSESP_DEBUG_SENSOR
|
; options for debugging are: EMSESP_DEBUG EMSESP_UART_DEBUG EMSESP_DEBUG_SENSOR
|
||||||
[env:debug]
|
[env:debug]
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_build.partitions = esp32_partition_debug.csv
|
board_build.partitions = esp32_partition_debug.csv
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
build_type = debug
|
build_type = debug
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ check_flags =
|
|||||||
[env:ci]
|
[env:ci]
|
||||||
extra_scripts = scripts/rename_fw.py
|
extra_scripts = scripts/rename_fw.py
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
board_build.partitions = esp32_partition_4M.csv
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
build_flags = ${common.build_flags}
|
build_flags = ${common.build_flags}
|
||||||
@@ -67,7 +67,7 @@ extra_scripts =
|
|||||||
pre:scripts/build_interface.py
|
pre:scripts/build_interface.py
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_upload.flash_size = 4MB
|
board_upload.flash_size = 4MB
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
board_build.partitions = esp32_partition_4M.csv
|
||||||
build_flags = ${common.build_flags}
|
build_flags = ${common.build_flags}
|
||||||
@@ -78,7 +78,7 @@ extra_scripts =
|
|||||||
pre:scripts/build_interface.py
|
pre:scripts/build_interface.py
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_upload.flash_size = 16MB
|
board_upload.flash_size = 16MB
|
||||||
board_build.partitions = esp32_partition_16M.csv
|
board_build.partitions = esp32_partition_16M.csv
|
||||||
build_flags = ${common.build_flags}
|
build_flags = ${common.build_flags}
|
||||||
@@ -89,7 +89,7 @@ extra_scripts =
|
|||||||
pre:scripts/build_interface.py
|
pre:scripts/build_interface.py
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_upload.flash_size = 4MB
|
board_upload.flash_size = 4MB
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
board_build.partitions = esp32_partition_4M.csv
|
||||||
build_flags = ${common.build_flags}
|
build_flags = ${common.build_flags}
|
||||||
@@ -102,7 +102,7 @@ extra_scripts =
|
|||||||
pre:scripts/build_interface.py
|
pre:scripts/build_interface.py
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_upload.flash_size = 4MB
|
board_upload.flash_size = 4MB
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
board_build.partitions = esp32_partition_4M.csv
|
||||||
build_flags = ${common.build_flags} -DBOARD_C3_MINI_V1
|
build_flags = ${common.build_flags} -DBOARD_C3_MINI_V1
|
||||||
@@ -113,7 +113,7 @@ extra_scripts =
|
|||||||
pre:scripts/build_interface.py
|
pre:scripts/build_interface.py
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
board = lolin_s2_mini
|
board = lolin_s2_mini
|
||||||
platform = espressif32
|
platform = espressif32@5.2.0
|
||||||
board_upload.flash_size = 4MB
|
board_upload.flash_size = 4MB
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
board_build.partitions = esp32_partition_4M.csv
|
||||||
build_flags = ${common.build_flags}
|
build_flags = ${common.build_flags}
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
99);
|
99);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// heatpump info
|
// heatpump info
|
||||||
if (model() == EMS_DEVICE_FLAG_HEATPUMP) {
|
if (model() == EMS_DEVICE_FLAG_HEATPUMP) {
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
|
|||||||
@@ -194,6 +194,11 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
EMSESP::send_read_request(EMS_TYPE_RCTime, device_id);
|
EMSESP::send_read_request(EMS_TYPE_RCTime, device_id);
|
||||||
EMSESP::send_read_request(0x12, device_id); // read last error (only published on errors)
|
EMSESP::send_read_request(0x12, device_id); // read last error (only published on errors)
|
||||||
EMSESP::send_read_request(0xA2, device_id); // read errorCode (only published on errors)
|
EMSESP::send_read_request(0xA2, device_id); // read errorCode (only published on errors)
|
||||||
|
|
||||||
|
#if defined(EMSESP_STANDALONE_DUMP)
|
||||||
|
// if we're just dumping out values, create a single dummy hc
|
||||||
|
register_device_values_hc(std::make_shared<emsesp::Thermostat::HeatingCircuit>(1, model)); // hc=1
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the heating circuit object based on the hc number
|
// returns the heating circuit object based on the hc number
|
||||||
|
|||||||
@@ -1064,9 +1064,15 @@ void EMSdevice::getCustomEntities(std::vector<std::string> & entity_ids) {
|
|||||||
|
|
||||||
#if defined(EMSESP_STANDALONE_DUMP)
|
#if defined(EMSESP_STANDALONE_DUMP)
|
||||||
// dumps all entity values in native English
|
// dumps all entity values in native English
|
||||||
// device name,device type,product_id,shortname,fullname,type [(enum values) | (min/max)],uom,writeable,discovery_entityid
|
// the code is intended to run only once standalone, outside the ESP32 so not optimized for memory efficiency
|
||||||
|
// pipe symbols (|) are escaped so they can be converted to Markdown in the Wiki
|
||||||
|
// format is: device name,device type,product id,shortname,fullname,type [options...] \\| (min/max),uom,writeable,discovery entityid v3.4, discovery entityid
|
||||||
void EMSdevice::dump_value_info() {
|
void EMSdevice::dump_value_info() {
|
||||||
for (auto & dv : devicevalues_) {
|
for (auto & dv : devicevalues_) {
|
||||||
|
if (dv.fullname == nullptr) {
|
||||||
|
break; // ignore entities that don't have a fullname, like the thermostat climate thingy
|
||||||
|
}
|
||||||
|
|
||||||
Serial.print(name_);
|
Serial.print(name_);
|
||||||
Serial.print(',');
|
Serial.print(',');
|
||||||
Serial.print(device_type_name().c_str());
|
Serial.print(device_type_name().c_str());
|
||||||
@@ -1081,33 +1087,25 @@ void EMSdevice::dump_value_info() {
|
|||||||
Serial.print(dv.fullname[0]);
|
Serial.print(dv.fullname[0]);
|
||||||
Serial.print(',');
|
Serial.print(',');
|
||||||
|
|
||||||
// type and optional enum values and min/max
|
// per type
|
||||||
switch (dv.type) {
|
switch (dv.type) {
|
||||||
case DeviceValueType::ENUM: {
|
case DeviceValueType::ENUM:
|
||||||
|
case DeviceValueType::CMD:
|
||||||
|
if (dv.type == DeviceValueType::ENUM) {
|
||||||
Serial.print("enum");
|
Serial.print("enum");
|
||||||
Serial.print(" (");
|
} else {
|
||||||
for (uint8_t i = 0; i < dv.options_size; i++) {
|
Serial.print("cmd");
|
||||||
Serial.print(Helpers::translated_word(dv.options[i]));
|
|
||||||
if (i < dv.options_size - 1) {
|
|
||||||
Serial.print('|');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Serial.print(')');
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case DeviceValueType::CMD: {
|
Serial.print(" [");
|
||||||
Serial.print("cmd");
|
|
||||||
Serial.print(" (");
|
|
||||||
for (uint8_t i = 0; i < dv.options_size; i++) {
|
for (uint8_t i = 0; i < dv.options_size; i++) {
|
||||||
Serial.print(Helpers::translated_word(dv.options[i]));
|
Serial.print(dv.options[i][0]);
|
||||||
if (i < dv.options_size - 1) {
|
if (i < dv.options_size - 1) {
|
||||||
Serial.print('|');
|
Serial.print("\\|");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Serial.print(')');
|
Serial.print(']');
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case DeviceValueType::USHORT:
|
case DeviceValueType::USHORT:
|
||||||
Serial.print("ushort");
|
Serial.print("ushort");
|
||||||
@@ -1170,22 +1168,36 @@ void EMSdevice::dump_value_info() {
|
|||||||
Serial.print(dv.has_cmd ? "true" : "false");
|
Serial.print(dv.has_cmd ? "true" : "false");
|
||||||
Serial.print(",");
|
Serial.print(",");
|
||||||
|
|
||||||
// MQTT Discovery entity name, assuming we're using the default v3.5 option
|
// MQTT Discovery entity name
|
||||||
char entity_with_tag[50];
|
// do this twice for the old and new formats
|
||||||
|
char entity_with_tag[200];
|
||||||
|
char entityid[500];
|
||||||
|
char entity_name[100];
|
||||||
|
|
||||||
|
for (uint8_t count = 0; count < 2; count++) {
|
||||||
|
if (count) {
|
||||||
|
// new name, comes as last
|
||||||
|
Serial.print(",");
|
||||||
|
strcpy(entity_name, dv.short_name);
|
||||||
|
} else {
|
||||||
|
// old format, comes first
|
||||||
|
char uniq_s[100];
|
||||||
|
strlcpy(uniq_s, dv.fullname[0], sizeof(uniq_s));
|
||||||
|
Helpers::replace_char(uniq_s, ' ', '_');
|
||||||
|
strcpy(entity_name, uniq_s);
|
||||||
|
}
|
||||||
|
|
||||||
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||||
snprintf(entity_with_tag,
|
snprintf(entity_with_tag,
|
||||||
sizeof(entity_with_tag),
|
sizeof(entity_with_tag),
|
||||||
"%s_%s_%s",
|
"%s_%s_%s",
|
||||||
device_type_2_device_name(device_type_),
|
device_type_2_device_name(device_type_),
|
||||||
EMSdevice::tag_to_mqtt(dv.tag).c_str(),
|
EMSdevice::tag_to_mqtt(dv.tag).c_str(),
|
||||||
dv.short_name);
|
entity_name);
|
||||||
} else {
|
} else {
|
||||||
// should really test for which device types have tags (like hc, wwc etc)
|
snprintf(entity_with_tag, sizeof(entity_with_tag), "%s_%s", device_type_2_device_name(device_type_), entity_name);
|
||||||
// snprintf(entity_with_tag, sizeof(entity_with_tag), "%s_[<tag>_]%s", device_type_2_device_name(device_type_), dv.short_name);
|
|
||||||
snprintf(entity_with_tag, sizeof(entity_with_tag), "%s_%s", device_type_2_device_name(device_type_), dv.short_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char entityid[150];
|
|
||||||
if (dv.has_cmd) {
|
if (dv.has_cmd) {
|
||||||
switch (dv.type) {
|
switch (dv.type) {
|
||||||
case DeviceValueType::INT:
|
case DeviceValueType::INT:
|
||||||
@@ -1214,6 +1226,7 @@ void EMSdevice::dump_value_info() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Serial.print(entityid);
|
Serial.print(entityid);
|
||||||
|
}
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,14 +313,26 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
|||||||
void EMSESP::dump_all_values(uuid::console::Shell & shell) {
|
void EMSESP::dump_all_values(uuid::console::Shell & shell) {
|
||||||
Serial.println("---- CSV START ----"); // marker use by py script
|
Serial.println("---- CSV START ----"); // marker use by py script
|
||||||
// add header for CSV
|
// add header for CSV
|
||||||
Serial.print("device name,device type,product_id,shortname,fullname,type [(enum values) | (min/max)],uom,writeable,discovery_entityid");
|
Serial.print("device name,device type,product id,shortname,fullname,type [options...] \\| (min/max),uom,writeable,discovery entityid v3.4, discovery entityid");
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
for (const auto & device_class : EMSFactory::device_handlers()) {
|
for (const auto & device_class : EMSFactory::device_handlers()) {
|
||||||
// go through each device type so they are sorted
|
// go through each device type so they are sorted
|
||||||
for (const auto & device : device_library_) {
|
for (const auto & device : device_library_) {
|
||||||
if (device_class.first == device.device_type) {
|
if (device_class.first == device.device_type) {
|
||||||
emsdevices.push_back(EMSFactory::add(device.device_type, 0, device.product_id, "1.0", device.name, device.flags, EMSdevice::Brand::NO_BRAND));
|
uint8_t device_id = 0;
|
||||||
|
// Mixer class looks at device_id to determine type, so fixing to 0x28 which will give all the settings except flowSetTemp
|
||||||
|
if ((device.device_type == DeviceType::MIXER) && (device.flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS)) {
|
||||||
|
// pick one as hc and the other as having wwc
|
||||||
|
if (device.product_id == 160) { // MM100
|
||||||
|
device_id = 0x28; // wwc
|
||||||
|
} else {
|
||||||
|
device_id = 0x20; // hc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
emsdevices.push_back(
|
||||||
|
EMSFactory::add(device.device_type, device_id, device.product_id, "1.0", device.name, device.flags, EMSdevice::Brand::NO_BRAND));
|
||||||
emsdevices.back()->dump_value_info(); // dump all the entity information
|
emsdevices.back()->dump_value_info(); // dump all the entity information
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user