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 light
* turns on/off music * turns on/off music
* Lock switch turns fan for 5 minutes * 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 ## Pinout

View File

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