GET WebRequest no longer works

variables

#1

1) Give a description of the problem
Hello!
I had this nice project where every 3 hours I run this piston, which makes a GET Web Request to an http api which responds with the CAQI Index (air-pollution index), store it in a variable.
Based on that value, I then used to turn on & off my Air Purifier.
The piston worked just fine until it didn’t…which I find it very strange

2) What is the expected behaviour?
Make Web Request-> store Index decimal value into a variable

3) What is happening/not happening?
After the piston makes the webrequest, value of CAQI index it’s stored in the variable, but just after that a “timer” appears from nowhere in my piston and I don’t understand from where ( “Setting up scheduled job for” - see log bellow). After that timer runs out, my variable it’s auto set to zero and all further task are canceled (meaning that if my air purifier would turn on, the timer until it turns off are canceled, therefore it will run non-stop).

By the way…for the sake of simplicity, I’ve removed the Air Purifier on off tasks from piston…

4) Post a Green Snapshot of the piston![image|45x37]


5) Attach logs after turning logging level to Full
0/14/2021, 4:04:30 PM +94ms
+1ms ╔Received event [Acăsică].time = 1634216671352 with a delay of -1258ms
+54ms ║RunTime Analysis CS > 21ms > PS > 6ms > PE > 27ms > CE
+56ms ║Runtime (41504 bytes) successfully initialized in 6ms (v0.3.113.20210203) (55ms)
+57ms ║╔Execution stage started
+69ms ║║Executed virtual command log (1ms)
+76ms ║║Executed virtual command setVariable (3ms)
+78ms ║╚Execution stage complete. (21ms)
+79ms ║Setting up scheduled job for Thu, Oct 14 2021 @ 4:24:07 PM EEST (in 1177s)
+86ms ╚Event processed successfully (86ms)
10/14/2021, 4:04:07 PM +460ms
+0ms ╔Received event [Acăsică].wc_async_reply = httpRequest with a delay of 1ms
+10066ms ║RunTime Analysis CS > 20ms > PS > 10019ms > PE > 26ms > CE
+10067ms ║Piston waited at a semaphore for 10014ms
+10070ms ║Runtime (41591 bytes) successfully initialized in 10019ms (v0.3.113.20210203) (10068ms)
+10071ms ║╔Execution stage started
+10071ms ║╚Execution stage complete. (1ms)
+10073ms ║
Setting up scheduled job for Thu, Oct 14 2021 @ 4:04:31 PM EEST (in 13s), with 1 more job pending**
+10082ms ╚Event processed successfully (10082ms)


#2

Can you call the URL from a browser? I think you get the timer when the external server hasn’t responded to the request.


#3

Yes, it works from browser.
It works as well from piston:

But after few seconds, that timer appears, and the variable it’s reset to 0 …don’t know why

image


#4

Did you recently update webcore? the latest version on ST does not work. Something changed with the web requests. Haven’s seen a fix yet but you need to regress to an older version for it to work again.

Look at this post:


#5

Do you have the logs from before those in the first post? I don’t think they are full logs so it isn’t obvious what is happening, but it seems very odd that the wc_async_reply should hit a semaphore, and it isn’t being processed like an async reply should be. The timer is probably the timeout but that shouldn’t have anything to do, but instead it looks more like the wc_async_reply should do.


#6

Ok. Done! Cleared the logs and test it again:

10/15/2021, 9:54:54 AM +92ms
+1ms ╔Received event [Acăsică].time = 1634280895693 with a delay of -1601ms
+10180ms ║RunTime Analysis CS > 23ms > PS > 10138ms > PE > 18ms > CE
+10180ms ║Piston waited at a semaphore for 10132ms
+10183ms ║Runtime (41590 bytes) successfully initialized in 10138ms (v0.3.113.20210203) (10180ms)
+10183ms ║╔Execution stage started
+10184ms ║╚Execution stage complete. (1ms)
+10185ms ╚Event processed successfully (10185ms)
10/15/2021, 9:54:54 AM +95ms
+0ms ╔Received event [Acăsică].time = 1634280895693 with a delay of -1599ms
+42ms ║RunTime Analysis CS > 19ms > PS > 6ms > PE > 17ms > CE
+44ms ║Runtime (41509 bytes) successfully initialized in 6ms (v0.3.113.20210203) (43ms)
+45ms ║╔Execution stage started
+56ms ║║Executed virtual command log (1ms)
+61ms ║║Executed virtual command setVariable (2ms)
+63ms ║╚Execution stage complete. (19ms)
+64ms ╚Event processed successfully (65ms)
10/15/2021, 9:54:31 AM +779ms
+0ms ╔Received event [Acăsică].wc_async_reply = httpRequest with a delay of 0ms
+37ms ║RunTime Analysis CS > 11ms > PS > 8ms > PE > 17ms > CE
+39ms ║Runtime (41513 bytes) successfully initialized in 8ms (v0.3.113.20210203) (38ms)
+40ms ║╔Execution stage started
+49ms ║║[52.22]
+50ms ║║Executed virtual command log (1ms)
+55ms ║║Executed virtual command setVariable (2ms)
+57ms ║╚Execution stage complete. (17ms)
+58ms ╚Event processed successfully (58ms)
10/15/2021, 9:54:31 AM +562ms
+0ms ╔Received event [Acăsică].test = 1634280871558 with a delay of 3ms
+41ms ║RunTime Analysis CS > 19ms > PS > 6ms > PE > 17ms > CE
+44ms ║Runtime (41505 bytes) successfully initialized in 6ms (v0.3.113.20210203) (42ms)
+46ms ║╔Execution stage started
+51ms ║║Cancelling statement #1’s schedules…
+62ms ║║Sending external web request to: airapi.airly.eu/v2/measurements/installation?installationId=6088
+125ms ║║Executed virtual command httpRequest (63ms)
+129ms ║║Requesting a wake up for Fri, Oct 15 2021 @ 9:54:55 AM EEST (in 24.0s)
+138ms ║║Comparison (decimal) 55.12 is_greater_than (integer) 15 = true (2ms)
+140ms ║║Cancelling condition #6’s schedules…
+141ms ║║Condition #6 evaluated true (7ms)
+143ms ║║Cancelling condition #5’s schedules…
+144ms ║║Condition group #5 evaluated true (state changed) (9ms)
+146ms ║║Cancelling statement #7’s schedules…
+154ms ║║Executed virtual command setVariable (3ms)
+159ms ║║Executed virtual command setVariable (3ms)
+166ms ║║Comparison (boolean) true changes_to (boolean) true = false (0ms)
+168ms ║║Condition #11 evaluated false (5ms)
+169ms ║║Condition group #10 evaluated false (state did not change) (7ms)
+195ms ║╚Execution stage complete. (149ms)
+197ms ║Setting up scheduled job for Fri, Oct 15 2021 @ 9:54:55 AM EEST (in 23s)
+204ms ╚Event processed successfully (204ms)


#7

I don’t have webCoRE installed to check, but that looks wrong. I am expecting:

Test
  make web request
  set the timer for the timeout
  exit

Async Reply
  continue piston from line after web request

Timer
  do nothing

What the logs seem to show are:

Test
  make web request
  note the need for a timeout timer
  plough on with the rest of the piston
  set the timeout timer

Async Reply
  continue on after web request
  lose interest after a couple of lines

Timer
  continue on after web request
  lost interest after a couple of lines

Timer (another one, delayed by ten seconds because there were two at the same time)
  do nothing

Maybe I have forgotten how it works.