Commit 6071b439 authored by Alessio Netti's avatar Alessio Netti
Browse files

DCDBPusher: fixes to configurator

- Removed automatic assignment of sensor names to MQTT topics and vice
versa if either is empty
- All boolean checks now use the to_bool function
parent 200d582e
...@@ -392,17 +392,6 @@ protected: ...@@ -392,17 +392,6 @@ protected:
sBase.setSubsampling(std::stoi(val.second.data())); sBase.setSubsampling(std::stoi(val.second.data()));
} }
} }
if (sBase.getName().size() == 0) {
size_t pos = sBase.getMqtt().find_last_of('/');
if (pos != std::string::npos) {
pos++;
} else {
pos = 0;
}
sBase.setName(sBase.getMqtt().substr(pos));
} else if (sBase.getMqtt().size() == 0) {
sBase.setMqtt('/' + sBase.getName());
}
sensorBase(sBase, config); sensorBase(sBase, config);
return true; return true;
} }
...@@ -448,17 +437,9 @@ protected: ...@@ -448,17 +437,9 @@ protected:
} else if (boost::iequals(val.first, "mqttPart")) { } else if (boost::iequals(val.first, "mqttPart")) {
sGroup.setMqttPart(val.second.data()); sGroup.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "sync")) { } else if (boost::iequals(val.first, "sync")) {
if (val.second.data() == "off") { sGroup.setSync(to_bool(val.second.data()));
sGroup.setSync(false);
} else {
sGroup.setSync(true);
}
} else if (boost::iequals(val.first, "disabled")) { } else if (boost::iequals(val.first, "disabled")) {
if (boost::iequals(val.second.data(), "true")) { sGroup.setDisabled(to_bool(val.second.data()));
sGroup.setDisabled(true);
} else {
sGroup.setDisabled(false);
}
} else if (boost::iequals(val.first, _baseName)) { } else if (boost::iequals(val.first, _baseName)) {
if (!isTemplate) { if (!isTemplate) {
LOG(debug) << " " << _baseName << " " << val.second.data(); LOG(debug) << " " << _baseName << " " << val.second.data();
...@@ -524,11 +505,7 @@ protected: ...@@ -524,11 +505,7 @@ protected:
if (boost::iequals(val.first, "mqttPart")) { if (boost::iequals(val.first, "mqttPart")) {
sEntity.setMqttPart(val.second.data()); sEntity.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "disabled")) { } else if (boost::iequals(val.first, "disabled")) {
if (boost::iequals(val.second.data(), "true")) { sEntity.setDisabled(to_bool(val.second.data()));
sEntity.setDisabled(true);
} else {
sEntity.setDisabled(false);
}
} }
} }
...@@ -1043,13 +1020,11 @@ protected: ...@@ -1043,13 +1020,11 @@ protected:
sGroup.setMinValues(stoull(val.second.data())); sGroup.setMinValues(stoull(val.second.data()));
} else if (boost::iequals(val.first, "mqttPart")) { } else if (boost::iequals(val.first, "mqttPart")) {
sGroup.setMqttPart(val.second.data()); sGroup.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "sync")) { } else if (boost::iequals(val.first, "sync")) {
if (val.second.data() == "off") { sGroup.setSync(to_bool(val.second.data()));
sGroup.setSync(false); } else if (boost::iequals(val.first, "disabled")) {
} else { sGroup.setDisabled(to_bool(val.second.data()));
sGroup.setSync(true); } else if (boost::iequals(val.first, _baseName)) {
}
} else if (boost::iequals(val.first, _baseName)) {
if (!isTemplate) { if (!isTemplate) {
LOG(debug) << " " << _baseName << " " << val.second.data(); LOG(debug) << " " << _baseName << " " << val.second.data();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment