Hi Paul. I’m relatively well experienced with MQTT and have been using it for 15 years (coding in C, mainly using Node-RED, etc.) so my understanding of MQTT is low-level (for the avoidance of confusion, I don’t mean low understanding, I mean I understand the nuts-and-bolts of how it works very well), which is why I struggle with HA and other applications that wrap things up with very little clear explanation as to how it relates to the low level. I didn’t provide detail about how my MQTT broker was installed as my questions were targeted at the presentation layer of the OSI model. However for the avoidance of further confusion, I’m running MQTT broker on a different server, and the Home Assistant MQTT service is configured to point to that server. Not sure how it makes a difference. However I concede it would probably have been sensible to mention my version of Home Assistant: I’m running Hass.io on a Debian virtual machine; Home Assistant 2023.4.2, Supervisor 2023.08.1.
Let me go back to my questions and distill:
- Messages are being published from Home Assistant to my MQTT broker. It doesn’t matter to what topic they are being published. My question: within Home Assistant, exactly what is doing the publishing? Home Assistant core, or the Home Assistant integration in question?
I believe you have provided an answer to this question, but it’s still not clear to me. You said
and
Okay so I have 108 devices in Home Assistant, but they do not automatically / by default publish their data to MQTT. If I look at the MQTT integration, its panel says “11 devices”. Were these devices created by the MQTT integration itself, or by third party integrations which make them available to the MQTT entity? This is the area that I’m least clear on. I appreciate this is a new question, not in my original post, but I’m now responding to your response.
I appreciate you cannot know details about the integrations I have installed. Yes I have checked the integration’s configuration. There is no option to specify whether it publishes sensor data to MQTT. Even if I reinstall the integration from scratch, there was no option to specify “publish sensor data to MQTT”. However it magically appears on a sub-topic of ha/#
*(Please note, you thought I was getting confused when I wrote ha/#
. Please note that hash (“#”) is a wildcard to include any subtopic, I used this notation in my post. Also please note there’s no such thing as “the root path of your broker”, brokers don’t have root paths. It’s possible that a device or application might have a default path prefix (usually we refer to default portions of a topic as prefix or suffix in MQTT land), but there is no such concept as a root path). Anyway, even though you cannot know the details of an integration I have installed, can you comment on how it knows to publish to the same topic prefix as other integrations? Is this some standard that software authors follow, or is this ha
topic prefix a setting in Home Assistant somewhere? I certainly can’t find it.
- Is there a way except using automations (you told me it’s possible to use an automation to call the MQTT publish service, yes I know that - I even said I know that in my initial post ) to enable a given entity or device to automatically publish to MQTT? Based on your previous post I am assuming the answer is “no”. But it still doesn’t explain why I’m seeing various different messages from Home Assistant being published to sub-topics of
ha/#
.
Let me provide more examples. I’m seeing messages on the following topics:
ha/device_tracker/#
I installed the Home Assistant app on my phone, and enabled the option to track my device.
ha/climate/#
I have a Nest and a spa integration, both of which publish climate sensor information to this topic. Again, I can’t find where this is happening in Home Assistant.
ha/sensor/#
I’m getting power monitoring sensor data (as mentioned before, from Emporia integration)
It’s a good point, but I would know if that’s the case because (a) the integration pulls its data by Python from a public web service, so it’s definitely not over MQTT, (b) messages are coming into the ha
topic prefix.
Sorry for my overly wordy reply, and I totally accept that there’s a large hole in my understanding of how Home Assistant works, which is why I’m asking these questions. So perhaps if I have framed any of my questions relating to Home Assistant incorrectly then please do point that out. I am coming from using Node Red (standalone Node Red - not within HA), where conceptually there is absolutely nothing that automatically publishes anything to MQTT unless you tell it to do so. Also NR does not have any internal knowledge of devices or entities, unless you program it to do so.
Hope that all makes sense. Clearly I speak a different language to many people who use Home Assistant, so I really appreciate if any respondees can be overly descriptive of Home Assistant functionality, but assume I am technologically minded in most other aspects!