Device tracker from script?

Strange. If you go to the services dev tool, is device_tracker.see still listed in the dropdown there? (If you don’t mind upgrading again to check that)

Also, are you using any other device_tracker components, other than ones directly updated via the service call?

I have two device_tracker components, both updated with device_tracker.see and no other device_tracker component. In version 0.93.2 device_tracker.see is always available and starting version 0.94.X you have to use a device_tracker component to use device_tracker.see.

I setup a device_tracker on my router without using the results…

FYI, after upgrading from 0.94 to 0.96, I started running into issues with my device_trackers not retaining state on restart once again.

Rather than try to figure out another workaround, this time I opted to switch to the MQTT Device Tracker. I had just spun up MQTT for some other purposes, so since I was already using it, I figured it would be pretty painless to switch to it for my presence detection, and it was. And if you send your messages with the retain flag, it will persist through restart without issue.

I’m going to put together a longer blog post on what specifically I’m doing for presence detection now, but it’s a pretty clean swap if you’re already using device_tracker.see and are interested in switching from to the MQTT Device Tracker (or JSON MQTT Device Tracker if you’re wanting to send latitude/longitude/device battery data).

2 Likes

Same here. After restart all my device trackers are in state “away”. Really annoying.

Has this issue been resolved ?

nope, still here.

Still an issue for me.

No longer an issue for me, on 105.4.

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) }}