I’m new with MQTT. I’m trying to publish WiFi Relay temperature to ThingSpeak but without success. Is it possible? If yes, is it possible to have exemple what i should write in User, Password, Publish Topic and subscribe topic field?
Thanks for help
Francois, as Glyn suggested, it’s pretty simple to do it.
Just open the “Broadcast Daemon” page of the WiFi Relay and config it like this:
HTTP GET broadcast enabled?: … select it
URL: /update?key=XXXXXXXXXXXXX&field1=%d&field2=%d&field3=%d&field4=%s&field5=%s&field6=%s (instead of the XXXXXXXXXXXXXXX just put your channel WRITE KEY)
ThingSpeak channel: YYYYYYY (instead of the YYYYYYY put your channel ID)
ThingSpeak RO API key: ZZZZZZZZZZZ (instead of ZZZZZZ put your RO API Key)
After that you have to restart the WiFi relay!
You have to create an account on Thingspeak.com and then creat a channel.
After you create the channel, you’ll find there the Write, RO API keys and the channel ID (API KEYS tab)
On the channel settings tab, just give it a name and select the first 6 fields.
I also selected “Show status” and then saved the settings. You’ll see the values registered (if all went fine) in about 30 seconds.
Thanks for your answers,
The broadcast Deamon is not on the menu of the new version of the relay. In the pass, i had the three channels relay and yes, it was easy to broadcast to Thingspeak.
It’s because the broadcast Deamon is not there yet that i try to publish the temperature value via MQTT to Thingspeak.
Follow is the fields of MQTT menu but i don’t know what to write in User, Password and Subscribe topic fields.
Subscribe Topic: ???
Publish Topic: channels//publish/fields/field1/
If i try to fill only Host, port and Publish topic field it does’nt work.
Yup, it looks like thingspeak has both a HTTP and MQTT API. If possible i would recommend using MQTT as it’s much lighter weight. Either should work, although I have not tested or have experience of either!
I did some tests and i think is not possible to publish to ThingSpeak. ThingSpeak require to have specific format topic for publishing to a field. Follow is the format of the topic.
The problem is, if a put this topic in the Publish Topic field of the relay, the relay will add /ds18b20/1 and /relay/1 to the formated topic for publishing the temperature and relay state. So, the relay will publish on these two topics ,
channels/<channelID>/publish/fields/field<fieldnumber>/<apikey>/ds18b20/1 (For the temperature)
channels/<channelID>/publish/fields/field<fieldnumber>/<apikey>/relay/1 (For the relay state)
and this, does not respect the formated topic that ThingSpeak expect to receive.
Thank for your help, it was appreciated.
Hello, your work was helpful in understanding the issue with thingspeak config?
I would like to know how you finally addressed this issue? Which mqtt broker did you use? It would be helpful if you can elaborate.