Still an issue for me … just upgraded to 105.5.
Sounds like it’s related to the integration then. I use unifi and iOS app and they both resume states. What are you using?
This is for a virtual presence device_tracker created using device_tracker.see. I use it for guest presence when my z-wave door lock is unlocked by certain codes assigned to guests. My automation then marks the guest as home, but this resets to away if I happen to restart HA sometime during the day. I have to remember to mark them home if they are still home.
Why not avoid device_tracker and make an input boolean? That will store states on restart. Then build a binary_sensor with device_class: presence set on it.
I’ll give that a shot.
But can you ad that to a person
entities?
It wouldn’t do anything because it doesn’t contain gps information.
I have two sensors that give me latitude and longitude:
sensor.triaca_latitude
sensor.triaca_longitude
how can I compose that into a device tracker
You can’t. You can make a template sensor with a latitude and longitude attribute that pulls from those sensors. Then attach that sensor to a person.
Or have a pythons script create the device tracker.
I use device_tracker.see to create a device tracker from 2 entities
How should I compose it?
@petro
Ho can I make that template sensor so it is in the proper composition?
sensor:
- platform: template
sensors:
triaca_location:
friendly_name: Triaca
icon_template: mdi:map
value_template: '{{ (sensor.triaca_latitude);(sensor.triaca_longitude) }}
This is the automation I have, once run, you will see a discovered device in known_devices.yaml
and you can use it as any other device_tracker
- alias: Car Tracker
trigger:
- platform: state
entity_id: sensor.car_latitude, sensor.car_longitude
action:
- service: device_tracker.see
data_template:
dev_id: car
host_name: Car
gps:
- "{{ states('sensor.car_latitude') }}"
- "{{ states('sensor.car_longitude') }}"
Has this service changed in the last two years? I can’t get a new sensor created with this automation:
alias: Device Tracker Update Person1
description: ""
trigger:
- platform: state
entity_id:
- sensor.location_person1
condition: []
action:
- service: device_tracker.see
data:
dev_id: person1
gps: "service: device_tracker.see
data:
dev_id: person1
gps: "{{ states.sensor.location_person1.state }}"
mode: single
No, mine still works. what is the state of
“{{ state_attr(‘sensor.person1_iphone_geocoded_location’,‘Location’) }}”
Ooops… that was an attempt to try something else because the first attempt didn’t work. Edited above. The state of that sensor is the GPS coordinates from my mobile device. I’ve had a real uphill battle over the last few days. My mobile device_trackers have ceased to work, and I’m trying to implement a work-around.
Just trying to call the device_tracker.see
service doesn’t work for me:
“Failed to call service device_tracker.see. Unknown error.” My patience with this packed up and left days ago. All of my mobile device_trackers failed simultaneously, and I’ve been trying to figure out a way to get my automations back up & running since.
EDIT: Just tried for “fun” using sample data:
service: device_tracker.see
data:
dev_id: THIS_BS
gps: [51.509802, -0.086692]
Have a look at mine above it’s a bit different to that
Yes, it is. I’m using a single entity for both latitude and longitude, which should work.
I’ve also split latitude and longitude into separate entities and done it similar to yours. This:
service: device_tracker.see
data:
mac: FF:FF:FF:FF:FF:FF
dev_id: person1
host_name: Person1
location_name: home
gps:
- "{{ states('sensor.location_person1') }}"
- "{{ states('sensor.longitude_person1') }}"
…doesn’t work either, even now that I have device_tracker.person1
created.
Have you tried with data_template
Ohh, I see. Yes, I’ve tried this:
- alias: Device Tracker Update Person1
trigger:
- platform: state
entity_id: sensor.location_person1
action:
- service: device_tracker.see
data_template:
dev_id: person1
host_name: Person1
gps:
- "{{ states.sensor.location_person1.state }}"
mode: single
…but it doesn’t do anything.
This updates the device_tracker entity:
service: device_tracker.see
data:
mac: FF:FF:FF:FF:FF:FF
dev_id: person1
host_name: Person1
location_name: home
gps:
- 30
- -20
This does not:
service: device_tracker.see
data:
mac: FF:FF:FF:FF:FF:FF
dev_id: person1
host_name: Person1
location_name: home
gps:
- "{{ states.sensor.location_person1.state }}"
EDIT: I’ve abandoned this pursuit because I got my native mobile device_tracker entities working. I may come back to this in the future, though.