Unifi tracker - devices always away

Hi I’m trying to get Unifi tracker working.

At first there was no ‘known_devices.yaml’ however I got that to appear by running the device_tracker.see service with data:

{
"mac": "04:d6:aa:8f:fe:c4"
}

So then I get the following in my known devices yaml:

04d6aa8ffec4:
  hide_if_away: false
  icon:
  mac: 04:D6:AA:8F:FE:C4
  name: 04d6aa8ffec4
  picture:
  track: true
  vendor: SAMSUNG ELECTRO-MECHANICS(THAILAND)

The device shows as online for the duration of the checking period, and then permanently switches to ‘away’

This is my configuration:

- platform: unifi
  username: homeassistant
  password: !secret unifi_password
  host: blob.life
  port: 8443
  site_id: default
  verify_ssl: false
  consider_home: 60
  interval_seconds: 12
  detection_time: 180
  new_device_defaults:
    track_new_devices: True
    hide_if_away: False

I can see on the unifi controller successful logins, the account has super admin rights.

In the logs I’m seeing the following:
(when I fire the device_tracker.see service)

2018-01-05 21:36:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=device_tracker.04d6aa8ffec4, old_state=<state device_tracker.04d6aa8ffec4=not_home; source_type=gps, friendly_name=04d6aa8ffec4 @ 2018-01-05T21:20:18.037044+13:00>, new_state=<state device_tracker.04d6aa8ffec4=home; source_type=gps, friendly_name=04d6aa8ffec4 @ 2018-01-05T21:36:45.554756+13:00>>

and then about a minute later:

2018-01-05 21:37:50 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=device_tracker.04d6aa8ffec4, old_state=<state device_tracker.04d6aa8ffec4=home; source_type=gps, friendly_name=04d6aa8ffec4 @ 2018-01-05T21:36:45.554756+13:00>, new_state=<state device_tracker.04d6aa8ffec4=not_home; source_type=gps, friendly_name=04d6aa8ffec4 @ 2018-01-05T21:37:50.101479+13:00>>

Pulling my hair out, no doubt it’s something simple that I’ve missed?

Replying to myself…

I made zero changes to the above config, but started integrating some cameras.

Rebooted the machine and suddenly EVERYTHING appeared in the UI. Machine is the latest Arch Linux running in a hyper-v VM in case that’s relevant.

So, I guess that’s progress? Next problem is that all devices appear ‘Away’, or, I guess it’s the same problem except we have now had one successful discovery?

Replying to myself again - hopefully this helps someone else:

I found the solution for me was that my server running the unifi controller was 8 minutes adrift (behind) of actual time. Even thought it was set to update from time.windows.com as a default, the hyper-v integration services were overriding it and setting it to the host machine time. The HA server time was set correctly as I had installed and configured the ntpd service.

Disabled the time sync integration service, restarted HA and boom! Working perfectly.

I’ll fix the host time at some point, but it’s core and I really can’t be bothered finding the commands right now :slight_smile: More interesting stuff to play with.