Check location permission


Is there a way to check if a user has location permission enabled on the compagnon app on his (android) phone ?

I want to force the user to enable it if he wants to use the app…

Thank you !

I dont think there is.

There doesn’t appear to be an entity per se for background location.

However, if they have disabled location services, it would be pretty easy to tell, assuming you know where they live. For example, do they live with you ? Or at another known location ? Could you create a zone around that place and do they ever appear in that zone ? (You can check this via an automation, in the same way you might check if anyone is home to turn on heating for example).

I could check if there was an update the last 24 hours (assuming someone is at least once in a day connected):

{{ (now() - states.device_tracker.alex.last_updated).total_seconds() > 86400 }}

But of course people could give permission only when using the app instead of ‘allways’ (what it should be if I want the tracking…).

Yes… indeed. There is no way of telling if they are turning permissions on or off as far as i can tell.