esphome / esphome-core

🚨 No longer used 🚨 - The C++ framework behind ESPHome
https://esphome.io/
GNU General Public License v3.0
547 stars 115 forks source link

esphomeyaml automations without wifi or mqtt #265

Closed snizzleorg closed 6 years ago

snizzleorg commented 6 years ago

I use esphomeyaml for an RFID door opener. recently home assistant and the mqtt broker had a problem and therefore my RFID door opener did not work. It would be great if the automations would still run even if no network connection is available.

It seems now the system will loop and try to connect.

R3yn4ld commented 6 years ago

Hello,

Experienced a similar problem on sonoff relays:

I loose some WAF point when it happens to the washing machine...

OttoWinter commented 6 years ago

esphomelib does actually run all automations while offline. One problem you might have experienced is the ESP rebooting because it can't establish a MQTT/WiFi connection. See the reboot_timeout options in mqtt: and wifi: where you can constumize this.

As for the RFID sensor, that's more of an architectural problem: When you add a component to esphomelib, by default it gets initialized after the MQTT client is fully set up. This is due to one reason: If there's an error with setting up the communication with the sensor, you'd want to have that logged in the MQTT logs. But if the sensor would get initialized before the MQTT client, the logs would only appear in the UART logs over USB.

I knew this would come some day, so I created https://github.com/OttoWinter/esphomelib/pull/267 to address this issue. With it, all components get set up before MQTT, but dump their configuration after everything (including MQTT logs) have been set up.

when mqtt server is not seen for a minute, relay goes down

That's also a problem that has recently been fixed in the latest beta -> esphomelib now stores the state of switches/lights/etc in the RTC memory so that they're restored on boot.

So that should fix all those issues :)

snizzleorg commented 6 years ago

Sounds great. So the latest beta would work fully offline? Or does this Need any specific options?