Device state versus trigger (Automation)

I have a quite generic question I guess… I played around with automation, and it works quite nice. To mee it seems it relies on events, i.e. triggers. So for example, I have an automation that heats up my sons room when he is home. The trigger for that is his mobile, that enters or leaves home.
Now I was thinking, if there is a way to not have it event based, but on a state? So if the state of the device is home, and the target temperature of the heater is not on high already (i.e. the state before was the same), set it to high
Just trying to wrap my head around all this, hope it’s understandable what I mean :wink:

Not… really, no. I don’t at all understand what kind of differences you imagine there to be between a state setting of a trigger and a state doing… something else without a trigger?

I also have some issues following what you mean, but here’s my take to nudge this conversation forward :slight_smile:

You can e.g. use a time trigger, eg. every day at 3PM, or a time pattern trigger, e.g. check every 10 minutes for these two conditions.

Example:
Check every 10 minutes

if

my son’s mobile is home
the target temperature of the heater is not set to 72F (or 21C)

then, if both conditions are true (you don’t really need an AND)

set the target temperature to 73F

P.S.:
If you want to change the target temperature again when he’s not home any more you’d need a 2nd automation.

1 Like

I guess that’s what I meant… I did some programming in the past, and there always was a difference between “events” (buttonpress) and things that are done without events. No idea if that’s actaully better, but I thought there must be some way :wink:

I’ve seen people getting confused with triggers and how they work; I think of it that in some cases they are an event combined with a duration, i.e. a state change occurs and then the new state stays as is for a certain period of time, e.g.

The event is that your son comes home, but an action is only triggernd once he’s been home for 10min, so the trigger is: 'The mobile has been home for 10min.

And then you add your conditions to the automation, etc.

A State Trigger monitors an entity’s state and triggers when the state changes. You can have it trigger for any state-changes or specific ones only.

For example, when a person entity’s state changes from not_home to home.

alias: example 
triggers:
  - trigger: state
    entity_id: person.you 
    from: not_home 
    to: home
conditions:
  ... whatever conditions must be confirmed...
actions:
  ... actions to be performed...

All automations require some kind of trigger. Home Assistant is event-based so if you find yourself creating automations that rely on periodic polling (i.e. Time Pattern Trigger), odds are it’s not the optimal approach.