Hi I have some lights in the kitchen called candle lights. Through Tuya they open at sunset and shut of at 11PM.
I would like the lights to be turned off when I am not home when the alarm is armed.
What is the best way to integrate it to the following script I have already for my alarm?
Or if best use HA to turn on from sunset to 11pm and turn off if alarm is armed. Or not turn on at all if alarm is set before sunset
light is called switch.20808347bcddc2975aba
- alias: Random Away Lights
initial_state: true
hide_entity: false
trigger:
- platform: time_pattern
minutes: /10
seconds: 0
condition:
- condition: state
entity_id: alarm_control_panel.my_house
state: armed_away
- condition: time
after: '16:00:00'
before: '23:30:00'
action:
- delay: 00:{{ range(5,15) | random | int }}:00
- service: script.my_random_light
data_template:
random_group: group.alarm_lights
random_entity_id: '{{ state_attr("group.alarm_lights","entity_id") | random }}'
light_count_limit: 2
#see script file for continuation of this code
- alias: Random Lights off at 23:35
initial_state: true
hide_entity: false
trigger:
- platform: time
at: '23:35:00'
condition:
- condition: state
entity_id: alarm_control_panel.my_house
state: armed_away
action:
- service: homeassistant.turn_off
entity_id: group.alarm_lights
id: 4ca46850adee4561b216c28317dd2824
- alias: Random Lights Off Disarmed
initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: alarm_control_panel.my_house
from: armed_away
to: disarmed
action:
- service: homeassistant.turn_off
entity_id:
- light.53411381807d3a59486b #bedroom
- light.53411381807d3a59491c #family room
- light.73371318ecfabc9a8f79 #fireplace lights
- light.53411381807d3a597774 #kitchen ceiling
- light.53411381807d3a5972d7 #kitchen Island
- light.53411381807d3a597131 #living room ceiling lights
- light.186036583c71bf278e13 #Dining Room Light
- switch.25206422807d3a7e6a7f #Office Light