Automation trigger Template on not existing state attribute

i have the unifi integration and when wifi is connected on my phone i have the ap_mac in state attributes. I want to trigger automation on the ap_mac state attribute that is not in the list (eg when wifi is not connected).

Any suggestions ?