letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.26k stars 2.21k forks source link

[TEST-A] Controller Homie can not connect to mosquitto MQTT broker #3940

Closed DynamicLoader closed 2 years ago

DynamicLoader commented 2 years ago

Summarize of the problem/feature request

Hi, I flashed ESP_Easy_mega_20211224_test_A_ESP8266_4M1M.bin to my ESP8266 (Wemos D1),and I want to use the plugin Homie MQTT. But I can't get it connect to Mosquitto MQTT broker running on my RasPi. All the things are correct.The same MQTT connection settings goes well with Domoticz MQTT and openHAB MQTT.

Expected behavior

ESP8266 Homie MQTT connect to broker successfully.

Actual behavior

On the brokers log,I found:

Mosquitto[169553]: 1643727806: New connection from {ESP8266 IP} on port 1883.
Mosquitto[169553]: 1643727806: Bad socket read/write on client <unknown>: Invalid arguments provided.

On the ESP8266 serial port log,I found:

496698 : Error  : MQTT : Intentional reconnect
511738 : Error  : MQTT : Broker C014 connection failed (6/0)

Steps to reproduce

Add Homie MQTT controller and set USE IP address,enter IP and port,then tick Enabled, Submit.

System configuration

Hardware: ESP8266

ESP Easy version: 20211224_test_A

ESP Easy settings/screenshots: None

Thanks.

TD-er commented 2 years ago

Can you test to see if any other MQTT controller is able to connect? For example the OpenHAB MQTT controller.

If your MQTT broker requires credentials, what length have those? Please also test with "use extended credentials" checked.

DynamicLoader commented 2 years ago

To simplify the debug,I have configured the mosquitto server not to use any credential,and no ssl. The same config on esp8266 goes well with Domoticz MQTT and openHAB MQTT plugin.I think the problem is the Homie plugin itself.

Thanks for reply.

uzi18 commented 2 years ago

@Lucy2003 how long is your login/password?

DynamicLoader commented 2 years ago

@uzi18 I have NO login and NO password.Anonymous connection is allowed on the broker.

TD-er commented 2 years ago

OK, if the other MQTT controllers can connect to the broker, then it is indeed something specific to the Homie controller. Have you tested/used it before? And if so, if you did, what version was working?

DynamicLoader commented 2 years ago

To be honest,this is my first try.

mekintos commented 2 years ago

Build: ESP_Easy_mega_20211224_normal_ESP8266_4M1M Dec 24 2021

My workaround which is not useful at all is like this...

I was banging my head last month over this and I feel exhausted :D does previous version works as it should ? :D will try it out...

TD-er commented 2 years ago

Make sure to set the timeout to 1000 msec. Also, how do you address your broker? Via IP or via hostname? (your local broker)

mekintos commented 2 years ago

after this, it works usually till next reboot when I have to make these changes again...

some of the previous builds worked without any issue... I flashed newest one and it has this problem now :D sad thing is that I don't remember which version worked for me

https://user-images.githubusercontent.com/99022511/152542800-232a9fb5-c554-47a8-b0d1-f3c4cf43c768.mp4

TD-er commented 2 years ago

Please show the controller settings you are using. And also, is the MQTT broker running on the same subnet of your network as the ESP?