Sorry, but I think I’m being an idiot. I am trying to get MQTT up and running so I can send data from an ispindel into HA.
I have installed the mosquitto add-on, and I see the integration pop up. I have created an mqtt user/password. What do I do next to get the broker up and running to get HA to connect to it ? How do I point the integration to the broker? I have tried to connect to the broker using mqtt-explorer and the created user/password, but just get a ‘disconnected from server’ error.
I think I am missing something very basic here! All the guides jump straight into creating sensors etc, and seem to skim over the very basics. I think I need to configure the broker - but not sure how to!
Hi there. Mqtt setup of HA consist of mosquito add-on and the integration. You have already installed the addon. Now with configuration of addon, the mosquito addon will work with the default configurations. You really dont need to add any new username and password. In such condition, i,e with default configuration the addon will use the home assistant user username and password to connect to devices.
After making any chances to the configuration you should restart the addon and check its logs. If the addon has stopped or if there are any issues, there will messages in the logs. Check to see if there are any issues. If there are no issues you can connect any mqtt device to this broker either with the HA username and password or any provided username in addon configuration.
There is again the second part which is the integration that is there to connect mqtt devices to HA without using the configuration.yaml. This makes working with mqtt devices easy but for this to work addon should be working corect.
Thanks for your response.
I have reinstalled the add-on and integration with default values. I can listen to a test topic, and publish a message to that topic and have it show up in the integration test screen.
However, I cannot get mqtt-explorer to connect to the broker running on the HA server.
Am I doing anything obviously stupid here?? If I port scan 192.168.1.91, I cant see 1883 open…
Since you can publish and receive payloads, that means the mqtt addon is working correctly. I cant see a reason why the mqtt explorer is not working. Maybe you can find it the logs of mosquitto addon. May I ask, for what purpose are you using mqtt explorer? Maybe we can solve your requirement without mqtt explorer.
MQTT-explorer was purely to see if I could connect to the broker from an external client. I also makes it easier to look at the broker logs as I can just subscribe to the sys topic.
The device that I am using to connect to mqtt fails to connect to the server. Is there a better way to test the connection, from outside HA ?
You can try some mobile app like this.
Mqtt-explorer should also work without any issues. If it is having issues, that means these apps could also have. If they do please let us know.
I got it working!! I was being an idiot and using the wrong IP address! It connects now, and my mqtt client submits the following. However, I cant see anything auto-discover in HA!
Broker logs:
[INFO] found mqtt on Home Assistant
1611947966: New client connected from 192.168.1.251 as Batt_test (p2, c1, k15, u’mqtt’).
1611947966: Client Batt_test disconnected.
1611947969: New connection from 192.168.1.251 on port 1883.
1611947969: New client connected from 192.168.1.251 as Batt_test (p2, c1, k15, u’mqtt’).
1611947969: Client Batt_test disconnected.
1611948082: New connection from 192.168.1.251 on port 1883.
1611948082: New client connected from 192.168.1.251 as Batt_test (p2, c1, k15, u’mqtt’).
1611948082: Client Batt_test disconnected.
Client Logs:
calling MQTT
Attempting MQTT connection
Connected to MQTT
MQTT publish: ispindel/Batt_test/tilt/78.19229
MQTT publish: ispindel/Batt_test/temperature/25.0625
MQTT publish: ispindel/Batt_test/temp_units/C
MQTT publish: ispindel/Batt_test/battery/4.734098
MQTT publish: ispindel/Batt_test/gravity/27.60376
MQTT publish: ispindel/Batt_test/interval/120
MQTT publish: ispindel/Batt_test/RSSI/-44
Closing MQTT connection
Should I not be seeing a device created in HA called ispindel, with these entities ? Or does it not work like that ?! I can subscribe to each topic in the integration test screen, and the updates appear. But where are these captured and stored in HA? How do I tell HA to subscribe to these topics?
Ispindel may not be supported for auto discovery. But since you are getting the payloads as mqtt, you can create mqtt sensors with HA. For this go to configurations and add something like this for all the mqtt topics you want from ispindle.
sensor:
- platform: mqtt
name: "Ispindle Tilt"
state_topic: "ispindel/Batt_test/tilt"
unit_of_measurement: '°'
force_update: true
You’re a star! Got it working and logging the different elements I need using multiple sensor entries.
The gui complains that the ID isn’t unique so can’t be configured there. Is there a way to fix this so I can do things like change the time span on lovelace charts?
Can you share a screenshot of this?