Page 1 of 1

ThingSpeak upate delay blocks system

Posted: 28 Oct 2017, 10:12
by s0170071
Hi all,

I have a power meter sensor (MT681 EHZ, 3 values) reading every second. The result is also displayed in a webpage, also every second. That displays a real time power consumption in my home.
In order to push the values to ThingSpeak, I need to set the MessageDelay to 15 seconds. Its a ThingSpeak requirement.
When sending to ThingSpeak starts, the EasyESP pauses 15 seconds between the GET requests of each value- as it should.
Sadly, it also pauses everything else but background tasks (OTA and UDP) too. My sensor and the webpage do not get updated.


Q: is that really the intended behaviour or should'n we rather have a non blocking message queue ?

Q2: I did some more digging in the code. Seems like using thingspeak, each sensor transmits all vallues in one http request. The 15000 ms Message delay is therefore uselsee if I do not poll the sensor more often than 15s.
Is this setting then correct?
Device delay: 600s. ( Sensor gets polled every 10 minutes)
Message delay 0,
Send to controller (ThingSpeak). yes

Re: ThingSpeak upate delay blocks system

Posted: 29 Oct 2017, 15:54
by rayE
I noticed this odd behavior as well. My fix was to NOT use a thingspeak controller. This is what i did.
1. sore the energy data in a quad dummy device.
2. Send the data with a SendToHTTP command. This can be set up in a rule that is triggered by a timer.

If you want ill post the rules i use for my setup tomorrow? Just ask

Regards
Ray

Re: ThingSpeak upate delay blocks system

Posted: 30 Oct 2017, 13:19
by s0170071
That would be nice. Thanks.

Re: ThingSpeak upate delay blocks system

Posted: 02 Nov 2017, 08:45
by rayE
Sorry for the delay.

My rules setup. I run these by sending event, SerialSend through the serial port, i guess you can run from a timer instead.

Code: Select all

//----------------------------------------------------------------------------------------------------------------------
on SerialSend do
    SendToHTTP 184.106.153.149,80,/update.html?key=FIXDUF4VI6PUC8P0&field1=[FIELDS1-4#TotalL]&field2=[FIELDS1-4#FlowRate]&field3=[FIELDS1-4#TxBatteryLevel]&field4=[FIELDS1-4#NoFlowPeriods]&field5=[FIELDS5-8#ChargeStatus]&field6=[FIELDS5-8#RxWiFiSignal]&field7=[FIELDS5-8#CH7]&field8=[FIELDS5-8#CH8] 
    event,Acknowledge
endon
//----------------------------------------------------------------------------------------------------------------------

on Acknowledge do
    Pulse,12,1,100                                     //Turn LED ON for a period 
    Delay 100 
    Pulse,12,1,100                                     //Turn LED ON for a period 
    Delay 100 
    Pulse,12,1,100                                     //Turn LED ON for a period 
    Delay 100 
    Pulse,12,1,100                                     //Turn LED ON for a period 
    Delay 100 
   Pulse,12,1,100                                     //Turn LED ON for a period 
endon
//----------------------------------------------------------------------------------------------------------------------
My devices (only FIELDS1-4 shown) Notice that the dummy devices are disabled BUT you can still read and write to them. Disabling them stopped them from running every x seconds.
dev1.gif
dev1.gif (44.95 KiB) Viewed 5015 times
dev1.gif
dev1.gif (44.95 KiB) Viewed 5015 times

Re: ThingSpeak upate delay blocks system

Posted: 02 Nov 2017, 08:49
by rayE
OOps, correction.
dev2.gif
dev2.gif (41.2 KiB) Viewed 5014 times

Re: ThingSpeak upate delay blocks system

Posted: 07 Nov 2017, 07:51
by s0170071
Thanks for the info. There is - at least it seems - a simpler solution for me.

I want to post to thingspeak:
- one quad sensor (humidity / temperture / absolute humidity / ventilation)
- system info uptime
- system info free memory

Limitation on thingspeak is that you only send a message every 15 seconds.

I update the sensor values every 10 minutes (sensor delay). The thingspeak controller collects all four values from the quad sensor and sends them in one request. So no trouble here.
When I update the system info variables I simply choose 10 Minutes + 16 seconds and 10 minutes and 32 seconds. The occasions on which I run into the 15 seconds limitation are very rare then. It only happens every 6 hours for a single value.

If you set all sensor delays to the same value, only the first thingspeak request goes through- every time.