Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#1 Post by Hoozter9 » 16 Aug 2019, 23:46

Hello Community,

i am new to this Forum and i have little Problem with ESPEasy and Thingspeak. i hope i am in the right category if not plz move.

Problem situation:
I am trying to send the values from a BME280 and the value of the ADC wich in my case reads the 18650 Battery voltage to Thingspeak after deepsleep.
As long as the Wemos D1 mini is continuously on without deepsleep enabled, everything works fine and i get all values in my thingspeak channel.

As soon as i turn on deepsleep only the ADC Value is submitted to thingspeak. The same phenomenon is happening with MQTT (Openhab controller)
My Config:

Sleep settings:
Sleep awake time: 20 [sec]
Sleep time:60 [sec]

Sensor device config:
BME280 Interval set to: 10s IDX=1
ADC Interval set to: 10s IDX=4

Controller config:
MQTT: disabled

Thingspeak: enabled
Locate Controller: Use Hostname
Controller Hostname: api.thingspeak.com
Controller Port: 80
Minimum Send Interval: 15000 [ms] (also under Tools/Advanced/Message Interval)
Max Queue Depth: 10
Max Retries: 10
Full Queue Action: Delete oldest
Check Reply: Check Acknowledgement
Client Timeout: 500[ms]
ThingHTTP Name: -

Serial output after wakeup:

Code: Select all

INIT : Booting version: mega-20190607 (ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48
f3), LWIP: 2.0.3 PUYA support)                                                  
219 : INIT : Free RAM:24096                                                     
220 : INIT : Rebooted from deepsleep #48 - Restart Reason: Deep-Sleep Wake      
222 : FS   : Mounting...                                                        
248 : FS   : Mount successful, used 76555 bytes of 957314                       
673 : CRC  : program checksum       ...OK                                       
702 : CRC  : SecuritySettings CRC   ...OK                                       
808 : INIT : Free RAM:21280                                                     
810 : INIT : I2C                                                                
810 : INIT : SPI not enabled                                                    
866 : INFO : Plugins: 81 [Normal] [Testing] [Development] (ESP82xx Core 2_4_2, N
ONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 PUYA support)                              
870 : WIFI : Set WiFi to STA                                                    
902 : WIFI : Connecting MQTT attempt #0                                         
903 : IP   : Static IP : 192.168.2.129 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 19
2.168.2.143                                                                     
905 : WIFI : Not configured in Station Mode!!: MQTT                             
954 : ADC  : Analog value: 906 = 906.000                                        
1726 : BMx280 : Detected BME280                                                 
2268 : WD   : Uptime 0 ConnectFailures 0 FreeMem 17856 WiFiStatus 0             
4777 : WIFI : Connected! AP: MQTT (xx:xx:xx:xx:xx:xx) Ch: x Duration: 3765 ms   
4778 : IP   : Static IP : 192.168.2.129 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 1
92.168.2.143                                                                    
4779 : WIFI : Static IP: 192.168.2.129 (TestSensorKeller-100) GW: 192.168.2.1 SN
: 255.255.255.0   duration: 110 ms                                              
{ddœŸ|Œdà|
I have search hours over hours across the web to find someone who has the same or even similar problem, without succcess
Maybe i can get help here ?

Sorry for my bad English.
desperate greetings from Germany

Sebastian
Last edited by Hoozter9 on 17 Aug 2019, 17:52, edited 1 time in total.
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value is being send after Deepsleep [WemosD1mini]

#2 Post by ThomasB » 17 Aug 2019, 03:39

You're using Mega-20190607 released in June. A week ago TD-er updated Mega so that it flushes all pending data before going to sleep. I have no idea if his new update will help you, but perhaps it's worth trying.

The data flush fix is mentioned here:
viewtopic.php?f=6&t=6925

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value is being send after Deepsleep [WemosD1mini]

#3 Post by Hoozter9 » 17 Aug 2019, 12:34

Ahh that sounds very good ! As soon as i find the TIme i will give the new Version a try, but it sounds like that could be the solution.
I will give feeback in this thread as soon as i can.

thx and greets
Use as little as possible and as much as necessary.

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value is being send after Deepsleep [WemosD1mini]

#4 Post by Hoozter9 » 17 Aug 2019, 15:12

Ok i have just installed and testet the scenario with the newest release.
For MQTT it works fine but Thingspeak only gets the Value of the VCC. The values of the BME280 are still not send to Thingspeak after wakeup.
When i disable the VCC device and just leave the BME on, the three values are going correctly to thingspeak.
Use as little as possible and as much as necessary.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#5 Post by grovkillen » 17 Aug 2019, 21:14

You should probably use rules to combine the values to one send request. ThingSpeak only allow for one post per 15 seconds.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#6 Post by Hoozter9 » 17 Aug 2019, 22:29

I have done a quick crash course about how to create a rule and i hope i've got it right in my brain. :roll: I think it should look like this ?

Code: Select all

#Rule1
on System#Wake do
SendToHTTP api.thingspeak.com,80,/update.html?key=xxx&field1=[BME280#Temperature]&field2=[BME280#Humidity]&field3=[BME280#Pressure]&field4=[SysInfo#VCC]
endon

#Rule2
on MQTT#Connected do
Publish /TestSensorKeller/GET/BME280/Temperature,[BME280#Temperature]&/TestSensorKeller/GET/BME280/Humidity,[BME280#Humidity]&/TestSensorKeller/GET/BME280/Pressure,[BME280#Pressure]
endon
does this look ok ?

Edit: looks not ok, now the rule tasks are starting before WiFi connects an i locked me out of epseasy :?
should i iuse WiFi#Connected instead of System#Wake ?

Greets Sebastian
Use as little as possible and as much as necessary.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#7 Post by grovkillen » 18 Aug 2019, 00:52

Yes you would need to wait for the unit to have WiFi connection before trying a publish.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#8 Post by Hoozter9 » 18 Aug 2019, 02:10

Now i have created the rule for MQTT to publish on Connect which works fine

Code: Select all

On MQTT#Connected do 
 Publish /%sysname%/SET/IP,%ip%
 Publish /%sysname%/GET/BME280/Temperature,[BME280#Temperature]
endon
but the rule for the SendtoHTTP to thingspeak does not Work at all

Code: Select all

On WiFi#ChangedAccesspoint do 
  SendToHTTP api.thingspeak.com,80,/update?key=apikey&field1=[BME280#Temperature]
endon
The event triggers correct as you can see in the serial output, but nothing is send to thingspeak. I`ve tried it with the IP address and hostname, checked if my DNS lookup works, tried ,/update?api_key instead of /update?key , tried different events like WiFi#Connected etc,etc. nothing helps.

Code: Select all

INIT : Booting version: mega-20190817 (ESP82xx Core 2_5_2, NONOS SDK 2.2.1(cfd48
f3), LWIP: 2.1.2 PUYA support)
69 : INIT : Free RAM:33536
70 : INIT : Warm boot #84 Last Task: Background Task - Restart Reason: External
System
72 : FS   : Mounting...
78 : FS   : Mount successful, used 76555 bytes of 113201
479 : CRC  : program checksum       ...OK
496 : CRC  : SecuritySettings CRC   ...OK
517 : INIT : Free RAM:30392
518 : INIT : I2C
519 : INIT : SPI not enabled
546 : INFO : Plugins: 48 [Normal] (ESP82xx Core 2_5_2, NONOS SDK 2.2.1(cfd48f3),
 LWIP: 2.1.2 PUYA support)
548 : EVENT: System#Wake
682 : WIFI : Set WiFi to STA
715 : WIFI : Connecting MQTT attempt #0
717 : IP   : Static IP : 192.168.2.129 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 19
2.168.2.143
720 : WIFI : WiFi.status() = WL_DISCONNECTED  SSID: MQTT
736 : EVENT: System#Boot
1822 : BMx280 : Detected BME280
2412 : WD   : Uptime 0 ConnectFailures 0 FreeMem 26800 WiFiStatus 6
4664 : WIFI : Connected! AP: MQTT (macaddress) Ch: 9 Duration: 3761 ms
4666 : EVENT: WiFi#ChangedAccesspoint
4693 : ACT  : SendToHTTP api.thingspeak.com,80,/update?key=myapiwritekey&fiel
d1=25.35
4705 : Command: sendtohttp
4715 : WIFI : Static IP: 192.168.2.129 (TestSensorKeller-100) GW: 192.168.2.1 SN
: 255.255.255.0   duration: 235 ms
I'm desperate, i have tried it with and without a thingspeak controller. If i use the standard way over the controller and the Sensor intervall, then like before only one device is send to thingspeak.

but thank you in advance for the help at this point
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#9 Post by ThomasB » 18 Aug 2019, 03:25

The event triggers correct as you can see in the serial output, but nothing is send to thingspeak.
Your log shows that the SendToHTTP action was sent. Are you sure you're using the correct API key in the rule? The log shows the key is "myapiwritekey", which I won't assume was edited to protect your identity. Don't post your key in this public forum, just review your rule to ensure the correct 16 digit key is entered.

BTW, instead of:

Code: Select all

On WiFi#ChangedAccesspoint do 
I suggest using:

Code: Select all

On WiFi#Connected do 
Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#10 Post by Hoozter9 » 18 Aug 2019, 03:48

Hi Thomas

yes i checked the key several times and i am sure its the right one. I just put "myapiwritekey" in the code here, in my code in espeasy it is the right one because as you said nobody has to know my key ;-).
I have tried both

Code: Select all

On WiFi#ChangedAccesspoint do
and

Code: Select all

On WiFi#Connected do
and both did not work. I have tried it with the default Controller setup instead of using rules and the values are beeing send correctly.
DNS works, NTP time is set and correct, i even flashed espeasy again and I dont think its a rule syntax failure.
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#11 Post by ThomasB » 18 Aug 2019, 04:25

I have tried it with the default Controller setup instead of using rules and the values are beeing send correctly.
I reviewed the controller's source code and found that the syntax for the API's "key" keyword is different than what is in your rule. Instead of key it uses api_key.

Try this:

Code: Select all

SendToHTTP api.thingspeak.com,80,/update?api_key=YOUR_API_KEY_GOES_HERE&field1=[BME280#Temperature]
- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#12 Post by Hoozter9 » 18 Aug 2019, 09:48

Hi Thomas,

as i wrote before that is exactly what i have already tried without success. I have also tried

Code: Select all

SendToHTTP api.thingspeak.com,80,/update.html?api_key=YOUR_API_KEY_GOES_HERE&field1=[BME280#Temperature]
but i wont also wont work. The curious thing is that I dont get a Error message. neither in the Serial output nor in /Tools/Log
Use as little as possible and as much as necessary.

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#13 Post by Hoozter9 » 18 Aug 2019, 15:50

Finally got it working with ESP_Easy_mega-20190817_dev_ESP8266_4M and the following config:

With standard settings like NTP, fixed IP, Unit name & number
Only the MQTT Controller is configured, no Thingspeak Controller configured and Message interval leaved @ 100ms in all cases.

Devices:
BME280 and Analog input - internal are not sending to controllers, rather using rulessets
Rules:

Code: Select all

on WiFi#Connected do
 SendToHTTP api.thingspeak.com,80,/update?api_key=xxxxxxxxxxxxxxxx&field1=[BME280#Temperature]&field2=[BME280#Humidity]&field3=[BME280#Pressure]&field4=[VCC#Analog]
endon
and for MQTT

Code: Select all

On MQTT#Connected do
 Publish /TestSensorKeller/GET/BME280/Temperature,[BME280#Temperature]
 Publish /TestSensorKeller/GET/BME280/Humidity,[BME280#Humidity]
 Publish /TestSensorKeller/GET/BME280/Pressure,[BME280#Pressure]
 Publish /TestSensorKeller/GET/VCC/Analog,[VCC#Analog]
endon
Sleep settings:
awake 10s
sleep 1200s

the only problem i have now is that the Wemos crashes on first boot. When i hit the reset button everything works fine.
I think i will leave it in this state as i am Happy that it finally works now !
Thank you guys for your help and patience. i hope it keeps running now.
Use as little as possible and as much as necessary.

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

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#14 Post by TD-er » 18 Aug 2019, 17:34

Thingspeak does have a limit on the number of samples to be sent in an interval.
That's a threshold for free accounts.
You may also want to try to combine values using the dummy plugin and then only flush the dummy plugin. That's then only one message (unless Thingspeak demands a message per value, have to check that in the code)

So maybe Thingspeak is not that practical to run on batteries, if you really need to wait for a while to send the second value.

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#15 Post by Hoozter9 » 18 Aug 2019, 17:47

Ok seems not to work as expected.

i know that there is the limit of 1 Message every 15s what should not be a problem when the esp sleeps 1200s.
What i have observed now is that sometime the messages are going trough sometimes not. After serveral reboots its work sometimes and then for about 1-3 messages and sometimes only 1 message will be send and on next wakeup only MQTT works.

I think it must be a problem on the thingspeak side but its hard to comprehend as i had no feedback if and how thingspeak is replying on the sendToHTTP or not.
MQTT works with the rules but here is the problem that it send the messages 2 times (not always but sometimes). Once when the rule is triggered and once agian before esp goes to deepsleep.

greets Sebastian
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#16 Post by ThomasB » 18 Aug 2019, 18:03

Finally got it working with ESP_Easy_mega-20190817_dev_ESP8266_4M and the following config:
Good to hear you got it working.
Edit: Didn't see your followup message, sorry to read the bad news.
the only problem i have now is that the Wemos crashes on first boot. When i hit the reset button everything works fine.
Couple things to note:
1. There is a ESP8266 silicon bug that causes a boot hang on first boot after a fresh firmware flash. Not sure if this is what you observed, but good to know anyway.
2. Some GPIO pins are temporarily used during boot to configure the chip's boot mode. Using these GPIO in a project can prevent reliable booting if they are attached to external hardware that affects their logic state during the boot period. Boot state GPIO details here: https://www.letscontrolit.com/wiki/inde ... figuration

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#17 Post by Hoozter9 » 18 Aug 2019, 18:39

Hi Thomas,

the crash on Boot error seems to appear only on first boot after flash as you said and it did not happend again right now. so it seems to be the silicon bug.

The GPIO boot state thing should not affect me here because i only use 4/D2 and 5/D1 as I2C for the BME280 and A0 for the analog reading of Vcc and D0 connected to RST for Deepsleep.

I think i am going to try to write a code in ArduinoIDE in the hope it maybe works that way and use ESPEasy only for alltime on situations or in the case i only need to send data from one device/sensor.
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#18 Post by ThomasB » 18 Aug 2019, 19:59

I think i am going to try to write a code in ArduinoIDE in the hope it maybe works that way and use ESPEasy only for alltime on situations or in the case i only need to send data from one device/sensor.
That's the easy way out. :)

I'm curious, do the thingspeak / SendToHTTP rules work correctly with deepsleep disabled? That is to say, if you change the MQTT#connected to trigger by another event such as a timer, is everything perfect?
An example (without using sleep):

Code: Select all

on System#Boot do
   timerSet,1,60
endon

on Rules#Timer=1 do
 timerSet,1,60
 SendToHTTP api.thingspeak.com,80,/update?api_key=xxxxxxxxxxxxxxxx&field1=[BME280#Temperature]&field2=[BME280#Humidity]&field3=[BME280#Pressure]&field4=[VCC#Analog]
 Publish /TestSensorKeller/GET/BME280/Temperature,[BME280#Temperature]
 Publish /TestSensorKeller/GET/BME280/Humidity,[BME280#Humidity]
 Publish /TestSensorKeller/GET/BME280/Pressure,[BME280#Pressure]
 Publish /TestSensorKeller/GET/VCC/Analog,[VCC#Analog]
endon
If you can get it to work {when using rules to send the data with deep sleep disabled} then perhaps there's still a workaround for the sleep problem.

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#19 Post by Hoozter9 » 18 Aug 2019, 20:28

Just tested it with 30s interval

Code: Select all

on System#Boot do
   timerSet,1,30
endon

on Rules#Timer=1 do
 timerSet,1,30
 SendToHTTP api.thingspeak.com,80,/update?api_key=xxxxxxxxxxxxxxx&field1=[BME280#Temperature]&field2=[BME280#Humidity]&field3=[BME280#Pressure]&field4=[VCC#Analog]
 Publish /TestSensorKeller/GET/BME280/Temperature,[BME280#Temperature]
 Publish /TestSensorKeller/GET/BME280/Humidity,[BME280#Humidity]
 Publish /TestSensorKeller/GET/BME280/Pressure,[BME280#Pressure]
 Publish /TestSensorKeller/GET/VCC/Analog,[VCC#Analog]
endon
every MQTT message gets through but thingspeak only recieved a few

Code: Select all

created_at,entry_id,field1,field2,field3,field4
2019-08-18 20:16:17 +0200,1,,,,
2019-08-18 20:17:30 +0200,2,23.99,60.54,1009.19,3.97
2019-08-18 20:18:01 +0200,3,23.99,60.54,1009.19,3.97
2019-08-18 20:20:05 +0200,4,23.99,60.54,1009.19,3.97
2019-08-18 20:20:36 +0200,5,23.99,60.54,1009.19,3.97
2019-08-18 20:21:38 +0200,6,23.99,60.54,1009.19,3.97
from the last datapoint @ 20:21:38 till now complete silence but MQTT works fine.

Send to Thingspeak in 30s interval over Controller:

Code: Select all

created_at,entry_id,field1
2019-08-18 20:29:38 +0200,1,23.64
2019-08-18 20:30:11 +0200,2,23.57
2019-08-18 20:30:28 +0200,3,23.57
2019-08-18 20:31:00 +0200,4,23.59
2019-08-18 20:31:50 +0200,5,23.58
2019-08-18 20:32:07 +0200,6,23.57
2019-08-18 20:32:56 +0200,7,23.61
2019-08-18 20:33:44 +0200,8,23.60
2019-08-18 20:34:14 +0200,9,23.64
2019-08-18 20:34:29 +0200,10,23.66
2019-08-18 20:34:52 +0200,11,23.68
2019-08-18 20:35:25 +0200,12,23.68
2019-08-18 20:35:58 +0200,13,23.72
2019-08-18 20:36:31 +0200,14,23.72
Apart from the interval lag at the first 3-5 values what i think could be the RTC? it work fine over the controller.
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#20 Post by ThomasB » 18 Aug 2019, 20:49

every MQTT message gets through but thingspeak only recieved a few
That's a interesting result. At the moment I don't have any brilliant ideas to offer.

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#21 Post by Hoozter9 » 18 Aug 2019, 21:23

The only idea i have for now ist that something with the sendToHTTP command over rules went wrong as it works correct over controller. To get it quick together:

Using rules:
1.sendToHTTP to thingspeak over rules works for a short time but skips some sends, than crashes/freezes with and without deepsleep. Sometimes nothing happens after reboot.
2.MQTT Publish over rules works but sends twice sometimes (at inital trigger and befor going to sleep).

Using Controller
MQTT works fine, no double sends.
Thingspeak works fine but with some interval lag at the first few datapoints, interval is leveling in after around 10 datapoints send. (Maybe system load problem or RTC?)

That`s all i got for now

I have startet a few weeks ago with that microcontroller stuff and even it makes me some headache, its a lot fun. Especially with that great community here ;-)

greets Sebastian
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#22 Post by ThomasB » 18 Aug 2019, 22:53

The SendToHTTP rule is sending four field values, whereas the controller is only sending one. Maybe this is a clue to something important.

It would be interesting to see what would happen if you change the SendToHTTP to this:

Code: Select all

SendToHTTP api.thingspeak.com,80,/update?api_key=xxxxxxxxxxxxxxx&field=[BME280#Temperature]
- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#23 Post by Hoozter9 » 18 Aug 2019, 23:39

No change in behavior as i expected, its still sometimes sending sometimes not and stops working after n messages. The the Controller does also send three values in one message to thingspeak where they arrive at exactly the same time. When i use the rules with the four Values, all four values arrive at the same time in thingspeak if they arrive :-D When i use the controller for two devices like my BME280 and the ADC it splitts it in two messages 1 from BME with 3 values and after the message delay of 15000ms the second single value in a new message from ADC which makes sense as they come from 2 devices queued one after the other because of the set message delay i guess. According to thingspeak rules its allowed to send a message with 8 values every 15s.
A message is defined as a write of up to 8 fields of data to a ThingSpeak channel. For example, a channel representing a weather station could include the following 8 fields of data: temperature, humidity, barometric pressure, wind speed, wind direction, rainfall, battery level, and light level. Each message cannot exceed 3000 bytes.
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#24 Post by ThomasB » 19 Aug 2019, 00:50

Oh my, it's an unusual problem.

From what I see in the code, it appears thingspeak gets the same API message with a controller or rule. But they have slightly different setups during communication.

Some notable differences I found during a quick review:
The sendtoHTTP timeout is fixed to 1000mS. The controller plugin allows the user to choose (Client Timeout entry).
The sendtoHTTP does not check the reply from the host. The controller plugin allows the user to choose (Check Reply entry). Maybe if you choose Ignore Ack in the controller the problem will appear?

I don't have any magic beans to solve this problem. It seems to me that it will require a kindhearted developer to investigate. I suggest you report the issue in github.

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#25 Post by Hoozter9 » 19 Aug 2019, 13:10

That sendtoHTTP timeout is fixed to 1000mS and ACK settings should not matter in this case because right now i have set it to 500ms and Check Reply is set to Ignore acknowledgement in the controller what works fine. In the actual testrun over night not one message was lost but that all withoutout deepsleep. As soon as i delete the Controller and trying to use rules instead i got the old poblem.

How do i address this problem on github? I only know how to download stuff there :D :?
Use as little as possible and as much as necessary.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#26 Post by ThomasB » 19 Aug 2019, 17:15

How do i address this problem on github?
Go to https://github.com/letscontrolit/ESPEasy/issues and click "New Issue" button.

EDIT: I checked the issue tracker and I think I found your problem. Please see this reported issue from Jan 2019:
https://github.com/letscontrolit/ESPEasy/issues/2273
BTW, I have reported your issue in the existing issue ticket.

TLDR: ThingSpeak's communication protocol changed Feb 2019. It now requires MustCheckReply=True, otherwise the data may not be received correctly. sendtoHTTP does not observe this requirement.

- Thomas

Hoozter9
Normal user
Posts: 15
Joined: 16 Aug 2019, 23:07
Location: Germany

Re: Only 1 Value/Sensor is being send after Deepsleep [WemosD1mini]

#27 Post by Hoozter9 » 19 Aug 2019, 17:46

Ahh thank you a lot. If the MustCheckReply=false issue in sendToHTTP got fixed i am going to test it again. In the meantime i am going to learn ArduinoIDE and try it that way. Another way i am going to test is InfulxDB and Grafana but there i have figure out how to get the Values from my Broker into influxDB but thats a other construction side :-D

But as i said before, thank you guys a lot for trying to solve the problem. I hope it was not too stressfull to work with noob like me ;)

Greets Sebastian
Use as little as possible and as much as necessary.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 31 guests