But all attempts fail with an “Unknown error”. I think there was a way to call services via a templated name, but I can’t see the equivalent for actions.
(Bonus Q: is this the best way to force a location update in the companion app?)
… otherwise you have to reconstruct the service ID using templates, which only works if the user didn’t change the reference entity’s ID. As the blueprint author (unless this is just for you) you have no control over that, so it’s not a great way to design the blueprint for public use.
PS. Don’t use notify.notfiy… it doesn’t work the way most people seem to think it does, so it just causes frustration.
I have set up virtual device trackers for vehicles that “copies” the location of the person driving it (via their person device trackers), while they occupy the vehicle[1]. As a part of that functionality, on becoming unoccupied, this virtual device tracker will wait for one more update (as we are assuming a location provided /after/ leaving the vehicle is more useful than the last one received).
To help this process, I want to request an accurate location from the HA companion app of the driver when they leave the vehicle, rather than waiting for the next non deterministic location update.
Location updates can take up to 15 minutes to report, so the person could be a few blocks away from the vehicle by the time the next update comes in. Not sure how accurate that other automation has been for you in the past week, but from personal experience, it won’t be too accurate.
If the vehicle has bluetooth, you could simply enable High Accuracy Mode when bluetooth is connected. This will solve the “GPS location updates are sometimes slow” in your other thread.
Then, have an automation which triggers when High Accuracy Mode goes from on to off & snapshot the location. That way you’ll have a deterministic location the second the vehicle is switched off.
Updates do increase when in the vehicle at the moment. But even then they might lag by up to 50m depending on how fast the car approaches the destination and other considerations.
In testing, sending the intent generates an instant location update. There’s only two drivers, so I’ve just “brute forced” the automation by asking both for a location when vehicle occupancy changes. Ideally there would be an action that directly asks the app for a single accurate location (I’m left wondering what the idea behind that sensor is otherwise).
If that doesn’t pan out then I guess “last location before leaving the vehicle” will have to do. I use BT for occupancy, so our solutions reduce to the same thing really.
Open your Background location sensor inside the companion app settings & scroll down. There’s a setting there called High accuracy mode update interval (seconds). Set it to 30 & you’ll get the correct location to within a couple of metres unless the driver jumps out of the car while driving.
Obviously, you need to have enabled High Accuracy Mode to trigger when connected to BT in that same page, but it’ll definitely work.
The issue is that when disconnecting BT the high frequency stops. I can imagine parking and leaving the car within 30 seconds of the last update, so it’s the /next/ location that’s more useful in my case.
Just to close this off, requesting a “single accurate location” on demand does the job explicitly. Since I wasn’t able to generalise it, I just “brute forced” it by calling for an accurate location on all phones. The template sensors take care of the ones I’m interesting in automatically.
It’s a little obtuse that the locations can only be requested using an Android intent though (unless I’ve missed a specific mobile app action to do this).