Turn off location sharing dashboard

So my Fiance and I are talking about sharing our locations with each other. She did ask if it was possible to turn it off if either of us wants to surprise the other. Figured it wouldn’t be difficult but she is not a tech person. So going to the companion app setting and turning off that sensor isn’t that intuitive. Was wondering if here was a way to link a button to it on the the dashboard so she can click a button and turn off her location sharing.

I am aware that this isn’t “secure” and either of us can just go click the button and turn it back on but we are not concerned about that. She is on IOS not sure if that changes anything.

There’s a service call to disable or enable an entity or device:

service: homeassistant.enable_entity
data: {}

On Android companion app you can choose to allow the server to disable or enable sensors. Perhaps iOS has similar functionality, or maybe the sensor or device tracker can be disabled with a similar service call. I just entered “enable” under ‘developer tools > services’ and there are a number of similar service calls under “Home Assistant Core” that might be able to accomplish what you want.

You can use a helper button to trigger an automation, and if/then/else logic to choose the enable or disable version of the service call depending on whether or not the entity is enabled or disabled (since I didn’t see a “toggle” call, however I didn’t search for one exhaustively.

Edit - there is:
service: homeassistant.toggle
But I don’t think it’s enable/disable, I believe it’s on/off so designed for switches, lights, buttons, etc. it doesn’t seem to be working for disabling or enabling the app sensors.

Thank you, while maybe not completely an answer it give me something to start with. I’ll play around with this some tomorrow and see where it takes me.

You’re welcome. I hope it works for you! I don’t have iOS to test anything. :man_shrugging:t3: