Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By ridge
#28573 Hi,
There are two, and possibly three different MQTT client libraries for the esp8266 called pubsubclient out there...
First is the knolleary/pubsubclient.
Second is lmroy/pubsubclient.
Third is the pubsubclient library included in the ESP Easy Sensor project.

My sketch requires the lmroy/pubsubclient library.

1) Download https://github.com/Imroy/pubsubclient
2) On my linux system, I put the library in:
/home/ridge/.arduino15/packages/esp8266/hardware/esp8266/1.6.5-1044-g170995a/libraries/PubSubClient

The Show Hidden Files item in the View tab needs to be checked to see the .arduino15 directory.

I renamed the folder from pubsubclient to PubSubClient for good luck. :)

I would delete any other pubsubclient folders from anywhere else on your system the arduino compiler may look for it to keep things tidy. If you don't want to delete other pubsubclient folders, I had to rename them and move them to the desktop to keep the compiler from finding old versions.

The Windows path has been published a few times on the forum... the .arduino15 directory is the one to find.
After these sorts of changes, I always shut down and restart the arduino IDE if it was running.

For your MQTT broker (I use Mosquitto-1.4.3), be aware of this from the lmroy/pubsubclient site:
Note that for now PubSubClient requires a broker that supports version 3.1.1 of the MQTT standard, not 3.1 or earler.
User avatar
By Jram
#28605 Hi Ridge! Thanks for your hints!

I think the library is installed ok but I reinstalled it just in case. However, it didn't get me going.

I test-compiled the examples that came with the PubSubClient library and they compile fine.

So it seems (for me) to be something to do with the decalration on line 28 which causes (ESP_OpenHAB.ino:28: error: no matching function for call to 'PubSubClient::PubSubClient(IPAddress&)')

Hmm... Looking closely...

Anyway - thanks for taking a look. I'm sure its some sillyness somewhere that I have created - I'll let you know if I find something. :)
User avatar
By ridge
#28619 From this error:

C:\Users\john\Documents\Arduino\libraries\pubsubclient-master\src/PubSubClient.h:89:4: note: candidate expects 3 arguments, 1 provided

I would give a very high probability that the arduino compiler is trying to use a different pubsubclient library than the one I wrote the example for.

If I recall, pubsubclient-master is the directory structure for the knolleary/pubsubclient libraries.
User avatar
By Jram
#28620 I think you're right! However, the PubSubClient library zip file at the end of https://github.com/Imroy/pubsubclient is pubsubclient-master.zip (I didn't rename it this time). Its a fork of the older version you mentioned.

I also installed this into the Arduino15 dir (and deleted the above library) with the same result. The error message has always given me the location of the library that it was trying to use but I have also searched for other PubSub libraries that might be there and found none. (Arduino IDE is a new installation for me).

I even got a brand new PC that I was setting up for someone else and installed Arduino, ESP8266 and then the PubsubClient and the result was the same.

I wonder if you might post your PubSubClient files for me to take a look at/use?

Thanks again :)