Send Domoticz data to and from thingspeak.com

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
bjornsundberg
Posts: 13
Joined: Wednesday 11 December 2019 15:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Send Domoticz data to and from thingspeak.com

Post 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
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post by FireWizard »

Hi,

As this should be lightweight, perhaps MQTT should be considered.

Is this something: https://community.thingspeak.com/tutori ... pberry-pi/

Regards
bjornsundberg
Posts: 13
Joined: Wednesday 11 December 2019 15:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post 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
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post 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
Last edited by FireWizard on Wednesday 11 December 2019 19:27, edited 3 times in total.
bjornsundberg
Posts: 13
Joined: Wednesday 11 December 2019 15:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post 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.
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post 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
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post 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 :)
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
bjornsundberg
Posts: 13
Joined: Wednesday 11 December 2019 15:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post by bjornsundberg »

I got MQTT broker to work between two Domoticz devices so now its near to also send data to Thingspeak.
bjornsundberg
Posts: 13
Joined: Wednesday 11 December 2019 15:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Send Domoticz data to and from thingspeak.com

Post by bjornsundberg »

Closing this topic right now, going to work with json between my two Domoticz instead.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest