I’ve seen configuration examples for creating an output line to turn something on and off on and ESP32 (using, of course, ESPHome). I’ve also seen examples of reading a switch and reporting the switch state.
I’m working on a box that would use some simple toggle switches (so they could be read as binary sensors). The box would also have LEDs on it. Can I make a configuration for the LEDs so one will turn on when a switch is on and the other will turn on if the switch is off? I know I can use automations to do this on my Home Assistant hub, but I’m hoping to do it on the ESP32 itself. This would make wiring the device easier (since I don’t have to use a flip-flop or transistors to turn one LED on and the other off as the switch changes state.
Can I link two devices, a binary sensor, and an LED, on the ESPHome configuration so they don’t have to use anything off the chip to control the LEDs?
And, beyond that, I’ve seen some examples, but I’m not clear about setting up an ESPHome device configuration. Is it basically the same rules and setup for any device on HA? (Other than adding the GPIO pin number and a few things like that.) Depending on what I use as search terms, I either don’t find anything helpful or find enough that I have trouble sorting through it, so suggestions on what pages to read to learn how to define a device in HA, or, more specifically, in ESPHome would be appreciated!
I had found a list of example configurations for devices when I searched for ESPHome devices and found some other hits. The list of devices was overwhelming and just so many I wasn’t sure just what was relevant. I was having trouble narrowing down just what pages to read (and a lot of searches were turning up forum questions that might be tangentially related or unrelated to what I was looking for). So the link on the Switch Component is a big help - I was just not sure just what terms to use to narrow down the hits.
I was also not aware that I could use an automation within a device definition. Will that work on the chip alone, or does it depend on the Home Assistant hub to work? In other words, is it possible for this to be totally self-sufficient?
If it helps (I figured this would fit in the TL;DR category), I’m making a control box for equipment in my workshop. Also, I’ve had times where I update Home Assistant and something goes wrong and I lose functionality for a few days until I can work out what’s wrong. Two items that this control panel would turn on and off are a CNC and the laser on the CNC. I need to be sure these will always work. (And, as for updating ESPHome, since the chips are cheap enough, I can keep a backup chip so, worst case, if an update goes bad, I can just swap chips until I get things fixed - or save the config and re-install it). I need to make sure the switches and LEDs on this are always working, so I want to make this box completely self-sufficient, so if something goes wrong with my HA hub, it won’t create issues with this control box.
I will be setting this up to work with HA. For instance, when the laser is turned on, it’ll turn on a vent fan (also controlled by an ESP32 with ESPHome on it). So it will interact with HA, I just want to make sure the functions on the box do not require the hub to be working.
I don’t even have home assistant in my setups…
I’m using Esphome barebones for quite complete automations.
Many of them. Communicating between each other…
I was not aware ESPHome was this powerful. So I can have two boxes, say, ESPH1 and ESPH2, both, of course, with their own ESP32 in them, and they can work with each other without going through HA?
I didn’t realize it could do that. Can each instance work with others AND with HA? I’m thinking if I’m using this box to control my CNC and laser, and another ESPHome instance to control the fan, having the two talk directly would ensure things keep working even if an update creates issues with my HA hub.
It also lets me do some integration I want to do much more easily than writing my own code!
Just thought about this. Is there a way to access the ESPHome devices with a cell phone app? (I realize you can use the website each one has to control it, I’m wondering if there’s an app that can be used to keep them in one place.)
Yes. Just build all the automations in Esphomes and use HA just to monitor/interact. Esphome devices work reliably even when HA or internet is down. I’m not able to guide you a lot for the HA part though…
You can access them from any web browser or app that makes HTTP requests in same local network (or if needed from internet, but that needs more configuration).
Since they can communicate between each other, you need only one to interact with.
I’ve found one program mentioned for installing ESPHome without using Home Assistant and one phone app for accessing ESPHome. (While I can always use a browser to connect to any instance of ESPHome, an app can make it a bit easier by not always having to type in system names or IP addresses. I’ve also considered how easy it would be to set up a simple website on one of my other servers that would have links to each of my ESPHome devices to make it easier and quicker to get to any of them.)
While I’m using Home Assistant, I really like the idea of making my ESPHome devices able to work independently and be a kind of sub-network and it would also help to be able to install ESPHome without having to use Home Assistant and the ESPHome add-on. How are you installing ESPHome onto your chips?