Imroy / pubsubclient

A client library for the ESP8266 that provides support for MQTT
MIT License
435 stars 115 forks source link

wrong hostname used #82

Open Urs-Eppenberger opened 7 years ago

Urs-Eppenberger commented 7 years ago

Hello I'm using your library since I need the SSL encryption and the authentication in my environment. My code works mostly fine. But after a day or two I start to see strange entries in the MQTT broker log (mosquitto on Raspberry Pi).

Here is the correct entry: 1502516513: New connection from 192.168.11.80 on port 8883. 1502516513: New client connected from 192.168.11.80 as sonoffth1 (c1, k15, u'mqtt').

I have unreliable WiFi, therefore it is quite usual that the son off device looses the connection, then runs the recovery code to reconnect. But very rarely the hostname is corrupt: 1502521762: New connection from 192.168.11.80 on port 8883. 1502521762: New client connected from 192.168.11.80 as y (c1, k15).

I have no clue where the hostname 'y' comes from. I have attached the whole code of my sketch below for your reference. Maybe I'm doing something stupid, or maybe there is some glitch in the library.

Kind regards, Urs Eppenberger Sonoff_Generic_v1i_2.txt