I am hoping I phrased the question right. Basically I want different actions to fire when I unlock the door based on certain conditions. For example, if I arrive home during certain times I want HASS to welcome me home from work. Additionally, if it’s near sunset I want it to turn certain lights on. Would code like this work? I don’t have my RasPi yet or I would test:
automation:
- alias: 'Welcome Home Abby'
trigger:
platform: state
entity_id: sensor.front_door_code
to: "Abby"
action:
- condition: time
after: '16:00:00'
weekday:
- mon
- tue
- wed
- thu
- fri
before: '20:00:00'
weekday:
- mon
- tue
- wed
- thu
- fri
- service: tts.google_say
entity_id: media_player.living_room_speaker
data:
message: "Welcome home from work queen Abigail."
- condition: sun
after: sunset
after_offset: "-1:00:00"
- service: switch.turn_on
entity_id: switch.living_room