[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
@@ -1108,6 +1108,24 @@ void launchBTDiscovery(bool overrideDiscovery) {
|
||||
Gateway_AnnouncementMsg, will_Message, false, subjectMQTTtoBTset,
|
||||
model.c_str(), brand.c_str(), model_id.c_str(), macWOdots.c_str(), false,
|
||||
stateClassNone, "off", "on");
|
||||
} else if ((p->sensorModel_id == TheengsDecoder::XMTZC04HM || p->sensorModel_id == TheengsDecoder::XMTZC05HM) &&
|
||||
strcmp(prop.key().c_str(), "weighing_mode") == 0) {
|
||||
createDiscovery("sensor",
|
||||
discovery_topic.c_str(), entity_name.c_str(), unique_id.c_str(),
|
||||
will_Topic, "enum", value_template.c_str(),
|
||||
"", "", prop.value()["unit"],
|
||||
0, "", "", false, "",
|
||||
model.c_str(), brand.c_str(), model_id.c_str(), macWOdots.c_str(), false,
|
||||
stateClassMeasurement, nullptr, nullptr, "[\"person\",\"object\"]");
|
||||
} else if ((p->sensorModel_id == TheengsDecoder::XMTZC04HM || p->sensorModel_id == TheengsDecoder::XMTZC05HM) &&
|
||||
strcmp(prop.key().c_str(), "unit") == 0) {
|
||||
createDiscovery("sensor",
|
||||
discovery_topic.c_str(), entity_name.c_str(), unique_id.c_str(),
|
||||
will_Topic, "enum", value_template.c_str(),
|
||||
"", "", prop.value()["unit"],
|
||||
0, "", "", false, "",
|
||||
model.c_str(), brand.c_str(), model_id.c_str(), macWOdots.c_str(), false,
|
||||
stateClassMeasurement, nullptr, nullptr, "[\"lb\",\"kg\",\"jin\"]");
|
||||
} else if (strcmp(prop.key().c_str(), "device") != 0 || strcmp(prop.key().c_str(), "mac") != 0) { // Exception on device and mac as these ones are not sensors
|
||||
createDiscovery("sensor",
|
||||
discovery_topic.c_str(), entity_name.c_str(), unique_id.c_str(),
|
||||
|
||||
Reference in new issue
Block a user