mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
don't show commands in web or console
This commit is contained in:
@@ -84,22 +84,22 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
register_telegram_type(0x48D, F("HpPower"), false, MAKE_PF_CB(process_HpPower));
|
register_telegram_type(0x48D, F("HpPower"), false, MAKE_PF_CB(process_HpPower));
|
||||||
register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor));
|
register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// MQTT commands for boiler topic
|
// MQTT commands for boiler topic
|
||||||
|
|
||||||
|
// first commands
|
||||||
register_device_value(TAG_BOILER_DATA,
|
register_device_value(TAG_BOILER_DATA,
|
||||||
&wWTapActivated_,
|
&wWTapActivated_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::CMD,
|
||||||
nullptr,
|
FL_(enum_bool),
|
||||||
FL_(wwtapactivated),
|
FL_(wwtapactivated),
|
||||||
DeviceValueUOM::BOOLEAN,
|
DeviceValueUOM::BOOLEAN,
|
||||||
MAKE_CF_CB(set_tapwarmwater_activated));
|
MAKE_CF_CB(set_tapwarmwater_activated));
|
||||||
|
// reset is a command, so uses a dummy variable which is unused
|
||||||
register_device_value(TAG_BOILER_DATA, &dummy8u_, DeviceValueType::CMD, FL_(enum_reset), FL_(reset), DeviceValueUOM::LIST, MAKE_CF_CB(set_reset));
|
register_device_value(TAG_BOILER_DATA, &dummy8u_, DeviceValueType::CMD, FL_(enum_reset), FL_(reset), DeviceValueUOM::LIST, MAKE_CF_CB(set_reset));
|
||||||
|
|
||||||
// add values
|
|
||||||
// reserve_device_values(90);
|
|
||||||
|
|
||||||
// main - boiler_data topic
|
|
||||||
register_device_value(TAG_BOILER_DATA, &id_, DeviceValueType::UINT, nullptr, FL_(ID), DeviceValueUOM::NONE);
|
register_device_value(TAG_BOILER_DATA, &id_, DeviceValueType::UINT, nullptr, FL_(ID), DeviceValueUOM::NONE);
|
||||||
id_ = product_id;
|
id_ = product_id; // note, must set the value after it has been initialized to have affect
|
||||||
|
|
||||||
register_device_value(TAG_BOILER_DATA, &heatingActive_, DeviceValueType::BOOL, nullptr, FL_(heatingActive), DeviceValueUOM::BOOLEAN);
|
register_device_value(TAG_BOILER_DATA, &heatingActive_, DeviceValueType::BOOL, nullptr, FL_(heatingActive), DeviceValueUOM::BOOLEAN);
|
||||||
register_device_value(TAG_BOILER_DATA, &tapwaterActive_, DeviceValueType::BOOL, nullptr, FL_(tapwaterActive), DeviceValueUOM::BOOLEAN);
|
register_device_value(TAG_BOILER_DATA, &tapwaterActive_, DeviceValueType::BOOL, nullptr, FL_(tapwaterActive), DeviceValueUOM::BOOLEAN);
|
||||||
|
|||||||
@@ -422,12 +422,12 @@ void EMSdevice::show_mqtt_handlers(uuid::console::Shell & shell) {
|
|||||||
Mqtt::show_topic_handlers(shell, device_type_);
|
Mqtt::show_topic_handlers(shell, device_type_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EMSdevice::register_mqtt_topic(const std::string & topic, mqtt_subfunction_p f) {
|
void EMSdevice::register_mqtt_topic(const std::string & topic, const mqtt_sub_function_p f) {
|
||||||
Mqtt::subscribe(device_type_, topic, f);
|
Mqtt::subscribe(device_type_, topic, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// register a callback function for a specific telegram type
|
// register a callback function for a specific telegram type
|
||||||
void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, process_function_p f) {
|
void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p f) {
|
||||||
telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, f);
|
telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ void EMSdevice::register_device_value(uint8_t tag,
|
|||||||
const __FlashStringHelper * const * options,
|
const __FlashStringHelper * const * options,
|
||||||
const __FlashStringHelper * const * name,
|
const __FlashStringHelper * const * name,
|
||||||
uint8_t uom,
|
uint8_t uom,
|
||||||
cmdfunction_p f,
|
const cmd_function_p f,
|
||||||
int32_t min,
|
int32_t min,
|
||||||
uint32_t max) {
|
uint32_t max) {
|
||||||
register_device_value(tag, value_p, type, options, name[0], name[1], uom, (f != nullptr), min, max);
|
register_device_value(tag, value_p, type, options, name[0], name[1], uom, (f != nullptr), min, max);
|
||||||
@@ -513,7 +513,7 @@ void EMSdevice::register_device_value(uint8_t tag,
|
|||||||
const __FlashStringHelper * const * options,
|
const __FlashStringHelper * const * options,
|
||||||
const __FlashStringHelper * const * name,
|
const __FlashStringHelper * const * name,
|
||||||
uint8_t uom,
|
uint8_t uom,
|
||||||
cmdfunction_p f) {
|
const cmd_function_p f) {
|
||||||
register_device_value(tag, value_p, type, options, name, uom, f, 0, 0);
|
register_device_value(tag, value_p, type, options, name, uom, f, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,8 +562,8 @@ void EMSdevice::generate_values_json_web(JsonObject & json) {
|
|||||||
JsonArray data = json.createNestedArray("data");
|
JsonArray data = json.createNestedArray("data");
|
||||||
|
|
||||||
for (const auto & dv : devicevalues_) {
|
for (const auto & dv : devicevalues_) {
|
||||||
// ignore if full_name empty
|
// ignore if full_name empty and also commands
|
||||||
if (dv.full_name != nullptr) {
|
if ((dv.full_name != nullptr) && (dv.type != DeviceValueType::CMD)) {
|
||||||
JsonObject obj; // create the object, if needed
|
JsonObject obj; // create the object, if needed
|
||||||
|
|
||||||
// handle Booleans (true, false)
|
// handle Booleans (true, false)
|
||||||
@@ -586,11 +586,11 @@ void EMSdevice::generate_values_json_web(JsonObject & json) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle commands without value
|
// // handle commands without value
|
||||||
else if (dv.type == DeviceValueType::CMD) {
|
// else if (dv.type == DeviceValueType::CMD) {
|
||||||
obj = data.createNestedObject();
|
// obj = data.createNestedObject();
|
||||||
obj["v"] = "";
|
// obj["v"] = "";
|
||||||
}
|
// }
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// handle Integers and Floats
|
// handle Integers and Floats
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ MAKE_PSTR_LIST(enum_charge, F_(chargepump), F_(3wayvalve))
|
|||||||
MAKE_PSTR_LIST(enum_comfort, F_(hot), F_(eco), F_(intelligent))
|
MAKE_PSTR_LIST(enum_comfort, F_(hot), F_(eco), F_(intelligent))
|
||||||
MAKE_PSTR_LIST(enum_flow, F_(off), F_(flow), F_(bufferedflow), F_(buffer), F_(layeredbuffer))
|
MAKE_PSTR_LIST(enum_flow, F_(off), F_(flow), F_(bufferedflow), F_(buffer), F_(layeredbuffer))
|
||||||
MAKE_PSTR_LIST(enum_reset, F_(maintenance), F_(error))
|
MAKE_PSTR_LIST(enum_reset, F_(maintenance), F_(error))
|
||||||
|
MAKE_PSTR_LIST(enum_bool, F_(off), F_(on))
|
||||||
|
|
||||||
// thermostat
|
// thermostat
|
||||||
MAKE_PSTR_WORD(light)
|
MAKE_PSTR_WORD(light)
|
||||||
|
|||||||
Reference in New Issue
Block a user