[DISC] make mi scale weighing_mode and unit enum (#1766)
* make mi scale weighing_mode and unit enum * lint
This commit is contained in:
1 parent
c4a84651d4
commit
00b2ec93cb
3 files changed
+26
-3
No files matched your search
@@ -239,7 +239,7 @@ void createDiscovery(const char* sensor_type,
|
||||
int off_delay,
|
||||
const char* payload_available, const char* payload_not_available, bool gateway_entity, const char* cmd_topic,
|
||||
const char* device_name, const char* device_manufacturer, const char* device_model, const char* device_id, bool retainCmd,
|
||||
const char* state_class, const char* state_off, const char* state_on) {
|
||||
const char* state_class, const char* state_off, const char* state_on, const char* enum_options) {
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject sensor = jsonBuffer.to<JsonObject>();
|
||||
|
||||
@@ -344,6 +344,10 @@ void createDiscovery(const char* sensor_type,
|
||||
sensor["cmd_t"] = command_topic; //command_topic
|
||||
}
|
||||
|
||||
if (enum_options != nullptr) {
|
||||
sensor["options"] = enum_options;
|
||||
}
|
||||
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> jsonDeviceBuffer;
|
||||
JsonObject device = jsonDeviceBuffer.to<JsonObject>();
|
||||
JsonArray identifiers = device.createNestedArray("ids");
|
||||
|
||||
Reference in new issue
Block a user