mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
fixes to num_entities
This commit is contained in:
16
Makefile
16
Makefile
@@ -22,16 +22,16 @@ INCLUDES := src lib_standalone lib/ArduinoJson/src lib/uuid-common/src lib/uuid
|
|||||||
LIBRARIES :=
|
LIBRARIES :=
|
||||||
|
|
||||||
CPPCHECK = cppcheck
|
CPPCHECK = cppcheck
|
||||||
# CHECKFLAGS = -q --force --std=c++17
|
CHECKFLAGS = -q --force --std=c++17
|
||||||
CHECKFLAGS = -q --force --std=c++11
|
# CHECKFLAGS = -q --force --std=c++11
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Languages Standard
|
# Languages Standard
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# C_STANDARD := -std=c17
|
C_STANDARD := -std=c17
|
||||||
# CXX_STANDARD := -std=c++17
|
CXX_STANDARD := -std=c++17
|
||||||
C_STANDARD := -std=c11
|
# C_STANDARD := -std=c11
|
||||||
CXX_STANDARD := -std=c++11
|
# CXX_STANDARD := -std=c++11
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Defined Symbols
|
# Defined Symbols
|
||||||
@@ -79,9 +79,7 @@ CPPFLAGS += -g3
|
|||||||
CPPFLAGS += -Os
|
CPPFLAGS += -Os
|
||||||
|
|
||||||
CFLAGS += $(CPPFLAGS)
|
CFLAGS += $(CPPFLAGS)
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture
|
||||||
CFLAGS += -Wextra
|
|
||||||
CFLAGS += -Wno-unused-parameter
|
|
||||||
|
|
||||||
CXXFLAGS += $(CFLAGS) -MMD
|
CXXFLAGS += $(CFLAGS) -MMD
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# creates an CSV file called "dump_entities.cvs" with all devices and their entities
|
# creates an CSV file called "dump_entities.cvs" with all devices and their entities
|
||||||
# run from top folder like `sh ./scripts/dump_entities.sh`
|
# run from top folder like `sh ./scripts/dump_entities.sh`
|
||||||
rm -f dump_entities.csv
|
rm -f dump_entities.csv
|
||||||
make clean;
|
make clean
|
||||||
make ARGS=-DEMSESP_STANDALONE_DUMP;
|
make ARGS=-DEMSESP_STANDALONE_DUMP
|
||||||
echo "test dump" | ./emsesp | python3 ./scripts/dump_entities.py > dump_entities.csv
|
echo "test dump" | ./emsesp | python3 ./scripts/dump_entities.py > dump_entities.csv
|
||||||
cat dump_entities.csv
|
cat dump_entities.csv
|
||||||
@@ -184,6 +184,11 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
// register device values for common values (not heating circuit)
|
// register device values for common values (not heating circuit)
|
||||||
register_device_values();
|
register_device_values();
|
||||||
|
|
||||||
|
#if defined(EMSESP_STANDALONE_DUMP)
|
||||||
|
// if we're just dumping out values, create a single dummy hc1
|
||||||
|
register_device_values_hc(std::make_shared<emsesp::Thermostat::HeatingCircuit>(1, model)); // hc=1
|
||||||
|
#endif
|
||||||
|
|
||||||
// query all the heating circuits. This is only done once.
|
// query all the heating circuits. This is only done once.
|
||||||
// The automatic fetch will from now on only update the active heating circuits
|
// The automatic fetch will from now on only update the active heating circuits
|
||||||
for (uint8_t i = 0; i < monitor_typeids.size(); i++) {
|
for (uint8_t i = 0; i < monitor_typeids.size(); i++) {
|
||||||
@@ -196,11 +201,6 @@ 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
|
||||||
@@ -4055,11 +4055,6 @@ void Thermostat::register_device_values() {
|
|||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#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, this->model())); // hc=1
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// registers the values for a heating circuit
|
// registers the values for a heating circuit
|
||||||
|
|||||||
@@ -329,19 +329,27 @@ void EMSESP::dump_all_values(uuid::console::Shell & shell) {
|
|||||||
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) {
|
||||||
uint8_t device_id = 0;
|
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
|
// Mixer class looks at device_id to determine type and the tag
|
||||||
if ((device.device_type == DeviceType::MIXER) && (device.flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS)) {
|
// so fixing to 0x28 which will give all the settings except flowSetTemp
|
||||||
// pick one as hc and the other as having wwc
|
if (device.device_type == DeviceType::MIXER) {
|
||||||
|
if (device.flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
|
||||||
if (device.product_id == 160) { // MM100
|
if (device.product_id == 160) { // MM100
|
||||||
device_id = 0x28; // wwc
|
device_id = 0x28; // wwc
|
||||||
} else {
|
} else {
|
||||||
device_id = 0x20; // hc
|
device_id = 0x20; // hc
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
device_id = 0x20; // should cover all the other device types
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add the device and print out all the entities
|
||||||
|
|
||||||
|
// if (device.product_id == 69) { // only for testing mixer
|
||||||
emsdevices.push_back(
|
emsdevices.push_back(
|
||||||
EMSFactory::add(device.device_type, device_id, device.product_id, "1.0", device.name, device.flags, EMSdevice::Brand::NO_BRAND));
|
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();
|
||||||
|
// } // only for testing mixer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,7 +442,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
|||||||
sensor.name().c_str(),
|
sensor.name().c_str(),
|
||||||
COLOR_BRIGHT_GREEN,
|
COLOR_BRIGHT_GREEN,
|
||||||
Helpers::render_value(s, sensor.value(), 2),
|
Helpers::render_value(s, sensor.value(), 2),
|
||||||
EMSdevice::uom_to_string(sensor.uom()).c_str(),
|
EMSdevice::uom_to_string(sensor.uom()),
|
||||||
COLOR_RESET,
|
COLOR_RESET,
|
||||||
Helpers::render_value(s2, sensor.factor(), 4),
|
Helpers::render_value(s2, sensor.factor(), 4),
|
||||||
sensor.offset());
|
sensor.offset());
|
||||||
@@ -565,7 +573,7 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
|||||||
bool nest_created = false;
|
bool nest_created = false;
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
if (nested && !nest_created && emsdevice->has_tag(tag)) {
|
if (nested && !nest_created && emsdevice->has_tags(tag)) {
|
||||||
json_hc = doc.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
json_hc = doc.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
||||||
nest_created = true;
|
nest_created = true;
|
||||||
}
|
}
|
||||||
@@ -1197,7 +1205,7 @@ bool EMSESP::command_info(uint8_t device_type, JsonObject & output, const int8_t
|
|||||||
bool nest_created = false;
|
bool nest_created = false;
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
if (!nest_created && emsdevice->has_tag(tag)) {
|
if (!nest_created && emsdevice->has_tags(tag)) {
|
||||||
output_hc = output.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
output_hc = output.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
||||||
nest_created = true;
|
nest_created = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user