9 ms·
ESPHome – Connect ESP32 with Sensors to HomeAssistant
- gedy 4y agoThis is a really handy project for low code ESP32 & ESP8266 use in Home Assistant. I recently made a 8 switch irrigation system with < $20 in parts and just a few lines of yaml.
- heffer 4y agoNow that's a blog post I'd read.
- tamu_nerd 4y agoIt's actually pretty straightforward: just wire in the relays (shift register required for ESP8266) then turn them on and off as desired. With your valves exposed via wifi to Home Assistant or MQTT the world is your oyster as far as using inputs (weather, rain, etc) to bring intelligence into your irrigation scheduling. I loosely followed this guide when I built mine: https://selfhostedhome.com/diy-wifi-sprinkler-controller-using-esp8266-part-1/ https://selfhostedhome.com/diy-wifi-sprinkler-controller-usi...
- cptskippy 4y ago> shift register required for ESP8266 Why? A D1 Mini has 8 Digital I/O ports that could drive a 3.3.v relay module.
- tamu_nerd 4y agoNot sure, I didn't try, but using one was a good excuse to learn how. The blog post suggests that despite there being 8 they're not all suitable for use (maybe due to high on boot or something)
- cptskippy 4y agoAh... that makes sense. It looks like IO0 needs to be pulled high to boot. Still looks like you could redefine RX to a GPIO and still have 8 if you didn't need serial input. I vaguely remember running into this issue with some load cell AMPs. A Shift Register or IO Expander seem like the more interesting and less frustrating route. I'd probably end up using an ESP01 and i2c IO Expander because I'm a masochist and love trying to squeeze as much as I can out of the ESP01.
- gedy 4y agoI actually referenced tamu_nerd's link below, but my approach was simpler as I used an ESP32 (more pins, so no shift register needed), and I powered the ESP32 with its own USB charger (so no AC to DC converter needed). I can add something to GitHub and will reply here)
- baldeagle 4y agoI second this. I’ve been toying with irrigation for a while, but valves have always been the issue
- tekstar 4y agoCan you explain this more? I've been getting into home automation and my wife would like programmable irrigation for when we're not at home. Did you interface with existing wifi valves or are you doing the circuit yourself? I recently got rtlsdr to read my water meter so I can detect leaks, which is pretty cool
- michaelmior 4y agoWith existing WiFi valves, there would likely be no need for ESPHome.
- godsfshrmn 4y ago12v valves off Amazon. Don't get the cheap plastic ones. Get the brass versions as long as you don't run several at once, can power from old wall wart with a few amps rating. I'm using a meanwell PSU so I can power a few other things - IR lights mostly
- cptskippy 4y agoWhat the OP did was build a simple irrigation controller for an existing irrigation system. Most irrigation systems use electronic solenoid valves that open when very low current 24 VAC power is applied to the two terminals. Take a look at the Spec for a valve from Rainbird: https://www.rainbird.com/sites/default/files/media/documents/2021-06/d37554-0719_gsv-techspec_fin_web.pdf https://www.rainbird.com/sites/default/files/media/documents... Electrical Specifications: • Power: 24 VAC 50/60 Hz (cycles/second) GBS25 Solenoid • Inrush Current: 0.41 A (9.84 VA) • Holding Current: 0.20 A (4.80 VA) at 60 Hz, 0.23 A (5.40 VA) at 50 Hz If you have a sprinkler system, you can replace the on/off valve with a solenoid valve and then you're able to control the system electronically using a 24 VAC power supply and a switch. The OP replaced the switch with a relay, which is a switch that can be actuated by the lower voltage from something like a microcontroller.
- moffkalast 4y ago> recently > $20 in parts With how much ESPs go for right now I kinda doubt that, what's the whole BOM?
- gedy 4y agoBear in mind I already had irrigation system with 24v valves in place. The <$20 is the adding the ESP32 , 8 switch relay rail, plus the plexiglass, standoffs, and USB charger.
- moffkalast 4y agoAh alright that's more believable, though still quite a bargain.
- cptskippy 4y agoThe thing you have to understand is that controlling an irrigation system is easy, the valves work just like light switches but on lower voltage. The cost of an irrigation system is making it user friendly for a customer. Example: https://www.amazon.com/Hunter-Sprinkler-XC400-4-Station-Controller/dp/B00FYRXFPG https://www.amazon.com/Hunter-Sprinkler-XC400-4-Station-Cont... Like the OP's solution, it is a microcontroller hooked up to a relay array, but it also has: * AC/DC Transformer * Real-Time-Clock * Battery backup * User Interface * Secure, weather proof housing * Printed Instructions And it costs less than $90. They're making a profit on them, so the BOM is probably closer to $20-30. The solution is completely plug-n-play compared to building from scratch, setting up a home automation system, and programming a microcontroller.
- cptskippy 4y ago> With how much ESPs go for right now I kinda doubt that D1 Minis are like $1.50 and ESP01s are $0.95.
- moffkalast 4y agoGood luck controlling an 8 pin relay with 4 accessible pins hah. The 01s are cheap for a reason - they're useless for most projects, hell I'm always running out of pins even on the esp32-cams.
- cheeko1234 4y agoWow, Esphome on the front page. This project is what makes me feel like ironman. The most used esphome is the one I have installed with a relay to my garage opener. I'm able to automatically conjure siri using 'hey siri' on my airpods and tell her to open my garage, while being on my motorcycle. The response time of my garage opening from having finished my sentence to siri is less than half a second! I drive right in, and I have a timer set on home assistant to hit the relay again after a minute so the garage closes automatically. Also have 5 esphomes with motion/temperature sensors. All my automations are programmed using node-red. Everything is run using docker-compose. Keep in mind, my home assistant or esphome is NOT open to the internet, and only controllable by apple devices from outside the network.
- toxik 4y ago> Keep in mind, my home assistant or esphome is NOT open to the internet, and only controllable by apple devices from outside the network. Sounds like they’re network connected to me!
- avianlyric 4y agoAttached to HomeKit, so the devices outside of the network need to use iCloud and HomeHub (Apple TV, HomePod etc) to bridge into the network. In short your phone kindly asks an Apple TV (within your local network) to execute a device command on its behalf, via iCloud. If you trust Apple to get their device-to-device auth and crypto right (which is the same stuff that power iCloud Keychain), then you can trust HomeKit to not expose your home devices to randos on the internet.
- Vladimof 4y ago> If you trust Apple to get their device-to-device auth and crypto right (which is the same stuff that power iCloud Keychain), then you can trust HomeKit to not expose your home devices to randos on the internet. I would rather host a Wireguard VPN on my home network...
- 4y ago
- e28eta 4y agoIn 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.
- pathartl 4y agoI love ESPHome. Here's some of the stuff I've been able to accomplish: - Expose IR commands for turning our bedroom fan on/off along with some battery-powered candles - Flashed it to a Sonoff S31 to detect if our electric fireplace is on/off based on power usage. - Secondary ESP32 that controls said fireplace with IR commands and has an attached dfplayer MP3 module to play a loop of fireplace sounds - Wired up some photoresistors to an ESP32 that are spaced to match the status lights on our washing machine. The same ESP32 has an accelerometer attached to our dryer that changes its state depending on vibrations of the dryer. - There's an ESP32 in our garage that has two VL53L0X time-of-flight range sensors to detect whether the garbage or recycling bin is out. In my automations I check if it's garbage or recycling day and send a notification if the bins haven't been taken out. All of my automations are written in C#/.NET using NetDaemon.
- cptskippy 4y agoIt amuses me that I feel using an ESP32 is overkill when the ESP8266 is an option.
- lostlogin 4y agoExactly the same for me, then I saw the wesp32 recommended here this week and got super interested. POE. https://wesp32.com/ https://wesp32.com/
- cptskippy 4y agoI missed that, thanks for the link!
- pathartl 4y agoIn my case for the laundry stuff I needed an ESP32 for all the analog inputs.
- lostlogin 4y agoI hooked a big extractor fan up to some ducts. In summer it pushes fresh air into the house, in winter it pushes warm air from a wood burner into the bedrooms. The ESPs and some relays allow me to toggle some valves to change between summer and winter modes. In winter mode Home Assistant automatically checks if the bedrooms are cooler than the room with the fire, and pushes warm air if so. ESP chips are great, and ESPHome makes programming them very easy. ESP-MQTT allows more custom stuff, and I’ve done that via Arduino. I’m sure someone skilled could make something very tidy, mine all all botch jobs, but 3 years later it’s still working fine without maintenance.
- tylermenezes 4y agoI've been using ESPHome for 2 years now and once you get it set up, it's definitely the most "just works" product in IoT.
- tekmaven 4y agohttps://www.esphome-devices.com/ https://www.esphome-devices.com/ There is a lot of great retail hardware with ESP chips out in the market. The above site is a collection of ESPHome configurations for a lot of that hardware.
- eptcyka 4y agoEver since HomeAssistant developers threw a hissy fit about NixOS (and anyone else) repackaging their software, even if their license allows for that, I can no longer support this project. Which is a shame, since it is very turnkey.
- deleted 4y ago[deleted]
- phoronixrly 4y agoInteresting, please provide link if you have one handy
- windlep 4y agoDisclaimer: I've done some development on Home-Assistant (HASS), and work on the Nabu-Casa cloud service for Home-Assistant. I was contacted by a NixOS core contributor to see if there was a better solution for HASS in NixOS. This is a bit misleading, a single HASS developer requested their packages not get repackaged because they didn't want the support burden of users who think the software is broken when its actually due to packaging. Originally on HN here: https://news.ycombinator.com/item?id=27505277 https://news.ycombinator.com/item?id=27505277 Both the GitHub issues have since been closed and settled. It's useful and important to note that Home-Assistant's turnkey ease-of-use is partly because its acting as a package manager of sorts. When integrations and components are added by the user, their package requirements are downloaded immediately from the Internet and installed. This is quite contrary to the intended operation of NixOS and its immutable and reproducible package installation concept. This is where the concerns of Frank came in, as a user of HASS on NixOS will likely have a sub-par experience and the documentation on the Internet for HASS will not work correctly for them in many cases. On the other-hand, I'm sure a decent amount NixOS users are probably aware of this (as I was when I was using NixOS daily). My suggestion (and supported by the HASS founder) was that NixOS repackage HASS and call it something else, like how the code behind Firefox is repackaged without the Firefox name. This way at least NixOS users of it will get more appropriate Google results when searching for an issue related to their install, and are unlikely to burden HASS developers with support issues that are likely related to the install approach and not a HASS issue. This was back in July of 2021, and I haven't followed up on it since, so I don't know if NixOS is doing this yet, or what the current state is there. But if you're running NixOS and want that turnkey experience, you're not going to get it. If you want a full turnkey setup I'd highly suggest using HASS OS, whether on a small dedicated device, or in a KVM (https://www.home-assistant.io/installation/ https://www.home-assistant.io/installation/).
- qgin 4y agoAbsolutely amazing for when preexisting zigbee/etc devices and sensors just aren’t quite what you’re looking for. Want to use a time of flight distance sensor to trigger something in an exact spot instead of a handwavey pir motion sensor going off anytime there’s motion in the room? ESPhome can do that.
- hackcasual 4y agoJust this weekend I made a project to hookup my standing desk and treadmill to Home Assistant, and used ESPHome as the coordinator. Took me a bit to understand how to add custom components, but once I did, got a nice collection of buttons added to my dashboard with no UI work. Really the only downside, and it's likely something I could handle with more digging, is the task switching granularity of the main loop causes the desk to overshoot and then have to correct when going for a height. My desk control loop reads from the UART interface of the desk display, and activates the up and down buttons. If there's too much time in between loops, it'll have traveled too far. Worst case, I could just get a cheap dedicated controller like an attiny85 to handle controlling it with better real-time constraints.
- cptskippy 4y agoDid you just expose the UART as sensor to HA? If so, you might try a custom UART component with a loop that runs on the ESP to manage the desk level. Then have input and output components for sending and receiving the desired height from HA. https://esphome.io/custom/uart.html https://esphome.io/custom/uart.html
- deviantintegral 4y agoI've always wanted to play around with ESPHome. However, it seems like many of the projects assume you have a 3D printer, or end with a breadboard and leave finishing it off as "an exercise to the reader". As much as I would have fun building a PIR motion sensor from scratch, if it's going to be in the house it has to look like a finished project, so I end up buying something off of AliExpress. Anyone know any good tutorials or resources that work from "you've got everything connected, flashed, and working, here's how to polish it"?
- m-p-3 4y agoI tend to just go with a project box that fits the stuff I want and use my dremel to open up whatever I need.
- kristianpaul 4y agoI still use tasmota , need to give this one a try
- alin23 4y agoThis project was the best thing I stumbled upon this decade. I have used ESPHome to create a wireless ambient light sensor that my Mac app (https://lunar.fyi/#sensor https://lunar.fyi/#sensor) can use to adapt monitor brightness automatically. Even non-technical users are now doing their own sensor with the tutorial I wrote: https://lunar.fyi/sensor https://lunar.fyi/sensor I also like to use ESPHome for standalone devices like dimmable LED strings and IR remotes, but I always wished there was a simple app to control them. My HomeAssistant dashboard became too complex and slow and is annoying to wait for it when I just want to adjust brightness or volume. So I created another app for that called Volum: https://lowtechguys.com/volum https://lowtechguys.com/volum Below is a demo video of how I use it to control: 1. A battery powered LED string 2. An Ambilight-like SK6812 RGBW LED strip behind my monitor 3. An ESP8266 with an IR LED to control volume of an Edifier speaker Demo video: https://youtu.be/nzz-xrEon7g https://youtu.be/nzz-xrEon7g
- alsobrsp 4y agoESPHome is great. I have used it to make a garage door controller for an old non-smart opener. Wired contact sensor with a relay to "press the button".
- bellboy_tech 4y agoLong time home automation guy; absolutely love ESPHome!! It's become the glue for so many non-connected and re-connected devices. $4usd esp8266 adds WiFi to anything. $8 esp32 adds BT and WiFi to anything. OR reuse/take over any of thousand of existing devices that already use ESPs. IOT Light bulbs, wall switches, air quality devices... It's amazing how many new devices/sensors get added to each version. My favorite project is adding wifi and temp/humid sensing to the IKEA $10 air sensor. We have them in every room. Thank you ESPHome devs!!!!