I have tried to create a automation to turn on my lights when I arrive after sunset and to turn on the lights when I am at home. It also should turn off all lights when I leave home. This shouldn’t be too hard but after reading many posts, trying many blueprints I just can’t get it to work.
I found out there is a feature called presence based lights. It does what I want it to do, sometimes that is. When I am at home my presence gets detected and 2 of my 6 lights in the hue group get switched on.
When I arrive at home however, all 6 lights get switched on with the right profile. No idea why there is a difference, group is the same, lights are the same, when I give the command manually all lights switch on perfectly.
The other thing I am missing is giving it an offset. Now it switches at sundown immediately and I would like to offset that by 25 minutes.
Thanks for your reply. I already tried to build a automation for it in a different post and I was not able to get it working. So instead of bothering more people with my stupidity I switched to the option I was able to figure out.
I really have a hard time finding out which option I can use in automations, where to get the entity id, where to get al the states a entity can have. I need to put more time in learning HA but i’m just too busy atm. I used to use openhab and switched to HA. The complex stuff that I did not get to work in openhab was one of the first things that just worked out of the box with home assistant. That why it annoys me so much that I am unable to get this simple thing not working.
I will try once more with the automation settings you provided and let you know how it went.
Well, I used the code from your example. Got a message mallformed error about the ". I removed those and the lights turn on with home and away. I added the sun elevation condition I will see if it works tonight. Thanks for your time and I will read into HA, absolutely love it but it takes a bit of time to get used to.
Hey Fanuch, I have my problem again. I updated the container to the newest version and now my automatic light automation does not trigger anymore. I changed nothing in the automation, my trigger is still triggering, entity names have not changed, only a new hoemassistant version.
when I choose ‘run actions’ the lights turn on but my trigger just does not work anymore. I tried using the person tied to the device tracker but that makes no difference.
alias: Arriveren - Woonkamerverlichting inschakelen bij thuiskomst DONKER
description: Schakelt de woonkamer verlichting in wanneer je in het donker thuis komt.
trigger:
- platform: state
entity_id: device_tracker.huawei_p30_pro_bf0c5938d7
from: not_home
to: home
condition:
- condition: template
value_template: '{{ state_attr(''sun.sun'', ''elevation'') < 5 }}'
action:
- service: light.turn_on
target:
area_id: living_room
entity_id: light.allewoonkamerverlichting
data:
brightness_pct: 70
profile: Palm Beach
mode: single
Thanks for the help again. I checked my nmap device and saw that there is a new nmap device with a different name. So the trigger was not working simply because the device used was wrong.