grzegorz914 / homebridge-melcloud-control

Homebridge plugin for Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation, publish as dynamic external platform accessory.
MIT License
49 stars 2 forks source link

MQTT - will not connect #34

Closed JornDL closed 1 year ago

JornDL commented 1 year ago

Hi

I'm trying to use MQTT with authorization log in, but connection is refused.

Could you please add the field "Client ID" to the MQTT authorization, please.

I'm using Mosquitto as my MQTT broker and it needs the "Client ID" to be abled to log in.

(great plugin - great work - happy with this)

grzegorz914 commented 1 year ago

I have mosquito too and Connect co without any problem

JornDL commented 1 year ago

So what could be my issue ? I have a lot of other MQTT clients - all using Client ID - but here I get this error: [3/19/2023, 7:00:33 AM] [homebridge-melcloud-control] MQTT Connect error: Error: Connection refused: Not authorized

grzegorz914 commented 1 year ago

wrong credentials

grzegorz914 commented 1 year ago

Check user and password

JornDL commented 1 year ago

Just done that again to be sure and they are correct.

Also tried without the Prefix - but it makes no difference:

[3/19/2023, 7:19:17 AM] [homebridge-melcloud-control] MQTT Connect error: Error: Connection refused: Not authorized

grzegorz914 commented 1 year ago

added in 0.10.1

JornDL commented 1 year ago

That was super quick :-)

I just tried it, but it seems, that it uses another ID than the one I put in the config:

Config: "mqttClientId": "melcloud_2_mosquitto"

Mosquitto log: 1679208806: New connection from 127.0.0.1:47476 on port 1883. 1679208806: Client mqttjs_7b8e0617 disconnected, not authorised.

Homebridge log: [3/19/2023, 7:53:26 AM] [homebridge-melcloud-control] MQTT Connect error: Error: Connection refused: Not authorized

Mosquitto log - When I connect from my PC with MQTT explorer: 1679206392: New connection from 192.168.1.245:51471 on port 1883. 1679206392: New client connected from 192.168.1.245:51471 as mqtt-explorer-4286441e (p2, c1, k60, u'jorn').

JornDL commented 1 year ago

I don't know if it makes any difference - but I'm running in a child bridge

JornDL commented 1 year ago

Also my zigbee2mqtt connection from the same RPi4:

1679187168: New connection from 127.0.0.1:33378 on port 1883. 1679187168: New client connected from 127.0.0.1:33378 as RPi4Main_zigbee2mqtt_2_mosquitto (p2, c1, k60, u'jorn').

grzegorz914 commented 1 year ago

try again. 0.10.2

JornDL commented 1 year ago

Just had breakfast - so a little later:

The log in still fails: [3/19/2023, 9:38:12 AM] [homebridge-melcloud-control] MQTT Connect error: Error: Connection refused: Not authorized

But It now uses the correct Client ID: Config: "mqttClientId": "melcloud_2_mosquitto"

Mosquitto log: 1679215092: New connection from 127.0.0.1:49278 on port 1883. 1679215092: Client melcloud_2_mosquitto disconnected, not authorised.

I can't what understand what is wrong - or what I'm doing wrong - mqqt section from config: "enableMqtt": true, "mqttDebug": false, "mqttHost": "127.0.0.1", "mqttClientId": "melcloud_2_mosquitto", "mqttPrefix": "melcloud/kitchen", "mqttAuth": true, "mqttUser": "jorn", "mqttPasswd": "****" The user/password is correct - also used in the same config for another plugin.

grzegorz914 commented 1 year ago

May be try not use 127.0.0.1, set full address of mqtt server

JornDL commented 1 year ago

Tried that also without any luck

grzegorz914 commented 1 year ago

Strange, here all working correct, mosquito as broker on Mac. Check your broker authentication setting: https://mosquitto.org/documentation/authentication-methods/

grzegorz914 commented 1 year ago

If your broker working only inside local network then you can allow unauthenticated access