thingspeak with two devices

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
dogbone
New user
Posts: 3
Joined: 09 Apr 2020, 22:25

thingspeak with two devices

#1 Post by dogbone » 10 Apr 2020, 23:13

Hello together,
I have problems sending data from two devices (hx711 on d5 and ds18b20 on d2) to my thingspeak account. Each device by itselve work fine, but when i try to connect both lots of data gets lost.
I use this version
ESP_Easy_mega20200310_test_ESP8266_4M1M_VCC.bin
I found a thread from 2015 but with no help for me.
https://www.letscontrolit.com/forum/viewtopic.php?t=559
Are there already problems or what do i wrong?
Thanks for your kind help.
Marcus

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: thingspeak with two devices

#2 Post by TD-er » 10 Apr 2020, 23:22

Thingspeak only allows a single message every N seconds (900 I think) with their free accounts.

So for this you should play around with the controller settings.
Maybe you can put all values in a single dummy task and then let those write to the Thingspeak controller.
Minimum interval between messages should then be set to the right amount and you may need to tweak settings like what to do when the queue is full, length of the queue etc.

For example if you need 2 dummy tasks for this, you should set the queue depth to 2, minimum time between messages to N*1000 msec and full queue action to "keep oldest"
These 2 tasks should then be called via TaskRun in the rules, to make sure they are sent to the queue at the same rate.

See: https://espeasy.readthedocs.io/en/lates ... figuration

For this you may need to sync the data of one node to the other.
Sharing plugin data from one node to the other can be done via the ESPEasy p2p controller: https://espeasy.readthedocs.io/en/lates ... mong-nodes

dogbone
New user
Posts: 3
Joined: 09 Apr 2020, 22:25

Re: thingspeak with two devices

#3 Post by dogbone » 10 Apr 2020, 23:42

Thanks for your quick reply. I will read and understand it :)) tomorrow
Marcus

Moff
New user
Posts: 4
Joined: 27 Sep 2020, 22:07

Re: thingspeak with two devices

#4 Post by Moff » 27 Sep 2020, 22:31

Hello,

similar problem with thingspeak and more then one device.

the build:
Build:⋄ 20110 - Mega
System Libraries:⋄ ESP82xx Core 5d3af165, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support
Git Build:⋄
Plugin Count:⋄ 46 [Normal]
Build Origin: Travis
Build Time:⋄ Aug 29 2020 16:09:57
Binary Filename:⋄ ESP_Easy_mega_20200829_normal_ESP8266_4M1M_VCC
Build Platform:⋄ Linux-4.19.104-microsoft-standard-x86_64-with-glibc2.29
Git HEAD:⋄ mega_c625d91

Thingspeak=Ctr 1
Minimum Send I.: 15000ms
Max Queue Depth: 1
Max Retries: 2
Full Queue Action: Delete Oldest
Check Reply: Check Acknow.
Client Timeout: 500ms

Rules Set 1:
On CO2#PPM do // CO2 Value Change
TaskValueSet 5,1,[CO2#PPM]
TaskValueSet 5,2,[Environment#Temperature]
TaskValueSet 5,3,[Light#Lux]
TaskValueSet 6,1,[Environment#Pressure]
TaskValueSet 6,2,[Environment#Humidity]
endon


Dummy 1 (5,1 to 3) links to Ctr 1 IDX (1) (three Values every 30 sec)
Dummy 2 (6,1 and 2) links to Ctr 1 IDX (2) (two Values every 30 sec)

What happened: First Channel of Dummy 1 works (5,1), the other channels are somewhat mixed within Thingspeak.
I've read some information about an option called "message delay" under advanced tab - but under advanced is no such option?

PS: everything works excellent fine with just one Dummy ...

Whats my failure?

Should i use instead a Rule with .json write to thingspeak?

Thank you!
R.
Last edited by Moff on 27 Sep 2020, 22:55, edited 3 times in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: thingspeak with two devices

#5 Post by TD-er » 27 Sep 2020, 22:43

If you run into issues where the delay queue mechanism may work against you, then you can perhaps better copy the data to a dummy task and call the taskrun command from the rules which will try to flush the data to the connected controller.

For this I would use the (new) looptimer command and maybe toggle a variable to switch between tasks to 'run'.

Not tested, so the syntax is probably incorrect, but I'm thinking of something like this:

Code: Select all

On System#Boot do    //When the ESP boots, do
  let,1,8 // Set variable 1 to 8
  looptimerset,1,1800     // Start loop timer 1, 1800 sec interval
endon

On Rules#Timer=1 do
  taskrun,[int#1]
  if [int#1]=7    // Last task was task 7
    let,1,8  // New task is task 8
  else
    let,1,7  // New task is task 7
  endif
endon
In this example I used 7 & 8 as tasks where you put the dummy tasks.
You still need some code to copy the data from the tasks where you got the data from, and store it in the dummy (see command taskvalueset)

Moff
New user
Posts: 4
Joined: 27 Sep 2020, 22:07

Re: thingspeak with two devices

#6 Post by Moff » 27 Sep 2020, 23:15

Thank you for your immediate answer - but i'm not sure if i understand it :oops:

The Solution for my Problem is really simple (i'm stupid as a bunch of flowers :roll: ):

If you want to synchronize the max. possible 8 Fields to one Thingspeak-Channel, you have to set the IDX Value within the ESP Easy Devices-Tab correctly:

Device1 with channels: A, B, C, D so IDX is set to 1 (Ctr 1) (Value A is the first channel aka Thingspeak FIELD)
Device2 with channels: E, F, G, H so IDX is set to 5 (Ctr 1) (Value E is the fifth channel aka Thingspeak FIELD ... grggrrrrrrrrr)

If i still know now how i could use the dew point value of the BME280 (BME280: dew point 11.54C) i would be as lucky as trump today ;-)

Moff
New user
Posts: 4
Joined: 27 Sep 2020, 22:07

Re: thingspeak with two devices

#7 Post by Moff » 28 Sep 2020, 16:44

Dewpoint to Dummydevice (6,3):

Use the Systemvariable or Conversation: %c_dew_th%(Temperature,Humidity)

e.g.:

TaskValueSet 6,3,%c_dew_th%([Environment#Temperature],[Environment#Humidity])

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests