Logging automations, configuration missing something?

Hi Everyone,

So I use some automation’s borrowed from Phil Hawthorne, specifically for presence detection as seen here:

So I have the states Home, Just Left, Just Arrived, Away and Extended Away. This part works fine. We use Owntracks, BLE Tile and Nmap to detect when someone is here and isn’t here (all grouped together with the assumption that if one is true, then Home we are–even if others are marked away.)

Anyways, I have an automation that when someone’s status is changed to “Just Arrived”, our entry lights are turned on (formatting is fine even if it doesn’t show here, no errors log-wise):

- alias: Just Arrived-Entry Lights (After Sunset)
  trigger:
    - platform: state
      entity_id: sensor.chris_status
        to: 'Just Arrived'
    - platform: state
      entity_id: sensor.val_status
        to: 'Just Arrived'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
  action:
    - service: light.turn_on
      entity_id: light.mudroom_door, light.kitchen_table

So today my wife came home and I noticed this in Logbook:

image

So I’m trying to figure out why:

a) Why did this rule fire to begin with, the sun was above horizon
b) Why did only the kitchen light turn on and not the mudroom light?

From what I read, there’s a specific icon for when automation’s fire, as documented here:

But I don’t see a ribbon icon (like the kind my kid wins at school) as shown in the picture to tell if/when the automation fired.

Can anyone help here? If I’m missing some part of the config you need to see, please let me know.

Since that documentation was created, the icon for automation has changed. It is now 3 horizontal bars with a right pointing triangle. From your log, you show that an automation with the title “Mark person as just arrived” was triggered. I would guess THAT automation can account for the discrepancies.

Thanks, I thought so (as it’s an alias) and further back in the log, I can see the above automation firing but this time it didn’t, the only one that seems to fire is this one:

- alias: Mark person as just arrived
  trigger:
    - platform: state
      entity_id: group.chris
      from: 'not_home'
      to: 'home'
    - platform: state
      entity_id: group.val
      from: 'not_home'
      to: 'home'
  action:
    - service: input_select.select_option
      data_template:
        entity_id: >
          {% if trigger.entity_id == 'group.chris' %}
            input_select.chris_status_dropdown
          {% else %}
            input_select.val_status_dropdown
          {% endif %}
        option: >
          {% if trigger.entity_id == 'group.chris' %}
            {% if states.input_select.chris_status_dropdown.state == 'Just Left' %}
              Home
            {% else %}
              Just Arrived
            {% endif %}
          {% else %}
            {% if states.input_select.val_status_dropdown.state == 'Just Left' %}
              Home
            {% else %}
              Just Arrived
            {% endif %}
          {% endif %}

Whereas previously in the log this morning, I can see the original automation I posted fire. I’m going to have to enable debug to figure out why it’s doing this. In the case of this post, no lights were on and my wife was definitely away (owntracks,nmap,tile) and then came home but only the kitchen light turned on and it was before sunset (above_horizon) which means this automation shouldn’t have fired :frowning:

Are you certain that HA turned the lights on? Depending on the lights, it’s possible that HA will show state changes initiated manually or by other systems.

I have a Phillips Hue bridge controlling a bunch of lights – I checked my wife’s phone and she has no specific rules set up in the app but location awareness was enabled (but no home/away rules) – Since I can see the automation firing earlier log-wise I’m fairly certain it gets logged and chalking this up to her iPhone :stuck_out_tongue: being an iPhone. Will continue to monitor this as I’m pretty sure I got things right here although most of my automations depends entirely on presence and it’s not 100% (may look into Bayesian for this…)

Going to consider this closed, thanks for the input @treno