Unifi AP state

Hello,

I am not very familiar with home assistant. I have been searching for a automation with a state trigger.
What i want is if a unifi accesspoint is not connected to the netwerk anymore is that there has to start a automation.

alias: Unifi AP automation
  trigger:
  - entity_id: device_tracker.paul
    platform: state
    to: 'off'
 condition: []
  action:
  - data: {}
    entity_id: automation.spambot_AP
    service: automation.turn_on

But its not working. Its probely not very hard but i cant figure it out myself…
Can someone help me with this problem?

Stan

Go to the developer tools / states menu. Look at the state for your device tracker. Is it really ‘on’ or ‘off’ or is it ‘home’ or ‘not_home’?

Also do you want to turn on the automation (enable it) or trigger it (run it)?

@tom_l its home. I already tried state to Away. But when im restart the accespoint (to test it) it say that is home.

Try to: 'not_home'

1 Like

@tom_l image This is what i mean, it doesn’t even say it went offline. But i restarted the AP on Unifi.

Sometimes there is a slight delay when devices drop from the network before it’s reported. If I remember correctly the default polling interval with the unifi platform is 300 secs.
In my case I monitor if my network cameras are offline so I use the ping command every 60 seconds. If it doesn’t return a ping my automation is triggered.
Unifi AP’s will have a management IP address you can ping.

@PCRx Thanks for your asnver, Do you have any example for me? i am not very familiar with home assistant.

I don’t use HA for my automations (I use Nodered) but here is a good place to start and learn about using the ping platform within HA.

https://www.home-assistant.io/integrations/ping/

@PCRx okey, thanks

It might be a bug in the integration, mind enabling all debug logs for UniFi in hass and sharing those with me? Preferably on 0.109 since I’ve improved quite a few things, including logging

Dose the Ubiquiti UniFi AP integration actually monitor the AP itself, or just the device that are connected to the AP.?

@Coolie1101 Aah it says nothing about monitoring the device itself. I thought if you can see how many devices are on the AP then you can also see if the AP is on or off. But it seems like it cant unfortunately.

You can always use ping or nmap, unless you have a supported router, have a look here.