All of a sudden, I got error with mqtt on Hassbian. The configuration check is valid.
I don’t have this error on raspbian.
Did you set up a broker on it?
What is your mqtt:
config?
I didn’t do anything. Just reboot rp3. Then it tooks longer to start home-assistant. Then show mqtt error.
My mqtt broker and client both are latest version, and. hassbian version 0.9.0 and ha version 0.69.1
The error shown aboved used to work normally.
The check configuration also valid.
Same setting and config works normally on raspbian run on rp3
Same setting and config suddenly show error mqtt on hassbian run on rp3 and rp3 b+
Is your broker running?
I didn’t test whether it is running or not. Will check again tonight and further question what might cause it from stop running?
From ha frontend whatever devices that use mqtt like the pictures aboved won’t show up.
All sensor, light, binary_sensor, device_trackers.owntracks which use mqtt don’t show up on front end.
There is an infinite number of reasons why programs do not run.
You need to check the status and see what, if any, error messages are produced to give a clue.
Thank you very much for your answer. The strange thing is that it works normally on raspbian.
On hassbian rp3 and rp3 b+ also did work normally the day before yesterday. Then suddenly both rp3 and rp3 b+ on hassbian didn’t work.
sudo service mosquitto status
the status of mosquitto is active
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (exited) since Thu 2018-05-24 23:40:51 +07; 16h ago
Docs: man:systemd-sysv-generator(8)
Process: 334 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mosquitto.service
May 24 23:40:51 hassbian systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker…
May 24 23:40:51 hassbian mosquitto[334]: Starting network daemon:: mosquitto.
May 24 23:40:51 hassbian systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
this is my config
mqtt:
broker: !secret mqtt_broker_ip
port: !secret mqtt_port
client_id: !secret mqtt_client_id
username: !secret mqtt_username
password: !secret mqtt_password
protocol: 3.1.1
discovery: true
That is a good start. With regards to your config, it should be
mqtt:
broker: localhost
username: !secret mqtt_username
password: !secret mqtt_password
discovery: true
unless you have a very strange setup, the port is the default 1883 and so is not necessary and the client id must be unique, so that is best left to be generated by HA. One of the things that can go wrong is some other client connects with the same client-id, which prevents HA from doing so.
But neither of these is likely to be the probably the problem.
Do you see anything in the home assistant log (.homeassistant/homeassistant.log) or the mosquitto log (
/var/log/mosquitto/mosquitto.log) that might indicate the problem?
Thank you very much.
I have try pub sub and it shows connection refused. So I recreate the username and password again. then restart ha. HA come back normally. I will try reboot this time and see whether it comes back normally then will go for rp3 b+
hmm. when reboot. give error mqtt again.
sudo service mosquitto start
then restart home assistant
sudo service mosquitto start
then I check status
sudo service mosquitto status
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (exited) since Fri 2018-05-25 18:31:27 +07; 20min ago
Docs: man:systemd-sysv-generator(8)
Process: 352 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCC
CGroup: /system.slice/mosquitto.service
May 25 18:31:27 hassbian systemd[1]: Starting LSB: mosquitto MQTT v3.1 message b
May 25 18:31:27 hassbian mosquitto[352]: Starting network daemon:: mosquitto.
May 25 18:31:27 hassbian systemd[1]: Started LSB: mosquitto MQTT v3.1 message br
~
then restart home assistant. Show error mqtt config like the picture. But when check config show valid.
When test mosquitto
mosquitto_sub -d -u mqttusername -P mqttpassword -t “dev/test”
Error: Connection refused
my mqtt config is normal just put in full config
mqtt:
broker: myhaipaddress
port: 1883
client_id: homeassistant
username :mqtt_username
password: mqttpassword
protocol: 3.1.1
discovery: true
it must be:
username: mqtt_username
The space is correct. I copy and try to type so shows incorrect indent.
mqtt:
broker: !secret mqtt_broker_ip
port: !secret mqtt_port
client_id: !secret mqtt_client_id
username: !secret mqtt_username
password: !secret mqtt_password
protocol: 3.1.1
discovery: true
from var/log/mosquitto/mosquitto.log
1512911764: Client homeassistant already connected, closing old connection.
1512911764: Client homeassistant disconnected.
1512911764: New client connected from 192.168.1.60 as homeassistant (c1, k60, u’this_is_my_mosquitto_username’).
1512911794: Connecting bridge cloudmqtt (m13.cloudmqtt.com:22413)
1512912436: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1512914237: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1512916038: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1512917839: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1512919586: Client homeassistant disconnected.
1512919640: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1512919923: Error in poll: Interrupted system call.
1512919923: mosquitto version 1.4.10 terminating
The date on this log file is rather old
$ date --date="@1512919923"
Sun 10 Dec 15:32:03 GMT 2017
Are you sure this is being created by your current setup?
This is the command line I use to clear my old cache from mqtt. I don’t know whether if this cause mqtt error or not.
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/diana_owntracks_battery/config" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/dianaiphone_battery_level/config" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/dianaiphone_battery_level/state" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/diana_owntracks_battery/state" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/sun_owntracks_battery/config" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/sun_battery_level/config" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/sun_battery_level/state" -r -n
mosquitto_pub -h 192.168.1.60 -p 1883 -u myusername -P 'mypassword' -t "homeassistant/sensor/sun_owntracks_battery/state" -r -n
This after I check the process of mosquitto
1527252285: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000 ) starting
1527252285: Using default config.
1527252285: Opening ipv4 listen socket on port 1883.
1527252285: Opening ipv6 listen socket on port 1883.
wq
exit
1527252383: New connection from 192.168.1.60 on port 1883.
1527252383: New client connected from 192.168.1.60 as homeassistant (c1, k60, u’mymqttusername’).
1527252383: Sending CONNACK to homeassistant (0, 0)
1527252383: Received SUBSCRIBE from homeassistant
1527252383: homeassistant/# (QoS 0)
1527252383: homeassistant 0 homeassistant/#
1527252383: Sending SUBACK to homeassistant
1527252383: Received SUBSCRIBE from homeassistant
1527252383: homeassistant/# (QoS 0)
1527252383: homeassistant 0 homeassistant/#
1527252383: Sending SUBACK to homeassistant
1527252397: Received SUBSCRIBE from homeassistant
1527252397: sensors/s1c/front_door (QoS 0)
1527252397: homeassistant 0 sensors/s1c/front_door
1527252397: Sending SUBACK to homeassistant
1527252397: Received SUBSCRIBE from homeassistant
1527252397: sensors/s1c/bedroom_2_door (QoS 0)
1527252397: homeassistant 0 sensors/s1c/bedroom_2_door
1527252397: Sending SUBACK to homeassistant
1527252397: Received SUBSCRIBE from homeassistant
1527252397: sensors/s1c/office_door (QoS 0)
1527252397: homeassistant 0 sensors/s1c/office_door
1527252397: Sending SUBACK to homeassistant
1527252397: Received SUBSCRIBE from homeassistant
1527252397: sensors/s1c/bedroom_1_door (QoS 0)
1527252397: homeassistant 0 sensors/s1c/bedroom_1_door
1527252397: Sending SUBACK to homeassistant
1527252397: Received SUBSCRIBE from homeassistant
1527252397: sensors/s1c/office_motion (QoS 0)
1527252397: homeassistant 0 sensors/s1c/office_motion
1527252397: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: sensors/s1c/back_door (QoS 0)
1527252398: homeassistant 0 sensors/s1c/back_door
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: smarthome/sensornode1 (QoS 0)
1527252398: homeassistant 0 smarthome/sensornode1
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: smarthome/sensornode1 (QoS 0)
1527252398: homeassistant 0 smarthome/sensornode1
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: smarthome/sensornode1 (QoS 0)
1527252398: homeassistant 0 smarthome/sensornode1
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: smarthome/sensornode1 (QoS 0)
1527252398: homeassistant 0 smarthome/sensornode1
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: smarthome/sensornode1 (QoS 0)
1527252398: homeassistant 0 smarthome/sensornode1
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: owntracks/Diana/DianaiPhone (QoS 0)
1527252398: homeassistant 0 owntracks/Diana/DianaiPhone
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: owntracks/Me/SuniPhone (QoS 0)
1527252398: homeassistant 0 owntracks/Me/SuniPhone
1527252398: Sending SUBACK to homeassistant
1527252398: Received SUBSCRIBE from homeassistant
1527252398: sensors/s1c/key_fob (QoS 0)
1527252398: homeassistant 0 sensors/s1c/key_fob
1527252398: Sending SUBACK to homeassistant
1527252402: Received SUBSCRIBE from homeassistant
1527252402: smarthome/sensornode1 (QoS 0)
1527252402: homeassistant 0 smarthome/sensornode1
1527252402: Sending SUBACK to homeassistant
1527252418: Received SUBSCRIBE from homeassistant
1527252418: owntracks/# (QoS 1)
1527252418: homeassistant 1 owntracks/#
1527252418: Sending SUBACK to homeassistant
1527252479: Received PINGREQ from homeassistant
1527252479: Sending PINGRESP to homeassistant
1527252480: Received SUBSCRIBE from homeassistant
1527252480: home-assistant/input_number/+ (QoS 0)
1527252480: homeassistant 0 home-assistant/input_number/+
1527252480: Sending SUBACK to homeassistant
1527252485: Received SUBSCRIBE from homeassistant
1527252485: home-assistant/input_select/+ (QoS 0)
1527252485: homeassistant 0 home-assistant/input_select/+
1527252485: Sending SUBACK to homeassistant
1527252489: Received SUBSCRIBE from homeassistant
1527252489: home-assistant/automation/+ (QoS 0)
1527252489: homeassistant 0 home-assistant/automation/+
1527252489: Sending SUBACK to homeassistant
1527252490: Received SUBSCRIBE from homeassistant
1527252490: home-assistant/input_boolean/+ (QoS 0)
1527252490: homeassistant 0 home-assistant/input_boolean/+
1527252490: Sending SUBACK to homeassistant
1527252490: Received SUBSCRIBE from homeassistant
1527252490: home-assistant/light/+ (QoS 0)
1527252490: homeassistant 0 home-assistant/light/+
1527252490: Sending SUBACK to homeassistant
1527252490: Received SUBSCRIBE from homeassistant
1527252490: home-assistant/switch/+ (QoS 0)
1527252490: homeassistant 0 home-assistant/switch/+
1527252490: Sending SUBACK to homeassistant
1527252551: Received PINGREQ from homeassistant
1527252551: Sending PINGRESP to homeassistant
1527252600: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/dian a/dianaiphone/cmd’, … (41 bytes))
1527252600: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/diana/d ianaiphone/cmd’, … (41 bytes))
1527252600: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/me/s uniphone/cmd’, … (41 bytes))
1527252600: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/me/suni phone/cmd’, … (41 bytes))
1527252660: Received PINGREQ from homeassistant
1527252660: Sending PINGRESP to homeassistant
1527252720: Received PINGREQ from homeassistant
1527252720: Sending PINGRESP to homeassistant
1527252780: Received PINGREQ from homeassistant
1527252780: Sending PINGRESP to homeassistant
1527252840: Received PINGREQ from homeassistant
1527252840: Sending PINGRESP to homeassistant
1527252900: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/diana/dianaiphone/cmd’, … (41 bytes))
1527252900: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/diana/dianaiphone/cmd’, … (41 bytes))
1527252900: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/me/suniphone/cmd’, … (41 bytes))
1527252900: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/me/suniphone/cmd’, … (41 bytes))
1527252960: Received PINGREQ from homeassistant
1527252960: Sending PINGRESP to homeassistant
1527253020: Received PINGREQ from homeassistant
1527253020: Sending PINGRESP to homeassistant
1527253080: Received PINGREQ from homeassistant
1527253080: Sending PINGRESP to homeassistant
1527253140: Received PINGREQ from homeassistant
1527253140: Sending PINGRESP to homeassistant
1527253200: Received PINGREQ from homeassistant
1527253200: Sending PINGRESP to homeassistant
1527253205: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/diana/dianaiphone/cmd’, … (41 bytes))
1527253205: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/diana/dianaiphone/cmd’, … (41 bytes))
1527253206: Received PUBLISH from homeassistant (d0, q0, r0, m0, ‘owntracks/me/suniphone/cmd’, … (41 bytes))
1527253206: Sending PUBLISH to homeassistant (d0, q0, r0, m0, ‘owntracks/me/suniphone/cmd’, … (41 bytes))