just to let you know, I’ve tried and added the battery: to the json, so it updates that as well:
payload: >-
{
"latitude": "{{ trigger.to_state.attributes.latitude }}",
"longitude": "{{ trigger.to_state.attributes.longitude }}",
"battery": "{{ trigger.to_state.attributes.battery}}",
"gps_accuracy": {{ trigger.to_state.attributes.gps_accuracy | int }}
}
Hope this will work? Both my gps based devices have an attribute battery, and Ive added battery: 0 to the router based sensor:
payload: >-
{
"latitude": "{{ states.zone.home.attributes.latitude }}",
"longitude": "{{ states.zone.home.attributes.longitude }}",
"battery": 0,
"gps_accuracy": 0
}
but somehow it won’t work…
I wonder, your automations seem somehow counterintuitive. In my settings home/not_home is used for the router /bluetooth detection, and the zones for the gps locations. You use these exactly the other way round. Shouldn’t the zones be used for the gps locations? Or is it only focusing on zone.home, while the gps automation’s to_state
looks at all the other zones
Would seriously appreciate it if you’d had a look for me @NotoriousBDG, to what I am doing wrong here.
----edit—
found it! needs to be "battery_level"
.
not sure about the |int though. since "battery_level" : 0
is used for the router/bluetooth automation, I take it I’d need:
payload: >-
{
"latitude": "{{ trigger.to_state.attributes.latitude }}",
"longitude": "{{ trigger.to_state.attributes.longitude }}",
"battery_level": "{{ trigger.to_state.attributes.battery | int}}" ,
"gps_accuracy": {{ trigger.to_state.attributes.gps_accuracy | int }}
}
btw. why dont you use the double quotes on the gps_accuracy?