don't show commands in web or console

This commit is contained in:
Proddy
2021-08-03 13:22:45 +02:00
parent 1715218864
commit 19e26d0d64
3 changed files with 19 additions and 18 deletions

View File

@@ -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(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor));
}
// MQTT commands for boiler topic
// first commands
register_device_value(TAG_BOILER_DATA,
&wWTapActivated_,
DeviceValueType::BOOL,
nullptr,
DeviceValueType::CMD,
FL_(enum_bool),
FL_(wwtapactivated),
DeviceValueUOM::BOOLEAN,
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));
// add values
// reserve_device_values(90);
// main - boiler_data topic
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, &tapwaterActive_, DeviceValueType::BOOL, nullptr, FL_(tapwaterActive), DeviceValueUOM::BOOLEAN);

View File

@@ -422,12 +422,12 @@ void EMSdevice::show_mqtt_handlers(uuid::console::Shell & shell) {
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);
}
// 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);
}
@@ -487,7 +487,7 @@ void EMSdevice::register_device_value(uint8_t tag,
const __FlashStringHelper * const * options,
const __FlashStringHelper * const * name,
uint8_t uom,
cmdfunction_p f,
const cmd_function_p f,
int32_t min,
uint32_t 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 * name,
uint8_t uom,
cmdfunction_p f) {
const cmd_function_p f) {
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");
for (const auto & dv : devicevalues_) {
// ignore if full_name empty
if (dv.full_name != nullptr) {
// ignore if full_name empty and also commands
if ((dv.full_name != nullptr) && (dv.type != DeviceValueType::CMD)) {
JsonObject obj; // create the object, if needed
// handle Booleans (true, false)
@@ -586,11 +586,11 @@ void EMSdevice::generate_values_json_web(JsonObject & json) {
}
}
// handle commands without value
else if (dv.type == DeviceValueType::CMD) {
obj = data.createNestedObject();
obj["v"] = "";
}
// // handle commands without value
// else if (dv.type == DeviceValueType::CMD) {
// obj = data.createNestedObject();
// obj["v"] = "";
// }
else {
// handle Integers and Floats

View File

@@ -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_flow, F_(off), F_(flow), F_(bufferedflow), F_(buffer), F_(layeredbuffer))
MAKE_PSTR_LIST(enum_reset, F_(maintenance), F_(error))
MAKE_PSTR_LIST(enum_bool, F_(off), F_(on))
// thermostat
MAKE_PSTR_WORD(light)