mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
add device_id to commands, fix #826
This commit is contained in:
@@ -273,6 +273,17 @@ bool EMSdevice::has_tag(const uint8_t tag) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the device has a command on the with this tag.
|
||||
bool EMSdevice::has_cmd(const int8_t id, const char * cmd) const {
|
||||
uint8_t tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
||||
for (const auto & dv : devicevalues_) {
|
||||
if ((id < 1 || dv.tag == tag) && dv.has_cmd && strcmp(dv.short_name, cmd) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// list of registered device entries
|
||||
// called from the command 'entities'
|
||||
void EMSdevice::list_device_entries(JsonObject & output) const {
|
||||
@@ -507,7 +518,7 @@ void EMSdevice::add_device_value(uint8_t tag,
|
||||
}
|
||||
|
||||
// add the command to our library
|
||||
Command::add(device_type_, short_name, f, fullname, flags);
|
||||
Command::add(device_type_, device_id_, short_name, f, fullname, flags);
|
||||
}
|
||||
|
||||
// single list of options
|
||||
|
||||
Reference in New Issue
Block a user