Hello… I have two HA instances and want to transfer the state (‘home’ or ‘not_home’) of a device_tracker from one HA to the other one using MQTT (mqtt externally hosted)… On the first HA tracking the device, I added the following lines in configuration.yaml:
The data (state and attributes) are correctly appearing in the MQTT Broker like this (I just list here the state): homeassistant/device_tracker/gsm1/state not_home
The goal is to display via lovelace on the first HA instance the state of a device_tracker located on the second HA instance (those two instances of HA are not in the same location: one is in Belgium and the other in France).
My question: how can I get from MQTT the state of that device in a device_tracker format on the other HA instance ? Maybe I am using an incorrect method to do that so any help would be really appreciated… Thanks !
Hello, as the two HA instances are not in the same location, the states of the same device are sometimes different. I want to see on one “centralized” HA the states of the device on both locations. For a GPS device tracker, I found in the meantime that I can use the “zone” functionnality… so I implemented this for the GPS device_tracker… but I am also planning to transfer the state of a Wifi Device_tracker and for this I do not see any solution yet… I also updated the initial post to keep the formatting… Thank you for the idea’s…
It sounds like you don’t want a single tracker, you’re wanting two. One for the primary instance, one for the secondary.
You’ll want to use the mqtt publish service to publish the states of the entity on the second instance to the MQTT broker. Use a new topic so that you can track it separately.
Thought I would add my query in here rather than starting a new thread… loads of parallels in my question.
I have a tracking entity that I use in a number of configs, but I cannot see that entity in MQTT.
The entity… device_tracker.mark_s_s22 is tracking when I am home or away.
I’d like to have the entity status in MQTT so some of my NodeRed flows are reactive to my status.
The only way I believe I could get the status into MQTT is to create an automation like the one below…
alias: S22 Status to MQTT
description: ""
trigger:
- platform: state
entity_id:
- device_tracker.mark_s_s22
from: not_home
to: home
condition: []
action:
- service: mqtt.publish
data:
topic: homeassistant/binary_sensor/s22-status/status
payload: home
qos: "0"
mode: single
I’ve also read about using the service: mqtt.publish but wasn’t sure of the config? I’ve read the documentation for MQTT publish, but not sure of what data I need to specify to take the device_tracker.mark_s_s22 status and publish it?
Are these the only two ways? Or are there easier options?