MQTT Device Tracker Updated Syntax Error

I decide to do so much needed clean up on my config to remove some of the nags/ errors in the logs with deprectated/ updated integrations and started with updating the mqtt device tracker as its throwing syntax errors in the log although it still works.

My origional config is this, and it works:

- platform: mqtt
  devices:
    person1_phone: "location/person1"
    person2_phone: "location/person2"
  qos: 1
  payload_home: "home"
  payload_not_home: "not_home"
  source_type: router

My updated config in the new format as per the docs here does not work:

- mqtt:
    device_tracker:
        qos: 1
        payload_home: "home"
        payload_not_home: "not_home"
        source_type: router
      - name: "person1_phone" 
        state_topic: "location/person1"
      - name: "person2_phone"
        state_toppic: "location/person2"

to be specific when I say it does not work, I can see the topics updating in MQTT but Home Assistant is not updating the associated states - its like its not seeing the topic?!?!

What am i missing?

From doc the config should be like below.

mqtt:
  device_tracker:
    - name: "My Tracker"
      state_topic: "a4567d663eaf/state"
      payload_home: "home"
      payload_not_home: "not_home"
    - name: "My Tracker"
      state_topic: "a4567d663eaf/state"
      payload_home: "home"
      payload_not_home: "not_home"

@sheminasalam I agree :slight_smile:

I did get it working in the end - the orginal posted above did not work but the below did?!?!?

Beyond me why it did not work and likley to do with yaml formatting problems is my guess but heres the updated yaml

device_tracker:
  - name: "person1"
    state_topic: "location/person1"
  - name: "person2" 
    state_topic: "location/person2"
    qos: 1
    payload_home: "home"
    payload_not_home: "not_home"
    source_type: router
1 Like