allmazz
(allmaZz)
May 4, 2020, 7:05pm
1
Hello. Made a switch from relay, esp8266 and buttons. I can turn on the light through the Home Assistant, but there is no button. If I connect from the EspHome Dashboard and look at the logs, I see a message like “light_button2 ': Sending state ON”, but relay(and status in HA too) not react. Please help. Here is the config:
output:
- platform: gpio
pin: 2
id: gpio_22
light:
- platform: binary
name: "Light"
id: light_2
output: gpio_22
binary_sensor:
- platform: gpio
pin: 0
id: light_button2
on_click:
min_length: 200ms
then:
- light.toggle: light_2
When you press the button you have on the binary sensor does the log show the light_2 toggling both ‘ON’ and ‘OFF’?
allmazz
(allmaZz)
May 4, 2020, 7:44pm
3
Thanks for answer!
I see that:
[22:39:15][D][binary_sensor:036]: 'light_button2': Sending state ON
[22:39:15][D][binary_sensor:036]: 'light_button2': Sending state OFF
tom_l
May 5, 2020, 2:49am
4
Give the gpio output a name and it will show up in home assistant. If you only use id it is internal to the ESP only.
Likewise for the binary sensors (if you actually want them in home assistant).
Yes, as tom_i said. I hadn’t spotted that. You need something like:
switch:
- platform: gpio
name: "Light 2"
pin: 2
id: gpio_22
binary_sensor:
- platform: gpio
pin: 0
id: light_button2
name: "Light Button 2"
on_click:
min_length: 200ms
then:
- switch.toggle: light_2
Then, in HA integrations, you’ll be able to see your entities.