Hi all.
I have a really basic problem with ESPHome and the connection to an HAS device.
I want to create a simple “physical remote” with an esp8266, an small OLED screen and some push buttons to control some things integrated to HAS via integration.
But I can’t get the push buttons to work…
How can I couple the ESPHome switch to a HAS switch? I tried the Homeassistent Swicht type, but unfortunately it’s not working.
Furthermore I have the problem, that I do not know how to configure a “push” of a push botton as single click to toggle a switch. I push will always considered as a power on and power off.
This is my code I expected to work. I also tried it with a template switch but also without any success…
switch:
- platform: homeassistant
id: power_switch
entity_id: light.tv_lampe_rechts
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
id: toggle_power
filters:
- delayed_on: 10ms
on_click:
then:
- switch.toggle: power_switch
After booting, the home assistent switch is getting the right state, so it seems like the communication with HAS works in general.
You can see it in the log, as well the issue with sending state OFF and ON when pressing the push button once.
[19:25:37][D][api.connection:1389]: Home Assistant 2024.9.1 (xxx.xxx.xxx.xxx): Connected successfully
[19:25:37][D][homeassistant.switch:023]: 'light.tv_lampe_rechts': Got state OFF
[19:25:37][D][switch:055]: 'power_switch': Sending state OFF
[19:25:40][D][binary_sensor:036]: 'toggle_power': Sending state OFF
[19:25:40][D][binary_sensor:036]: 'toggle_power': Sending state ON
[19:25:43][D][binary_sensor:036]: 'toggle_power': Sending state OFF
[19:25:43][D][binary_sensor:036]: 'toggle_power': Sending state ON
[19:25:53][D][binary_sensor:036]: 'toggle_power': Sending state OFF
[19:25:53][D][binary_sensor:036]: 'toggle_power': Sending state ON
[19:25:54][D][binary_sensor:036]: 'toggle_power': Sending state OFF
[19:25:55][D][binary_sensor:036]: 'toggle_power': Sending state ON
Some ideas what I’m doing wrong?
Thanks to all