Presence based automation not triggering

Hi all, I am working on a heating automation but it isn’t triggered, if somebody stays home after 08:00 o’clock, what am I doing wrong?

  alias: Heizen wenn werktags jmd Zuhause
  description: ''
  trigger:
  - entity_id: group.persons
    platform: state
    to: home
  condition:
  - after: 08:00
    before: '15:55'
    condition: time
  - condition: state
    entity_id: input_boolean.heiz_modus
    state: 'on'
  - condition: state
    entity_id: binary_sensor.workday_sensor
    state: 'on'
  action:
  - data:
      entity_id: climate.meq0526665, climate.heizung_int0000001
      preset_mode: comfort
    service: climate.set_preset_mode

The automation is triggered only when group.persons changes state to home. So the house would have to be unoccupied and then someone arrives home for this automation to trigger (and then the conditions are evaluated). If the house is already occupied before 08:00 then this automation won’t trigger.

There are several ways to fix this and here’s one: add a Time Trigger to run at 08:01 and a State Condition checking if group.persons is home.

Now when the house is occupied in the morning, the automation will trigger at 08:01 and then execute the action if all the conditions are true:

  • group.persons is home
  • current time is after 08:00
  • heiz_modus is on
  • it’s a workday
1 Like

Thank you! OK, that’s what I thought already. So if someone stays home at maybe 10 o’clock this fix is not working, as the trigger is at 08:01, right?

Will it work if I am triggering with home for xx minutes, or?

It all depends on what happens before 10:00.

  • If they were home at 08:01 it will work (automation triggers 08:01 and checks the conditions).
  • If everyone left the house earlier and this person arrived at 10:00, it will work (group.persons changes from not_home to home)

BTW what are the other ones?

I’d probably have to learn more about what kind of behavior you want in order to suggest alternatives. For example, one thing I noticed in your automation is that it doesn’t contain a trigger for input_boolean.heiz_modus. So let’s say everyone is at home in the morning and that input_boolean is off and then you turn it on. The automation won’t trigger. Maybe this is the way you want it to behave (or maybe not).

Thanks for helping out :pray:

Let me explain: The boolean is switched on during heating season In the cold days, so triggering automation here over is not an option. It activates general heating. The plan was to trigger the automation if someone stays home after 08:00 to 15:55 on a workday and heating boolean is on. At 16:00 o’clock the normal heating plan starts.

What about the possibility to trigger if someone is home after 08:00 to 15:55 for maybe 20-30 minutes, will this work?

I admit that I don’t fully understand what you’re telling me. Based on my two questions below, you’ll see just how confused I am. :slight_smile:

  • You want the automation to trigger when they are home but only if they are home for at least 20-30 minutes between 08:00 to 15:55?

  • Or are you asking will the existing automation, as described above with the extra trigger I suggested, detect someone who arrives home between 08:00 and 15:55 for as little as 20-30 minutes?

:see_no_evil:

I thought this would may be an workaround to trigger the automation.