Use new switch.on_state

This commit is contained in:
Edward Firmo
2025-08-09 14:46:14 +02:00
parent aae3eaa204
commit fc135875c5
2 changed files with 32 additions and 41 deletions

View File

@@ -151,20 +151,17 @@ switch:
pin: GPIO21
restore_mode: ALWAYS_OFF
internal: true
on_turn_on:
on_state:
then:
- binary_sensor.template.publish:
id: bs_vibrating
state: ON # yamllint disable-line rule:truthy
state: !lambda return x;
on_turn_on:
then:
- delay: ${vibration_max_duration}
- if:
condition:
switch.is_on: sw_vibration_motor
then:
- switch.turn_off: sw_vibration_motor
on_turn_off:
then:
- binary_sensor.template.publish:
id: bs_vibrating
state: OFF # yamllint disable-line rule:truthy
...