5 ms·
In addition to enjoying esphome for the ease of use and solid integration with Home Assistant, I find the technical underpinnings interesting. - Users produce
by e28eta 4y ago
In addition to enjoying esphome for the ease of use and solid integration with Home Assistant, I find the technical underpinnings interesting.
- Users produce yaml describing a microcontroller connected to (sensors, inputs, outputs, networks, services, etc).
- A python layer type checks that yaml, and spits out autogenerated C++ code (which can be inspected if desired)
- C++ is compiled and installed onto the hardware
- future updates can be made OTA
- extensible by either writing (hopefully small amounts of) C++ inside yaml (lambdas), or including/referencing C++ code (external components)
I’m still not positive I like yaml for the DSL, but that might be a personal bias and I’m not sure what an obviously better solution would be.
- pathartl 4y agoI agree with the last point, so I usually end up delegating any sort of logic handling to my automations. ESPHome will just report the state of sensors, my code figures out what to do with them.
- michaelmior 4y agoThat's understandable although of course doing things in YAML in ESPHome has the advantage that it will continue to work if HA is unavailable for some reason.
- darknavi 4y agoI _really_ like that you can do light automations easily with ESPHome as well. For my cat feeder, it has some cron-like scheduling to go off ever so often and I do not want my cats to starve if my Home Assistant VM is down.
- godsfshrmn 4y agoI prefer the same but still for important uses I'll write native code to serve as a back up - e.g sprinkler auto shut off after x minutes
- kelvie 4y agoFairly heavy user of ESPhome here (I have about 15 or so devices automating several parts of my home). What would be a better option than YAML? The main advantages are ease of in-lining C++, and it's ubiquitous. Having to use k8s at work also makes it not much of a context switch to use for me, and the secrets management is great using the `!include`s. But yeah the killer feature here is the inlining of C++, and the use of platformio. You really can do anything without much work (maybe at most one or two external C++ header files for really custom stuff) inside ESPhome, and it's easy to see where your snippets go when you inspect the generated C++ code. ESPHome just automates all the super tedious parts of working with esp32s (stuff like connecting to wifi, MQTT, OTA upgrades, logging to mqtt, etc), without sacrificing any power. My only complaint is that because it uses arduino (I think?) you can't really do powersaving really well, but I don't think many people use battery powered esp32, but this basically eliminates that possibility, at least in my research.
- Beta-7 4y ago>What would be a better option than YAML? It isn't a 1:1 alternative, but I've always thought that ESPhome would be much more accessible for the non-devs if they introduced a GUI similar to Home Assistant's automation GUI.
- windexh8er 4y agoThere's always Tasmota [0]. Personally I prefer ESPHome but recently tossed Tasmota on some OTS Sonoff plug switches. Best part is you can just drop ESPHome firmware in the Tasmota OTA upgrade and switch at any point. [0] https://tasmota.github.io/docs/ https://tasmota.github.io/docs/
- thedanbob 4y ago> ESPHome just automates all the super tedious parts of working with esp32s (stuff like connecting to wifi, MQTT, OTA upgrades, logging to mqtt, etc), without sacrificing any power. I write my own firmware for all of my ESP devices and I can confirm, those definitely are the bulk of the work. The latest one (for a relay to power cycle my modem if the internet goes down) took less than an hour to write since I was able to copy-paste all of that boilerplate from a previous project.
- rexfuzzle 4y agoI find the yaml works fine for the basics, but the real power comes with being able to include your own c code and use that along with whatever is in the yaml. Basically means you can have normal arduino code that is the tied into hass very easily.
- cptskippy 4y ago> I’m still not positive I like yaml for the DSL, but that might be a personal bias and I’m not sure what an obviously better solution would be. The yaml files in ESPHome aren't any different than yaml for Git Pipelines, Docker, or K8. The don't contain much if any logic. Here's my garage door based on a Malouf ESP Dev board (https://maloufelectronics.com/ https://maloufelectronics.com/): esphome: name: garagedoor esp8266: board: esp01_1m # Enable logging logger: # Enable Home Assistant API api: ota: password: !secret garagedoor_ota_password wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Garage Fallback Hotspot" password: !secret garagedoor_hotspot_password # Enable Captive Portal captive_portal: # Define Hall Effect Sensor binary_sensor: platform: gpio pin: number: GPIO16 inverted: true name: "Garage Door Sensor" device_class: garage_door # Define Relay switch: - platform: gpio name: "Garage Door Relay" id: garage_door_relay pin: GPIO14 restore_mode: ALWAYS_OFF on_turn_on: - delay: 1000ms - switch.turn_off: garage_door_relay
- gerdesj 4y ago"I’m still not positive I like yaml for the DSL" Back in the day HA was all about YAML. It's still there but mostly hidden behind the GUI but /config/configuration.yaml still does a lot of work. ESPHome is simply amazing. I've got several ESP80266s with various lash ups all just working. For example, when my work computer room generator fires up a GPIO on a ESP8266 gets twitched from the power distribution board, another pin gives me mains power state from the perspective of the board. A few dozen lines of YAML - mostly copy n paste and I have a really decent sensor for less than £10 parts. We test the system every few weeks by turning a key. The UPSs beep for a few seconds, and the genny fires up. After a while you turn the key back, the UPSs beep again and then the mains takes the load back. Meanwhile your phone goes off several times with notifications (SMS, Teams etc) I particularly enjoy watching customer's expressions when I'm showing them around and I do a test there and then. I'm just doing a link to our rather ancient building alarm to get notifications. This will be a ESP01-S thing to get it really small. I was quoted many £1000s for a "modern system" with an app etc. The existing sensors are fine and the alarm itself works fine. It now has a length of CAT5e connected to some of its terminals for an external sounder. It delivers 12V, earth and a 12V signal. I just have to turn the 12V into 3.3V via some Zeners and stabilize it with a capacitor to power the ESP and the signal down to 3.3V via some resistors. I think!