ioBroker.shelly icon indicating copy to clipboard operation
ioBroker.shelly copied to clipboard

[Bug]: Wrong MQTT authentification of client

Open Dettenrocks opened this issue 1 year ago • 4 comments

I'm sure that

  • [X] This issue is still present in the current beta version of this adapter
  • [X] There is no other (open) issue with the same topic (used the search)
  • [X] This issue is not described in the adapter documentation / FAQ

Shelly device

shellyplus1pm 1.0.8

Protocol

MQTT

The problem

It's my first device on this adapter. I make this connection with an easy password '123456789' without some special characters. I setup this username and password to the mqtt settings fom the adapter.

iobroker.current.log (in debug mode!)

2023-11-13 21:58:28.974 - info: shelly.0 (1898886) Starting in MQTT mode. Listening on 0.0.0.0:1884 (QoS 0)

2023-11-13 21:58:28.982 - debug: shelly.0 (1898886) [MQTT Server] Started listener on 0.0.0.0:1884 2023-11-13 21:58:49.907 - debug: shelly.0 (1898886) [MQTT Server] New connection from 192.168.1.134 2023-11-13 21:58:49.931 - debug: shelly.0 (1898886) [MQTT] Client connected: {"cmd":"connect","retain":false,"qos":0,"dup":false,"length":101,"topic":null,"payload":null,"protocolId":"MQTT","protocolVersion":4,"will":{"retain":true,"qos":0,"topic":"shellyplus1pm-d4d4da3539b0/online","payload":{"type":"Buffer","data":[102,97,108,115,101]}},"clean":true,"keepalive":60,"clientId":"shellyplus1pm-d4d4da3539b0","username":"iobroker","password":{"type":"Buffer","data":[49,50,51,52,53,54,55,56,57]}} 2023-11-13 21:58:49.932 - error: shelly.0 (1898886) [MQTT] Wrong MQTT authentification of client "shellyplus1pm-d4d4da3539b0" 2023-11-13 21:58:50.043 - debug: shelly.0 (1898886) [MQTT Server] End for 192.168.1.134 ( (shellyplus1pm / shellyplus1pm-d4d4da3539b0 / shellyplus1pm#d4d4da3539b0#1)) 2023-11-13 21:58:50.052 - info: shelly.0 (1898886) [MQTT] Client Close: (shellyplus1pm / shellyplus1pm-d4d4da3539b0 / shellyplus1pm#d4d4da3539b0#1) (false) 2023-11-13 21:58:50.053 - debug: shelly.0 (1898886) [BaseClient] Destroying (shellyplus1pm / shellyplus1pm-d4d4da3539b0 / shellyplus1pm#d4d4da3539b0#1) 2023-11-13 21:58:50.055 - debug: shelly.0 (1898886) [deviceStatusUpdate] shellyplus1pm#d4d4da3539b0#1: false 2023-11-13 21:58:50.056 - debug: shelly.0 (1898886) [MQTT] Destroying 2023-11-13 21:58:50.057 - debug: shelly.0 (1898886) [MQTT Server] Close for 192.168.1.134 ( (undefined / undefined / undefined))

Version of nodejs

18.7.1

Version of ioBroker js-controller

5.0.14

Version of adapter

6.6.1

Dettenrocks avatar Nov 13 '23 21:11 Dettenrocks

i found the problem. i change back the username to "admin". i see the this in the code

lib/protocol/base.js:

i think the problem is at line 125 for gen2 devices. const username = 'admin';

for gen1 you take this at line 86: username: this.adapter.config.httpusername,

Dettenrocks avatar Nov 13 '23 21:11 Dettenrocks

Thanks for reporting a new issue @Dettenrocks!

  1. Please make sure your topic is not covered in the documentation
  2. Ensure that you use the latest beta version (not the current stable version): 6.6.1
  3. Please attach all necessary log files (in debug mode!), screenshots and other information to reproduce this issue
  4. Search for the issue topic in other/closed issues to avoid duplicates!

Otherwise this issue will be closed.

github-actions[bot] avatar Nov 13 '23 21:11 github-actions[bot]

You've mixed two topics in this issue

i found the problem. i change back the username to "admin". i see the this in the code

As documented, Gen 2 devices don't have a username. The username is always admin. So you don't have to change anything in your configuration "back to admin". The username (for restricted login) is just used to authenticate via HTTP against Gen 1 devices.

klein0r avatar Nov 14 '23 07:11 klein0r

For Gen 2 devices you can define a passwort to restrict the access to the Web Admin: grafik grafik

Klaus-Lucas avatar Jan 14 '24 20:01 Klaus-Lucas