I’m trying to make an LED light blink with esphomeyaml. With the following yaml I can turn the blinking LED on once, but after I turn it off it cannot be turned on again. I’m using mqtt and on the state topic i get “ON” but the LED does not turn on. I just upgraded the hass.io esphomeyaml addon to 1.10.0.
My hardware is a wemos D1 mini and the led is connected with a 330Ohm resistor.
Weirdly enough, the first time I tried it (once HA recognized the switch, I had the same problem as @malgoe, where it would turn on once, then nothing. After a hard reboot/power cycle, it magically worked! I… don’t know why but it did, and has continued to since.
Big thanks, this was actually kind of important because I have a bed shaker that’ll burn out if left running for > 30s intervals so yeah.
With the new API, is there a way to tell HASS the status of the switch so it just appears as a standard on/off toggle? With MQTT I would have set up a binary_sensor in EHY that gets turned on/off with the template, and just have manually configured the MQTT device in configuration.yaml. It’s not the most important but it’d be nice. Either way, thanks for all your help!
I spoke too soon! Consistent behavior with this config is now that it works to pulse very nicely, once. After you turn off the light/switch in HA, it does not turn on again. The debug logs show it turning on the template switch and sending an ON state, but not turning on the hidden actual output. Oddly enough, it does show the turning off action for the switch itself when it’s supposed to.
I’ll attach the logs below. Configuration is copy/pasted from yours, @OttoWinter, except I have sv_relay instead of red_pin and “Bed Shaker” is the exposed template switch.
# Turned on switch from HA
[03:54:33][D][switch:033]: 'Bed Shaker' Turning ON.
[03:54:33][D][switch:033]: 'sv_relay' Turning ON.
[03:54:33][D][switch:055]: 'sv_relay': Sending state ON
[03:54:33][D][switch:055]: 'Bed Shaker': Sending state ON
[03:54:36][D][switch:037]: 'sv_relay' Turning OFF.
[03:54:36][D][switch:055]: 'sv_relay': Sending state OFF
[03:54:39][D][switch:033]: 'sv_relay' Turning ON.
[03:54:39][D][switch:055]: 'sv_relay': Sending state ON
[03:54:42][D][switch:037]: 'sv_relay' Turning OFF.
[03:54:42][D][switch:055]: 'sv_relay': Sending state OFF
# Turned off switch from HA
[03:54:44][D][switch:037]: 'Bed Shaker' Turning OFF.
[03:54:44][D][switch:037]: 'sv_relay' Turning OFF.
[03:54:44][D][switch:055]: 'sv_relay': Sending state OFF
[03:54:44][D][switch:055]: 'Bed Shaker': Sending state OFF
# Tried to turn it on again
[03:55:02][D][switch:033]: 'Bed Shaker' Turning ON.
[03:55:02][D][switch:055]: 'Bed Shaker': Sending state ON
# Off in HA. Notice it _does_ set sv_relay state this time. On/Off another time for posterity.
[03:55:17][D][switch:037]: 'Bed Shaker' Turning OFF.
[03:55:17][D][switch:037]: 'sv_relay' Turning OFF.
[03:55:17][D][switch:055]: 'sv_relay': Sending state OFF
[03:55:17][D][switch:055]: 'Bed Shaker': Sending state OFF
[03:55:20][D][switch:033]: 'Bed Shaker' Turning ON.
[03:55:20][D][switch:055]: 'Bed Shaker': Sending state ON
[03:55:21][D][switch:037]: 'Bed Shaker' Turning OFF.
[03:55:21][D][switch:037]: 'sv_relay' Turning OFF.
[03:55:21][D][switch:055]: 'sv_relay': Sending state OFF
[03:55:21][D][switch:055]: 'Bed Shaker': Sending state OFF
Quick question on this:
Is it possible to run the while loop on boot, but then break it when a different command comes in?
(In my case: a monochromatic light that toggles with a default_transition_length, but will then go in to “normal operation” when a command is received from homeassistant)
Hi, i just had the same error and found an solution:
Turn off the logging in esphome, because every blink will be written.
Since i deactivatet “logging”, my Alarm-Blinker runs and runs…
hi,
I’m trying to use this therad in my project but with no success. I want this:
when water heater is working than indicator led blink constantly. here is a part of code:
Thanks for you concern, wasn’t expecting that
I know about light effect but don’t know how to make led is light (or fashing or anything) when heather is activated