Update control of music to play when lock is locked

This commit is contained in:
Przemek 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

@ -27,8 +27,14 @@ binary_sensor:
- platform: gpio
id: lock_status
pin: 14
on_state:
then:
- dfplayer.play_folder:
folder: 1
loop: true
on_release:
then:
- dfplayer.stop
- switch.turn_on: fan_relay
- delay: 5min
- if:
@ -43,14 +49,10 @@ switch:
pin: 26
on_turn_on:
then:
- dfplayer.play_folder:
folder: 1
loop: true
- switch.turn_off: down_led
- switch.turn_on: up_led
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