mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
refactor commands to take dynamic translation descriptions #674
This commit is contained in:
@@ -31,7 +31,6 @@ void AnalogSensor::start() {
|
||||
}
|
||||
analogSetAttenuation(ADC_2_5db); // for all channels 1.5V
|
||||
|
||||
|
||||
LOG_INFO("Starting Analog sensor service");
|
||||
|
||||
// Add API call for /info
|
||||
@@ -39,18 +38,18 @@ void AnalogSensor::start() {
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(info),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
||||
F_(info_cmd));
|
||||
FL_(info_cmd));
|
||||
Command::add(
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(setvalue),
|
||||
[&](const char * value, const int8_t id) { return command_setvalue(value, id); },
|
||||
("set io value"), // TODO translate this
|
||||
FL_(setiovalue_cmd),
|
||||
CommandFlag::ADMIN_ONLY);
|
||||
Command::add(
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(commands),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
||||
F_(commands_cmd));
|
||||
FL_(commands_cmd));
|
||||
|
||||
Mqtt::subscribe(EMSdevice::DeviceType::ANALOGSENSOR, "analogsensor/#", nullptr); // use empty function callback
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user