Hey, i just managed to setup my new Sonoff wifi-switch (using the guideline https://www.youtube.com/watch?v=-JxPWA-qxAk ). I managed to get everything up and running, but the MQTT-service disconnects for some reason. And I can’t figure out why…
“(Thread-10) [homeassistant.components.mqtt] Disconnected from MQTT (1). Trying to reconnect in 1 s”
Check where the log file is being written to, which is defined in the configuration file.
The configuration file being used is defined in the startup line. To find this do
pi@raspberrypi:~
$ systemctl status mosquitto.service
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto)
Active: active (running) since Fri 2017-04-28 11:35:13 BST; 3 days ago
Process: 397 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mosquitto.service
└─415 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Then my log file is
pi@raspberrypi:~
$ cat /etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
mmm… Maybe the log file isn’t being produced because it has nothing to report as nothing is connected. Mine only reports connections, disconnections and backups of the db. Try connecting with
Exactly, the sonoff is connecting. And I can toggle the switch on, but then the “slider” in HASS just goes does not stay in the on state (i.e. I can’t turn it off…I have to do it from the sonoff web interface). Also, for some reason it switches itself on after ~30 s after I have toggled off in the web interface. So there is something fishy…
But after a nights sleep I still can’t see why mosquitto fails to create a log file. You may have an older version. Can you check the example file listed in my config to see if it the options for the config are the same? Maybe also check the level of logging that is default.
So the brooker is online ? But it keeps disconnecting…
17-05-02 21:20:44 WARNING (Thread-10) [homeassistant.components.mqtt] Disconnected from MQTT (1). Trying to reconnect in 1 s
17-05-02 21:20:45 WARNING (Thread-10) [homeassistant.components.mqtt] Disconnected from MQTT (1). Trying to reconnect in 2 s