mirror of
https://code.hackerspace.pl/gro/elevator-control.git
synced 2024-11-21 11:53:43 +00:00
Update control of music to play when lock is locked
This commit is contained in:
parent
b89a564fcc
commit
77809d9623
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user