MQTT device Tracker approach

Hi everybody,
I’m trying to set up a custom device tracker, and so far I did it using a MQTT device tracker, that works. But I have a couple of issues I’d like to manage.

  1. when restarting HA (on docker) the MQTT device Tracker changes its state (prolly since the MQTT broker is still up on another container), there’s a way to fix this behaviour? I use mqtt.publish to set its state, once at the HA startup and then with an automation/platform:state of a binary_sensor (who doesn’t change its own status meanwhile).
  2. The MQTT device tracker doesn’t let me add attributes unless I use the MQTT Discovery way, the main question about this approach is, how much out of the HA system is this approach? My issue is that it’s something I need to do manually and do again if needed without a file config where I can save it once and for all, on contrast to your standard yaml configuration.

I just started using MQTT device tracker (replacing unifi_direct intergraion). For #1, I solved this by retaining the MQTT topic. When HA restarts, it picks up the correct state. If you have control how your source publishes, look for a retain option.

-Joel