Hello. My OBD device does not send discovery topic, so instead of editing configuration.yaml and restarting server, I would like to use mosquitto_pub to create device. But is not working. My _pub command is:
Just remember one thing. After I restarted Home Assistant, entity definition is lost and I have to publish this event again. I created init-mqtt.sh script for that.
Sorry I thought it is clear. I use linux and I installed clients with sudo apt-get install mosquitto-clients
Then you use linux terminal basically on any machine where you installed mosquitto-clients from which you can access HA and use IP address of mosquitto broker that is running in your HA instance (you get IP somewhere in system info).
I do not know how it works in non-linux environments. It could also be possible from mqtt explorer, which is graphical app.
Oh thank you, HA core has a ssh/terminal add-on I guess i could use that … Maybe?
And mqtt explorer, I have that so ill look into that one too.
Thanks for the info.
Actually, I think you can publish events straight from Home Assistant. With new update, it moved somewhere I cannot find it, but there is sumple GUI for listening and publishing straight inside HA. If you find it, please post the path, thanks.
Just remember one thing. After I restarted Home Assistant, entity definition is lost and I have to publish this event again. I created init-mqtt.sh script for that.
Thanks @janbenes
Can you show me where you save that file so it runs the script every boot.
And is there a down side to using the retain flag. Is not another way of retaining the definition of the enities?
I run that script manually on my laptop after I reboot HA computer. I am not familiar, I think RETAIN serves to populat value after you restart HA and before sensor sends its first reading. Then retain shows last valid value pulled out from mqtt broker.