Hi all! I’m new to webCoRE and trying to make my way through the immense possibilities it has. One of such things is that I am trying to write a piston to create a global variable that will simply set the time of day as either morning, afternoon, evening, or night.
1) Give a description of the problem
Variable always reports as night
2) What is the expected behaviour?
Variable will change based on the time of the day.
3) What is happening/not happening?
Variable is not changing
**4) Post a Green Snapshot of the piston
5) Attach logs after turning logging level to Full
2/28/2020, 2:33:50 PM +336ms
+1ms ╔Received event [Home].time = 1582929231189 with a delay of -853ms
+89ms ║RunTime Analysis CS > 29ms > PS > 5ms > PE > 55ms > CE
+92ms ║Runtime (40312 bytes) successfully initialized in 5ms (v0.3.110.20191009) (89ms)
+93ms ║╔Execution stage started
+138ms ║║Comparison (datetime) 1582929230438 is_between (datetime) 1582901460000 … (datetime) 1582920000000 = false (5ms)
+141ms ║║Condition #3 evaluated false (38ms)
+142ms ║║Condition group #2 evaluated false (state did not change) (41ms)
+156ms ║║Comparison (datetime) 1582929230483 is_between (datetime) 1582920000000 … (datetime) 1582941060000 = true (4ms)
+158ms ║║Condition #7 evaluated true (13ms)
+159ms ║║Condition group #6 evaluated true (state did not change) (14ms)
+162ms ║║Cancelling statement #8’s schedules…
+167ms ║║Executed virtual command setVariable (1ms)
+184ms ║║Calculating (string) Fri, Feb 28 2020 @ 7:51:00 PM PST + (string) >> (string) Fri, Feb 28 2020 @ 7:51:00 PM PST
+191ms ║║Comparison (datetime) 1582929230509 is_between (datetime) 1582941060000 … (string) Fri, Feb 28 2020 @ 7:51:00 PM PST = false (5ms)
+194ms ║║Condition #11 evaluated false (21ms)
+195ms ║║Condition group #10 evaluated false (state did not change) (24ms)
+209ms ║║Calculating (string) Fri, Feb 28 2020 @ 7:51:00 PM PST + (string) >> (string) Fri, Feb 28 2020 @ 7:51:00 PM PST
+219ms ║║Comparison (datetime) 1582929230536 is_between (string) Fri, Feb 28 2020 @ 7:51:00 PM PST … (datetime) 1582901460000 = true (6ms)
+221ms ║║Condition #15 evaluated true (22ms)
+223ms ║║Condition group #14 evaluated true (state did not change) (25ms)
+226ms ║║Cancelling statement #16’s schedules…
+231ms ║║Executed virtual command setVariable (2ms)
+236ms ║╚Execution stage complete. (144ms)
+238ms ║Setting up scheduled job for Fri, Feb 28 2020 @ 2:48:51 PM PST (in 900.616s)
+247ms ╚Event processed successfully (247ms)
It seems it has something to do with the way it interprets AM and PM, but I don’t know that format the time/date is in when it’s doing the comparison. Do I need to somehow “translate” that @now time to something else first then compare?
Also, as a tangent to this, when I have a piston running in a loop like this, I know I want to be conservative with resources, but I assume these pistons execute remotely and not on the hub itself, correct?
Thanks in advance!!