Also the documentation at Device Tracker - Home Assistant says that known_devices.yaml is being phased out. I tried looking in the documentation but didn’t find anything clearly stating what I should do. What is the proper way to implement a device tracker now? Should it just be a normal component that adds each entity as a binary_sensor entity with connectivity device class?
Not really, as that is about managing already added entities/devices from a device tracker. I’m asking about how to write code to implement a device tracker.
I can’t tell you how to but I can say it is important to use not_home and home as integrations that use location will look for those states. I use a stand alone program and use an automation to turn a numeric sensor into a device tracker using the service device_tracker.see
- alias: Andrew Occupancy On
trigger:
- platform: numeric_state
entity_id: sensor.andrew_occupancy_confidence
above: 10
action:
- service: device_tracker.see
data:
dev_id: andrew
location_name: home
source_type: bluetooth
- alias: Andrew Occupancy Off
trigger:
- platform: numeric_state
entity_id: sensor.andrew_occupancy_confidence
below: 10
action:
- service: device_tracker.see
data:
dev_id: andrew
location_name: not_home
source_type: bluetooth
As far as I can tell the device tracker platform itself is not deprecated, the deprecated part is all the stuff in the legacy file such as DeviceScanner, service.see, etc.
Typically in older device tracker implementations I have seen that they use the DeviceScanner to handle getting data without a coordinator. So my understanding is that DeviceScanner is deprecated because of the new coordinator pattern. And as a result you also need to manage the adding the device_tracker entities yourself instead of having DeviceScanner handle that for you.