From 725d63a518834191d4f56c83030ea0f6a03f4b52 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 3 Aug 2020 23:31:08 +0200 Subject: [PATCH] only show heating circuit in cmd for thermostats and mixers --- src/devices/boiler.h | 2 +- src/emsdevice.cpp | 10 +++++++++- src/locale_EN.h | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/devices/boiler.h b/src/devices/boiler.h index d40e8b60d..7a22c0513 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -160,7 +160,7 @@ class Boiler : public EMSdevice { void check_active(); - // commands + // commands - none of these use the additional id parameter void set_warmwater_mode(const char * value, const int8_t id); void set_warmwater_activated(const char * value, const int8_t id); void set_tapwarmwater_activated(const char * value, const int8_t id); diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index cb8932bd6..671f4a4f9 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -339,11 +339,19 @@ void EMSdevice::print_value(uuid::console::Shell & shell, uint8_t padding, const // given a context, automatically add the commands taken them from the MQTT registry for "_cmd" topics void EMSdevice::add_context_commands(unsigned int context) { + // if we're adding commands for a thermostat or mixing, then include an additional optional paramter called heating circuit + flash_string_vector params; + if ((context == ShellContext::THERMOSTAT) || (context == ShellContext::MIXING)) { + params = flash_string_vector{F_(cmd_optional), F_(data_optional), F_(hc_optional)}; + } else { + params = flash_string_vector{F_(cmd_optional), F_(data_optional)}; + } + EMSESPShell::commands->add_command( context, CommandFlags::ADMIN, flash_string_vector{F_(call)}, - flash_string_vector{F_(cmd_optional), F_(data_optional), F_(id_optional)}, + params, [&](Shell & shell, const std::vector & arguments) { uint8_t device_type_ = device_type(); if (arguments.empty()) { diff --git a/src/locale_EN.h b/src/locale_EN.h index 507a110ed..f75454798 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -102,7 +102,6 @@ MAKE_PSTR(asterisks, "********") MAKE_PSTR(n_mandatory, "") MAKE_PSTR(n_optional, "[n]") MAKE_PSTR(data_optional, "[data]") -MAKE_PSTR(id_optional, "[id]") MAKE_PSTR(typeid_mandatory, "") MAKE_PSTR(deviceid_mandatory, "") MAKE_PSTR(deviceid_optional, "[device ID]")