diff --git a/esp32/platformio.ini b/esp32/platformio.ini index 18d1a86..1acddd6 100644 --- a/esp32/platformio.ini +++ b/esp32/platformio.ini @@ -18,4 +18,3 @@ build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY lib_deps = ArduinoJson@6.16.1 https://github.com/homieiot/homie-esp8266.git#v3.0 OneWire - diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 33fd773..979ee4c 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -311,15 +311,16 @@ void readSensors() { //Homie.getMqttClient().disconnect(); void onHomieEvent(const HomieEvent& event) { + const String OFF = String("OFF"); switch(event.type) { case HomieEventType::MQTT_READY: - plant0.setProperty("switch").send(String("OFF")); - plant1.setProperty("switch").send(String("OFF")); - plant2.setProperty("switch").send(String("OFF")); - plant3.setProperty("switch").send(String("OFF")); - plant4.setProperty("switch").send(String("OFF")); - plant5.setProperty("switch").send(String("OFF")); - plant6.setProperty("switch").send(String("OFF")); + plant0.setProperty("switch").send(OFF); + plant1.setProperty("switch").send(OFF); + plant2.setProperty("switch").send(OFF); + plant3.setProperty("switch").send(OFF); + plant4.setProperty("switch").send(OFF); + plant5.setProperty("switch").send(OFF); + plant6.setProperty("switch").send(OFF); //wait for rtc sync? rtcDeepSleepTime = deepSleepTime.get();