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:
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);
return true;
}
......@@ -448,17 +437,9 @@ protected:
} else if (boost::iequals(val.first, "mqttPart")) {
sGroup.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "sync")) {
if (val.second.data() == "off") {
sGroup.setSync(false);
} else {
sGroup.setSync(true);
}
sGroup.setSync(to_bool(val.second.data()));
} else if (boost::iequals(val.first, "disabled")) {
if (boost::iequals(val.second.data(), "true")) {
sGroup.setDisabled(true);
} else {
sGroup.setDisabled(false);
}
sGroup.setDisabled(to_bool(val.second.data()));
} else if (boost::iequals(val.first, _baseName)) {
if (!isTemplate) {
LOG(debug) << " " << _baseName << " " << val.second.data();
......@@ -524,11 +505,7 @@ protected:
if (boost::iequals(val.first, "mqttPart")) {
sEntity.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "disabled")) {
if (boost::iequals(val.second.data(), "true")) {
sEntity.setDisabled(true);
} else {
sEntity.setDisabled(false);
}
sEntity.setDisabled(to_bool(val.second.data()));
}
}
......@@ -1044,11 +1021,9 @@ protected:
} else if (boost::iequals(val.first, "mqttPart")) {
sGroup.setMqttPart(val.second.data());
} else if (boost::iequals(val.first, "sync")) {
if (val.second.data() == "off") {
sGroup.setSync(false);
} else {
sGroup.setSync(true);
}
sGroup.setSync(to_bool(val.second.data()));
} else if (boost::iequals(val.first, "disabled")) {
sGroup.setDisabled(to_bool(val.second.data()));
} else if (boost::iequals(val.first, _baseName)) {
if (!isTemplate) {
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