Merge remote-tracking branch 'origin/dev' into main

This commit is contained in:
proddy
2021-03-30 16:35:18 +02:00
100 changed files with 21893 additions and 1439 deletions

View File

@@ -35,14 +35,14 @@ uuid::log::Logger DallasSensor::logger_{F_(dallassensor), uuid::log::Facility::D
void DallasSensor::start() {
reload();
#ifndef EMSESP_STANDALONE
// disabled if dallas gpio is 0
if (dallas_gpio_) {
#ifndef EMSESP_STANDALONE
bus_.begin(dallas_gpio_);
}
#endif
// API call
Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); });
// API call
Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); });
}
}
// load the MQTT settings
@@ -59,6 +59,10 @@ void DallasSensor::reload() {
}
void DallasSensor::loop() {
if (!dallas_gpio_) {
return; // dallas gpio is 0 (disabled)
}
#ifndef EMSESP_STANDALONE
uint32_t time_now = uuid::get_uptime();
@@ -385,7 +389,7 @@ void DallasSensor::publish_values(const bool force) {
JsonArray ids = dev.createNestedArray("ids");
ids.add("ems-esp-dallas"); // Different ids as the other portions of the EMS-ESP
char topic[100];
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
if (dallas_format == Mqtt::Dallas_Format::SENSORID) {
// use '_' as HA doesn't like '-' in the topic name
std::string topicname = sensor.to_string();