Hi.
Trying to wrap my head around the best ways to use automations, and wanted to check if someone would offer their thoughts.
I use Blue Iris NVR system. The integration creates switches for each profile. I have different profiles for different use cases.
Profile 1 : If I am away
Profil 3 : If I am home
Profile 4 : If it’s night and there is precipitation (less sensitive to avoid false triggers due to precipitation)
What I’m struggling to find the best solution for is “how to go back to profile 1 or 3, if profile 4 is no longer true?”
Profile 1
trigger:
- platform: sun
event: sunrise
offset: +00:01:00 // wait some minutes so that sunrise condition will be true
- platform: state
entity_id: device_tracker.my_phone
from: home
to: away
condition:
- condition: sun
after: sunrise
action:
- data: {}
entity_id: switch.blueiris_profile_1
service: switch.turn_on
Profile 3
trigger:
- platform: sun
event: sunrise
offset: +00:02:00 // wait some minutes so that sunrise condition will be true
- platform: state
entity_id: device_tracker.my_phone
from: away
to: home
condition:
- condition: sun
after: sunrise
action:
- data: {}
entity_id: switch.blueiris_profile_profile_3
service: switch.turn_on
Profile 4
trigger:
- entity_id: weather.home
platform: state
to: rainy
- entity_id: weather.home
platform: state
to: lightning rainy
- entity_id: weather.home
platform: state
to: pouring
- entity_id: weather.home
platform: state
to: snowy
- entity_id: weather.home
platform: state
to: snowy rainy
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- data: {}
entity_id: switch.blueiris_profile_profile_4
service: switch.turn_on
mode: single
Maybe a template switch is better?
Something like :
switch:
- platform: template
switches:
profile_1:
friendly_name: "Choose profile 1 Blue Iris"
value_template: >-
{{ is_state(device_tracker.my_phone', 'away')
and is_state('sun.sun', 'above_horizon') }}
turn_on:
service: switch.turn_on
data:
entity_id: switch.blueiris_profile_1
turn_off:
service: switch.turn_off
data:
entity_id: switch.blueiris_profile_1
1 post - 1 participant