I have setup presence detection using my Asus Router for my wife’s & my cell phones and created an automation to switch the profile in Blue Iris depending whether or not we are at home. I would like to turn a specific light on when it is dark and either one of us arrives home. I know I can add another action to turn the light on in my existing automation but this would fire even if we came home during the day, I only want this particular light to come on if we return at night.
Is it possible to do this in the same automation or would I be better to create a separate one for this single task? I hope what I am asking makes sense.
You could either make two scripts and have the automation determine which one to call based on whether it is dark or not with an if else service template… or just make two automations with the time or (after dark) condition in the one that would also turn on the light… Probably both about the same amount of work to setup.
It’s not too bad… I’m no expert on these templates myself… but I’ll show you just so you can see…
Would obviously have to be modified to your needs…(someone on here could probably whip up the exact template in seconds… but I’m not that good at it) but I have two scripts (basically just automation actions with just a title and the word sequence…) for my camera motion one which sends me a push notification and saves it to my computer and one that just saves it to my computer without sending it to me based on the angle of the sun and weather there is precipitation or not…
action:
- service: script.turn_on
data_template:
entity_id: >
{% if is_state('sensor.darksky_precip','Rain') and states.sensor.sun_elevation.state|int <0 %}
script.camera_motion_snap
{% elif is_state('sensor.darksky_precip','Snow') and states.sensor.sun_elevation.state|int <0 %}
script.camera_motion_snap
{% elif is_state('sensor.darksky_precip','Sleet') and states.sensor.sun_elevation.state|int <0 %}
script.camera_motion_snap
{% elif is_state('sensor.darksky_precip','Hail') and states.sensor.sun_elevation.state|int <0 %}
script.camera_motion_snap
{% else %}
script.camera_motion_snapandpush
{%-endif-%}
I have been yelled at multiple times because the first thing I do some days is crack open the laptop because I thought of something I could do while at work… …VNC on mobile gets difficult for certain tasks…
My wife is a nurse and worked all over Easter so I had plenty of time to experiment. Fortunately she is somewhat used to the crappy Wink App and using our two Google Home Mini’s to control lights. I haven’t unleashed Home Assistant on her just yet. I need to make sure it is stable (Which I am happy to say it seems to be) before I go for the WAF (Wife Approval Factor!)
Back to the original question
I would split this into two different automations. Of course, it can be done in one, but next time you want to trigger something else when you get home, it gets more and more complicated to maintain.
I prefer to have one automation (in fact one yaml file) for one task, that way I should be able to find it easily and also not impact anything else when I start changing it. (WAF)
It seemed a little easier. The really cool thing is that I triggered the lights in question (There is 2 in the fitting) so they turned on at 100% when either my wife or myself arrive home after sunset then after 10 minutes 1 turns off and the other dimmed to 50%. Man I love this lol