Owntracks Devices

Does anyone know how to remove a device from Owntracks? I setup it up on my tablet and got two entries for the tablet showing up on the map.
I deleted the app but there still showing up. Do I need to do something with Cloudmqtt to remove them?

Remove one entity from known_devices

I deleted the the known_devices file and commented out the tracking in the configuration file.
Then the map in HA has no devices. But if I open the Owntracks app on my Iphone I see two devices for my tablet and my Iphone.
I thinking its something with the Owntracks app or my Cloudmqtt setup.

OwnTracks messages are sent with the retain flag so your MQTT broker saves them until it receives a new message on the same topic. If you want to remove the device, you’ll have to tell your MQTT broker to forget the topic by sending a null message on that topic.

Thats what I was thinking. Sorry Im new to mqtt so how could I do that?

from what I’m reading we would use mosquitto_pub to send a message, but that doesn’t seem to be installed on my rpi and I’m guessing only comes if we install mosquitto, which I don’t really want to do. I’ll keep looking and post here if I find anything. If anyone else knows a way, maybe a web site that will let us do it for free, that would be nice.

I can send a Topic and message in the Cloudmqtt Websocket. Just not sure what the syntax would be.

I tried that, but I think those are going the wrong direction. You are sending them to HA from there, not back to owntracks. I’ve got something that sends messages back up to cloudMQTT but it doesn’t seem to be doing anything so I’m running up against the message format thing too.

Ok, I swear I have tried this at least 10 times today. But in the ios app, go to friends. You probably see the bad entry in there. You should be able to swipe it to the left and the delete button should show up on the right side of the line. You can delete it from there.

2 Likes

Oh wow. That worked. Now I will uncomment Owntracks in HA and see if there gone from there. Thanks

Thanks again. All good now :smile:

The Android app doesn’t seem to let you delete them that way, so for reference what you need is to figure out how to send a ‘null’ message. I do this with mosquitto_pub, which you can use without having mosquitto installed by installing the mosquitto-clients package (I believe, not sure if you need mosquitto installed or not).

You would have to figure out the right options to use for CloudMQTT (host and port at least), then issue a null message using the -n option, e.g.

mosquitto_pub -u username -P password -h hostname -p port -t 'owntracks/user/device' -n

If you’re running mosquitto locally, you can just leave off the host and port options.

2 Likes

that’s why I couldn’t find it. I kept trying to install mosquitto-pub not mosquitto-client. Thanks I ended up writing my own in python using the same library homeassistant uses.

Do you have any idea what the null message actually contains that is sent. I know it’s a zero byte string, but it is it a string within a dictionary with other information, or does it need {} empty brackets or empty quotes?

I’m not entirely sure what the entire request looks like. I would guess sending a message with just ‘\0’ may be your best bet, but it probably depends on how the system you’re using sends the message contents as to whether that would actually work.

mosquitto_pub -u username -P password -h hostname -p port -t 'owntracks/user/device' -n

I see the null message successfully being delivered, If I restart the server the old messages unfortunately come back