Hello,
when I reload this entity
the automation gets triggerend where all users are from home.
is there a way to avoid this?
Hello,
when I reload this entity
the automation gets triggerend where all users are from home.
is there a way to avoid this?
we will have to see your automation to be able to help you.
Make sure it is properly formatted.
True,
I think only the trigger should be enough
- id: Turn off the lights when I leave home
alias: Turn off the devices when no one is at home
description: Turn off the devices when no one is at home
trigger:
- platform: state
entity_id: group.users
from: home
condition: []
action:
- service: switch.turn_off
The complete automation is really big,
but apparently it thinks everyone is leaving home
Add this to the state check:
not_to:
- unavailable
- unknown
thnx,
only it can happen that the status is in the following sequence
-home
-unavailable
-away
at that point the automation won’t be triggered.
but maybe this is only theoretical.
edit:
also
this doesn’t work
- id: Turn off the lights when I leave home
alias: Turn off the devices when no one is at home
description: Turn off the devices when no one is at home
trigger:
- platform: state
entity_id: group.users
from: home
not_to:
- unavailable
- unknown
condition: []
action:
still, the activation gets triggered.
It can happen, but the alternatives are worse. You could use to: away, but that could also come from away, unknown, away. There’s no telling what happened during unknown. Also, to could be a zone, so from: home is best.
You could add another trigger from unknown, not_to home if it is ok to trigger the automation multiple times when away.
Can you put timing such as from home to something for 30 seconds?
Specify the exact state-change you want: home
→ not_home
- id: Turn off the lights when I leave home
alias: Turn off the devices when no one is at home
description: Turn off the devices when no one is at home
trigger:
- platform: state
entity_id: group.users
from: home
to: not_home
condition: []
action:
- service: switch.turn_off
Reference: Old-style Groups
this both seems to work, at least the trigger won’t be fired while refreshing groups.
I still have to wait until everybody leaves before I can successfully say the trigger is fired at all.
I thought about this, but isn’t preferable, atm not an issue but I plan to add some door and window sensors, and if you forget to close one 30 seconds before the notification is a long time.
thank you all for helping me out.
edit:
i think I will try this
- id: Turn off the lights when I leave home
alias: Turn off the devices when no one is at home
description: Turn off the devices when no one is at home
trigger:
- platform: state
entity_id: group.users
to: not_home
# from: home
# not_to:
# - unavailable
# - unknown
# - home
condition: []
action:
- service: switch.turn_off
this fixes the
-home
-unailable
-not home
challenge
By the way, even 5 seconds timer should work given that reloading that short time
The only thing I do not know is: if you define multiple zones, a person’s state could be something else than not_home - I’m not sure if that can also happen to a group. E.g. if you all went to the shop, the state change might go from home to shop and skip not_home. That is why I personally prefer the from: home approach. But the chance, if even possible for a group, would be small.
good point,
I will find out
the status btw is “away” where the “not_” part actually acts like an inverter I assume
No, Away is a translation you see in the UI. For me, home in the UI is shown as “Thuis”, not_home is “Afwezig” for me. The actual value is shown in developer tools, and they are just strings, like home, not_home, unavailable, …