Update control of music to play when lock is locked

main
Przemysław Grondek 2024-03-31 21:59:04 +02:00
parent b89a564fcc
commit 77809d9623
2 changed files with 14 additions and 12 deletions

View File

@ -9,7 +9,8 @@ or Wi-Fi
* turns on/off light
* turns on/off music
* Lock switch turns fan for 5 minutes
* Music plays on a loop while light is on
* Music plays on a loop while lock sensor senses that lock is locked
* Music turns off when lock sensor senses that lock is unlocked
## Pinout

View File

@ -21,19 +21,25 @@ binary_sensor:
- platform: gpio
pin: 25
id: button
on_click:
on_click:
then:
- switch.toggle: light_relay
- platform: gpio
id: lock_status
pin: 14
on_release:
on_state:
then:
- dfplayer.play_folder:
folder: 1
loop: true
on_release:
then:
- dfplayer.stop
- switch.turn_on: fan_relay
- delay: 5min
- if:
condition:
- binary_sensor.is_off: lock_status
- binary_sensor.is_off: lock_status
then:
- switch.turn_off: fan_relay
@ -41,16 +47,12 @@ switch:
- platform: gpio
id: light_relay
pin: 26
on_turn_on:
on_turn_on:
then:
- dfplayer.play_folder:
folder: 1
loop: true
- switch.turn_off: down_led
- switch.turn_off: down_led
- switch.turn_on: up_led
on_turn_off:
on_turn_off:
then:
- dfplayer.stop
- switch.turn_off: up_led
- switch.turn_on: down_led
- platform: gpio
@ -62,4 +64,3 @@ switch:
- platform: gpio
id: down_led
pin: 33