This is kind of interesting – the promise of an ESP8266 MQTT broker (not client – BROKER) able to talk to up to 25 connections. Really? Let’s find out.
Go here to get an account (free) and download the .BIN file for your ESP8266. Use something like the NODEMCU flasher to put the single .BIN file into the ESP8266. All of this takes no time at all.
When you flash the chip – it will appear as an access point and you can connect to it with your mobile phone… password 12345678
Once connected, on a browser on your phone, go to 192.168.4.1
Well, that’s the theory – on my phone, though I could connect to the board, going to 192.168.4.1 did me no good at all, the browser went no-where. I had to turn off my mobile data first.
At the end of that a web page did indeed appear and wanted to know about my wifi details. I punched that in. There was no search for an access point which I found disappointing – but I put in my nearest access point and password.
I could not proceed here without creating an account – and the account registration makes no mention of how your details (email) will be used – that needs clarifying – I’d prefer a direct promise that my details will NOT be used for marketing purposes. After the normal “we’ll send you an email to confirm” sequence, I looked into the iotcentral.eu site and grabbed my details – I was given a unique number to use as part of my topic. The username and password that the little board was waiting for – was the password used with the account.
I entered my username and password into the phone and was immediately told that the page wasn’t working – of course that is because the ESP8266 had dropped out of being an access point and joined up to my network. Something a little more elegant would be nice however as it looks to the uninitiated like the whole thing has bombed out – and what if I’d made a mistake?
I reset the ESP8266 and hoped for the best. Nothing on the PC browser…. I hit refresh on the phone – I must’ve done something wrong as the phone was still connected to the ESP8266 and I was presented with an unfilled page of questions again. Eventually I twigged that I should not be using my username or topic number as user but my email address… I think a picture on the website showing this might help.
THIS time the phone came back with a sensible response and told me to reset the ESP8266.
The BROWSER on the PC then showed that I now had a broker logged in.
It showed the IP address of the ESP8266 (internal) as well.
Credentials above are blocked out to protect the innocent (me). All of this took very little time in practice.
Once set up – I opened up my local MQTT client, punched in the local machine (I really had no desire to go to iotcentral – there are plenty of online MQTT brokers out there – I wanted the local version. Sure enough I could connect to the local ESP8266 broker – and send and receive MQTT messages. HURRAY.
Given the above scenario…
1. When I connect to the local MQTT broker – does it access iotcentral? Does it NEED to access iotcentral?
To test this I shut off my router from the outside world – and reset the ESP8266. I could not, no matter what I did, connect to the local ESP8266 broker. My normal Raspberry Pi-based MQTT broker sprang back to life almost immediately and the browser connected to that. The ESP8266 broker however remained dead. I reconnected the outside world – but the ESP-8266-based broker remained unavailable. I reset the ESP8266-based broker – and nothing. When I looked on the IOTCENTRAL site – the router had changed IP addresses. I’ve had an email that said this
“If the IP address received is different that the one it has, update it to the settings.json from the SPIFFS” - that makes a lot of assumptions I guess because I have NO idea what SPIFFS has to do with this.
Start again… I used my router to map the MAC address and the IP address so this would not happen again! I disconnected my INTERNET access and the ESP8266 continued to act as a broker. I reset the board. Clearly it stopped being a broker for a moment… but after reset, maybe 10 seconds later – it sprang back to life.
For the sake of it (though I knew what the answer would be) I tried QOS levels other than zero and asked for retention of messages (not enough RAM in an ESP8266 to start doing that) – they were ignored.. but – the messages still worked!
So – my questions to the author:
1. When the ESP8266 broker connects – if it cannot get to the outside world – it makes a broker – lovely – but when it DOES connect – what information does it send to the iotcentral site? And while connected to the site and operating, what goes back and forth?
2. Is it possible to insist on username and password protection when using the broker locally? I use Mosquito and always insist on username and password. I’ve had many conversations with people over the years who say that even locally you should put a username and password in? Just asking!
3. If connection to the IOTCENTRAL site initially IS essential – and it probably is? What is this site sitting on? Will it still be working in a couple of year’s time for example?
APPARENTLY this little unit will talk to up to 25 devices all on it’s own – which, I have to say would make it very useful for smaller installations. How RELIABLE that is will be down to longer term testing. I tried turning the WIFI off and back on. I turned the WIFI off – the broker disconnected. I turned the WIFI back on – the broker reconnected immediately. That’s a good start because your MQTT broker MUST be reliable or you’re in deep trouble.
Well, there it is – something new! I have to say I really did not think the ESP8266 would get this far. I suggest if this interests you – you look at iocentral.eu -but let’s see what the author has to say about the above questions…
Funnily enough I’ve just done a video about basic MQTT access….