I have recently bought a shelly 2.5 and would like to control it using mqtt. I set up the broker and added the device to the configuration.yaml using the cover template. Heres the snippet of the config.yaml:
I use the mosquitto MQTT broker as installed on OS level, I do not use the docker add-on. Hence “localhost”.
Looks like you configured your MQTT broker to require credentials. If that is the case you need to configure those credentials in the web interface of the shelly switch.
Thanks once again Holger, sadly that did not change it.
In case you (anybody) might be wondering, here are broker log and (the relevant part of the) shelly config:
It seems as though there is an initial communication between client and broker which then fails
I seem to be a bit confused: When I set up the Mosquitto broker, the broker asked me to set up a “broker user” which is called “mqtt_user” in my case. Is this the user I need to set up in my mosquitto configuration?
[19:32:24] INFO: Setup mosquitto configuration
[19:32:24] WARNING: SSL not enabled - No valid certs found!
[19:32:24] INFO: No local user available
[19:32:25] INFO: Initialize Hass.io Add-on services
[19:32:25] INFO: Initialize Home Assistant discovery
[19:32:25] INFO: Start Mosquitto daemon
1566322345: mosquitto version 1.6.3 starting
1566322345: Config loaded from /etc/mosquitto.conf.
1566322345: Loading plugin: /usr/share/mosquitto/auth-plug.so
1566322345: |-- *** auth-plug: startup
1566322345: ├── Username/password checking enabled.
1566322345: ├── TLS-PSK checking enabled.
1566322345: └── Extended authentication not enabled.
1566322345: Opening ipv4 listen socket on port 1883.
1566322345: Opening ipv6 listen socket on port 1883.
1566322345: Opening websockets listen socket on port 1884.
1566322345: Warning: Mosquitto should not be run as root/administrator.
1566322345: New connection from 192.168.178.29 on port 1883.
1566322345: Socket error on client <unknown>, disconnecting.
1566322346: New connection from 192.168.178.43 on port 1883.
1566322346: New connection from 192.168.178.29 on port 1883.
1566322346: Socket error on client <unknown>, disconnecting.
1566322347: New connection from 172.30.32.1 on port 1883.
1566322347: Socket error on client <unknown>, disconnecting.
1566322347: New connection from 192.168.178.43 on port 1883.
[INFO] found mqtt_user on Home Assistant
1566322349: New client connected from 192.168.178.43 as auto-613E9445-CC26-7BF0-C2AB-4BD7AD33FE16 (p2, c1, k60, u'mqtt_user').
1566322349: New connection from 192.168.178.29 on port 1883.
1566322349: New connection from 172.30.32.1 on port 1883.
1566322349: Socket error on client <unknown>, disconnecting.
1566322349: Socket error on client <unknown>, disconnecting.
[INFO] found homeassistant on local database
1566322349: New client connected from 172.30.32.1 as auto-FCCAC898-9218-0F6E-B2B2-03222DB6BD58 (p2, c1, k60, u'homeassistant').
1566322227: New connection from 192.168.178.44 on port 1883.
1566322227: Socket error on client <unknown>, disconnecting.
1566322227: New connection from 172.30.32.1 on port 1883.
1566322227: New connection from 192.168.178.29 on port 1883.
1566322227: Socket error on client <unknown>, disconnecting.
1566322227: New connection from 192.168.178.43 on port 1883.
1566322228: Socket error on client <unknown>, disconnecting.
1566322228: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1566322229: New client connected from 172.30.32.1 as auto-1B175EEF-AB18-9EE7-2082-85CCD236190A (p2, c1, k60, u'homeassistant').
1566322229: New connection from 192.168.178.29 on port 1883.
1566322229: New connection from 192.168.178.43 on port 1883.
1566322229: Socket error on client <unknown>, disconnecting.
1566322229: Socket error on client <unknown>, disconnecting.
[INFO] found mqtt_user on Home Assistant
1566322230: New client connected from 192.168.178.43 as auto-A402241D-6069-FE3A-62D9-0AB861949057 (p2, c1, k60, u'mqtt_user').
1566322230: New connection from 192.168.178.29 on port 1883.
1566322230: Socket error on client <unknown>, disconnecting.
1566322231: New connection from 192.168.178.29 on port 1883.
1566322231: Socket error on client <unknown>, disconnecting.
1566322232: New connection from 192.168.178.29 on port 1883.
1566322232: Socket error on client <unknown>, disconnecting.
1566322234: New connection from 192.168.178.29 on port 1883.
There is a discussion with > 200 entries here where people report problems with the mosquitto-addon.
I have installed mosquitto the traditional way on a pi that also runs my fhem, deconz and homebridge, no issues at all. I would recommend this over the addon.