I’m at a total loss here. I just can’t seem to get mqtt messages into entities.
I have MQTT running natively on the same pi I use for HA (which is running in docker).
I have a python script publishing simple strings (i’m using the subprocess library to build a simple system monitor) to an MQTT topic. Testing on the pi (using mosquitto_sub) shows the messages coming through. Testing within HA via the MQTT “Listen to a topic” function shows them coming through.
Here’s an excerpt from my config file. I’m 99.9% certain there’s no issues here:
I’m verified over and over that the state_topic matches my script and perfectly matches the subscribed topic in my tests. Everything seems fine. But, no entities are getting created in HA. Nothing funky is showing in the logs. I’ve restarted multiple times.
Regardless of whether or not the topic or payload is correct, you should still be seeing the sensor show up in developer tools > states - even if the state is just unknown.
You are absolutely sure, you aren’t seeing it in developer tools?
It won’t show up in the handy popup menu you get by typing “e” on the keyboard anywhere in the web interface, you will need to refresh the page for it to show up there.
I seem to have got it working. I ended up just re-writing the config file portion for mqtt and it’s working. There must’ve been an issue with an extra space or something copied/pasted.
Definitely a lot of cleanup to do, but it’s working:
Just in case anyone else comes across this issue, my problem was I had two ‘sensor:’ elements in my configuration.yaml file. All sensors needed go under a single ‘sensor:’ element. The file editor complained about this (there was no checkmark in the upper right corner of the file editor window) but I just ignored it for some reason.
After I fixed this and restarted the sensor showed up as ‘sensor:test0003’ in the Developer Tools → States list.
Here is the sensor section content of my configuration.yaml file
Such a basic thing, I cannot believe it is not shown as a configuration error or something like it, thanks! I was having the same problem and was unable to see my error