I was writing something wrong…
Replacing the line “pin: GPIO32” with this worked :
pin: number: GPIO32 allow_other_uses: true
I was writing something wrong…
Replacing the line “pin: GPIO32” with this worked :
pin: number: GPIO32 allow_other_uses: true
You do it by not using Switch. You need to be using binary_sensor.
You can do multiple actions for a single binary_sensor aka button by selecting multiple min/max times as well as single click, double click, multi-click if you want or need as well.
I highly suggest familiarizing yourself with the documentation. Browse through it and see whats available, what does what, like the difference between Switch, Button, and binary_sensor etc.
Here i use 1 button for 2 lights. 1 is basically a single button push(50ms -350ms) and the other is more of a “push and hold” that triggers the second light(action).
binary_sensor:
- platform: gpio
pin:
number: 13
mode:
input: true
pullup: true
name: "Bedroom/Porch Switch"
filters:
- delayed_on: 10ms
on_click:
- min_length: 50ms
max_length: 350ms
then:
- homeassistant.service:
service: "switch.toggle"
data:
entity_id: "switch.bedroom"
- min_length: 500ms
max_length: 1000ms
then:
- homeassistant.service:
service: "switch.toggle"
data:
entity_id: "switch.back_porch_lights"