Page 1 of 1
Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 15:59
by bjornsundberg
Hi,
Working with a setup for a Domoticz on a boat to send sensor data over 3G network to my Domoticz at home.
What would be the easiest way to send sensordata (temp, etc) from Domoticz to thingspeak.com (this Domoticz would be behind 3G network so it need to send data). What also be the easiest to send data from thingspeak.com to Another Domoticz.
Or is there a better way to do this?
br
Björn
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 16:12
by FireWizard
Hi,
As this should be lightweight, perhaps MQTT should be considered.
Is this something:
https://community.thingspeak.com/tutori ... pberry-pi/
Regards
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 18:48
by bjornsundberg
Great, thanks a lot!
Can't get my head around how to use the above example. Where do I put the code? In a Script/Python (Events) and call it with Blocky?
br
Björn
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 19:13
by FireWizard
Hi
I'm not familiar with Thingsspeak.
However, this example demonstrates, how to pubish CPU and Memory Usage, using MQTT to Thingsspeak. You can copy and paste it. Give it a name with an extension .py, as it is een Python script. And make it executable and just run it. No Domoticz needed.
You should also install the library paho-mqtt and psutil (sudo pip install paho-mqtt and sudo pip instal psutil). This is just a test to find out, if two topics are published on thingspeak.
If so I assume that you can also publish Domoticz data?
Regards
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 19:23
by bjornsundberg
ok, I'll try that just to make check if the thing to things work

After that, next thing will be to add the script in Domoticz and then add sensor data.
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 20:00
by FireWizard
Hi,
I understand that you want to connect a Domoticz server, installed on your boat, with a Domoticz server at home. You will use 3G and therefore it is important to keep the network load as low as possible.
I think that the MQTT protocol is best suited for such an application.
Domoticz is able to publish data to a MQTT broker and also to subscribe to MQTT messages.
-
For a comparison between HTTP and MQTT see:
https://medium.com/mqtt-buddy/mqtt-vs-h ... 68169b3105
Instead of ThingSpeak you can also use a MQTT server (broker)
You have two options.
1. Public available broker:
https://github.com/mqtt/mqtt.github.io/ ... ic_brokers
2. Private owned broker, e.g Mosquitto.
With Node-Red you can convert the messages from domoticz/out from your "boat" Domoticz to domoticz/in to your "home" Domoticz.
Something to think about?
Regards
Re: Send Domoticz data to and from thingspeak.com
Posted: Wednesday 11 December 2019 21:21
by zicht
Hi
I see there is a rest api also, so you could use json to json directly, a bit depending on what data (and how frequent the update should be : based on time or based on event)
Based on Json you could keep things complete in you own hands & control. Json is pretty easy once you understand the mechanism.
With all suggestions above or this one, sky is the limit

Re: Send Domoticz data to and from thingspeak.com
Posted: Friday 13 December 2019 18:19
by bjornsundberg
I got MQTT broker to work between two Domoticz devices so now its near to also send data to Thingspeak.
Re: Send Domoticz data to and from thingspeak.com
Posted: Saturday 14 December 2019 18:30
by bjornsundberg
Closing this topic right now, going to work with json between my two Domoticz instead.