Get the top HN stories in your inbox every day.
cheeko1234
toxik
> 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
Attached 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.
toxik
I do the same thing, so I understand the topology - that’s why I pointed it out, your Apple TV can be made a trojan horse, as it were, for example if there is a 0-day in tvOS. (And you have to assume that there are.)
I’m not saying it’s likely you’ll be targeted, I’m just saying the actual security offered by this setup is not very good.
Vladimof
> 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...
undefined
LoveMortuus
I think I might be missing something, because how does 'not open to the internet' and 'controllable only from outside of the network' not contradict itself?
thedanbob
I believe he means the Home Assistant instance is not exposed to the internet, but it's bridged to Homekit which is available outside his home network. I have the opposite setup: my Home Assistant instance is available off network, but I don't have a Homepod or newer Apple TV so I can only use Siri to control it at home.
LoveMortuus
Can people not access the Home Assistant through Homekit? Sorry if I'm asking obvious questions, I haven't tried any of these, not even Alexa or Google's one. I don't even think they're available in my country (Slovenia) and they don't really have a lot of useful Slovenian information.
On a surprising note: The language recognition had become really good for Slovenian!
alin23
This 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) 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
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
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-xrEon7ge28eta
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.
gerdesj
"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!
kelvie
Fairly 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.
thedanbob
> 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.
cptskippy
> I write my own firmware for all of my ESP devices and I can confirm, those definitely are the bulk of the work.
I was doing that too for all of my projects. I was developing them as if they were products I could potentially sell. When I accepted that I wasn't ever going to do that, I gave ESPHome a try.
> took less than an hour to write since I was able to copy-paste all of that boilerplate from a previous project.
It would probably take 5 minutes to configure from scratch ESPHome, less time if you're copying from an existing config. In addition to that, you get automatic logging into Home Assistant and deep integration for free.
Using Hypfer's discovery[1] that you could read the raw values from Ikea's Vindriktning using an ESP, I wrote an ESPHome script for an ESP01 that pipes the data into Home Assistant. Now when I'm cooking and the air quality gets too bad my HVAC fan kicks on to clear the air. It took longer to solder everything up than it did to "code".
YAML:
esphome:
name: air-quality-sensor-1
esp8266:
board: esp01_1m
# Enable logging
logger:
# Disable logging
baud_rate: 0
# Enable Home Assistant API
api:
ota:
password: !secret aqs_ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Air-Quality-Sensor-1"
password: !secret aqs_hotspot_password
captive_portal:
# Setup Ikea Vindriktning PM2.5 sensor
uart:
rx_pin: GPIO3
baud_rate: 9600
sensor:
- platform: pm1006
pm_2_5:
name: "Ikea Vindriktning PM25"
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 10
[1] https://github.com/Hypfer/esp8266-vindriktning-particle-sens...kelvie
FYI this could have been done really easily in esphome:
switch:
- platform: gpio
pin: 25
name: "Modem relay"
restore_state: ALWAYS_ON
id: modem_relay
interval:
- interval: 1min
if:
condition:
not:
wifi.connected
then:
- switch.turn_off: modem_relay
- delay: 1s
- switch.turn_on: modem_relayBeta-7
>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
There'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.
cptskippy
> 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/):
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_relayrexfuzzle
I 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.
pathartl
I 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.
darknavi
I _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.
michaelmior
That'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.
godsfshrmn
I 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
pathartl
I 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
It amuses me that I feel using an ESP32 is overkill when the ESP8266 is an option.
lostlogin
Exactly the same for me, then I saw the wesp32 recommended here this week and got super interested. POE.
cptskippy
I missed that, thanks for the link!
pathartl
In my case for the laundry stuff I needed an ESP32 for all the analog inputs.
lostlogin
I 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.
gedy
This 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
Now that's a blog post I'd read.
tamu_nerd
It'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-usi...
cptskippy
> shift register required for ESP8266
Why? A D1 Mini has 8 Digital I/O ports that could drive a 3.3.v relay module.
gedy
I 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
I second this. I’ve been toying with irrigation for a while, but valves have always been the issue
moffkalast
> recently
> $20 in parts
With how much ESPs go for right now I kinda doubt that, what's the whole BOM?
gedy
Bear 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
Ah alright that's more believable, though still quite a bargain.
cptskippy
> With how much ESPs go for right now I kinda doubt that
D1 Minis are like $1.50 and ESP01s are $0.95.
moffkalast
Good 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.
tekstar
Can 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
cptskippy
What 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...
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.
godsfshrmn
12v 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
michaelmior
With existing WiFi valves, there would likely be no need for ESPHome.
deviantintegral
I'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
I tend to just go with a project box that fits the stuff I want and use my dremel to open up whatever I need.
jtolly710
Or you can be like me and just have breadboards or bare circuits everywhere
cptskippy
I'm just going to leave this here: https://i.imgur.com/bJCz4TE.jpg
tekmaven
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.
qgin
Absolutely 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.
azinman2
Which sensor are you referring to specifically?
tylermenezes
I'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.
bellboy_tech
Long 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!!!!
hackcasual
Just 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
Did 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.
alsobrsp
ESPHome 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".
Get the top HN stories in your inbox every day.
Wow, 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.