How to debug automation/trigger?

I have a couple of automations, all working off Ubiquiti presence.
I know the presence is working because I can see the entries in the logbook.
eg; bob away, bob home
However the automations are not being triggered or at least they don’t appear to be.
Not all of them appear in the logbook, so don’t.
Is this because they are executing but not being logged?
Or are they not executing? They do not show as triggered.
It seems to be on entities where I have changed the default name?

Any clues on how to debug?

Um… you want us to dust off the crystal ball? or can you post the automations?

1 Like

For example, here is one.
All of these worked before 0.97
Now (already on 0.97.2) some of them work and some of them don’t.
It might be that the ones that don’t work have an entity_id that has been edited?
Can’t see anyway to log or debug

- id: '1546875248854'
  alias: Bob Home
  trigger:
  - entity_id: device_tracker.bob_iphone
    from: away
    platform: state
    to: home
  condition: []
  action:
  - data:
      event: came_home
    service: ifttt.trigger
  - data: {}
    service: shell_command.bob_home

It could be that - are you using the old ios app? I think it’s supposed to be mobile_app now… but yes check the entity ID’s for changes.

When you say BEFORE 0.97… how much before? There has been some recent changes.

I don’t get why this has anything to do with ios? The presence detection comes from UniFi wifi notifications - nothing to do with any apps on devices?

I was running 0.94 when it all worked.

All of the entity data checks out in the YAML files as far as I can see, and some of the devices still work.

Is there no concept of turning on debug logging or similar? Anything to generate some logs to look at?

I finally sorted it out!! Yeah.
In case it helps others, here are the clues:
First turn on all logging in configuration.yaml

logger:
  default: notset

Then watch the homeassistant.log. Very verbose but that’s what I needed.
The problem was the automation (see above example) was expecting a state of “away” but the UniFi integration doesn’t use away, it uses ‘not_home’ and this was the issue.
I actually deleted “away” in all automations and left it blank!
eg:

- id: '1546875248854'
  alias: Bob Home
  trigger:
  - entity_id: device_tracker.bob_iphone
    platform: state
    to: home

- id: '1546866523509'
  alias: Bob Away
  trigger:
  - entity_id: device_tracker.bob_iphone
    from: home
    platform: state

So you either go TO or FROM home and I don’t care what your other state is or was.

2 Likes

I would be surprised if that was the cause since I thought all device_trackers have always used home & not_home as the state. I don’t see why the unifi component should have been different.

But i’ve been surprised before…

@finity You might be correct, however when I removed “away” from my automations everything worked again. It was in the automations.yaml and when I removed it, all was good.
Whether it was the “cause” or not I am not sure, but the solution was to remove it!

1 Like