MQTT client stop after uncomment API_PASSWORD

Hi All,

I’m new on the Home Assistant world, however I’ve a lot of experience with Arduino/ESP8266. I’ve installed successfully Home Assistant into a RaspPi 3, downloaded the image from the home page, installed the hassbian distro, used all the tools to write the SD, etc… My http://hassbian.local:8123/ worked like a charm, I’ve developed 2 switches for esp8266 with the MQTT protcocol… it worked as expetec… so far so good. Then I decided to make my HMASS being exposed to Internet, so I downloaded the LetsEnrcrypt packages, setup the DuckDns, etc… everything worked as expected. So I was trying to secure the portal access by username/password, went to the DOCs and it says that you need to setup the “api_password” on the “http” section of the configuration.yaml.

Here comes the problem: If I put my password into the “api_password” all my internal mqtt clients cannot transmit to the [hbmqtt.broker] , from the Serial debuuger from Arduino I got: Attempting to connect…

If disable the “api_password” all mqtt clients start transmitting and connecting successfully…

Please help with this issue… I’m pretty lost here…

Regads,

LT

Hmmm, that does seems weird. Could you maybe state some more information about your setup and what’s happening?

  • What host have you set in the ESP8266 firmwares? The http server might be interfering with mDNS. Try setting the IP address of the broker in the firmwares.
  • Does the Home Assistant front end start up when you do specify the api_password. Or in other words, does Home Assistant start up at all if you use the password?
  • Anything in the Home Assistant logs?

Hi Otto,

  • ESP is using my internal IP that is hosting the Hassbian, when I uncomment ‘api_password’ no LAN mqtt client can connect
  • Home Asssistant can start/stop ok using api password or not
  • I’ve setup the logs as info, error, and critical… Do you know which FLAG do I have to setup into logger in order to see all levels?

THanks,

LT

The flag for all messages should be debug.

2018-04-29 18:35:42 DEBUG (MainThread) [hbmqtt.broker] Authentication failed due to ‘auth_anonymous’ plugin result: False

Sould I pass username/password into the ESp8266 skecth?

2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker] Keep-alive timeout=17
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] <-in-- ConnectPacket(ts=2018-04-29 19:08:03.247887, fixed=MQTTFixedHeader(length=25, flags=0x0), variable=ConnectVariableHeader(proto_name=MQTT, proto_level=4, flags=0x2, keepalive=15), payload=ConnectVariableHeader(client_id=arduinoClient, will_topic=None, will_message=None, username=None, password=None))
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker.plugins.auth_anonymous] Authentication failure: session has an empty username
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker] ‘packet_logger_plugin’ plugin result: None
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker] ‘auth_file’ plugin result: None
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker] ‘broker_sys’ plugin result: None
2018-04-29 19:08:03 DEBUG (MainThread) [hbmqtt.broker] Authentication failed due to ‘auth_anonymous’ plugin result: False
2018-04-29 19:08:11 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant <-in-- PingReqPacket(ts=2018-04-29 19:08:11.405527, fixed=MQTTFixedHeader(length=0, flags=0x0), variable=None, payload=None)
2018-04-29 19:08:11 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant -out-> PingRespPacket(ts=2018-04-29 19:08:11.411248, fixed=MQTTFixedHeader(length=0, flags=0x0), variable=None, payload=None)

Fixed!!!
You need to pass parameters for Username: homeassistant and password “your_api_password”

I think that the documentation has to make a comment on this… I was driving crazy!!

Arduino CODE:

if (client.connect(“arduinoClient”,“homeassistant”,“pasword”)) {

1 Like