Hey All,
Thank you in advance for any help anyone can provide. I am new to Webcore and the ST community, and have been spending a lot of time researching on this forum, but haven’t yet been able to solve the issue I am having, nor find complete information on a few of my questions. My brain works a bit like a computer, and if I become hung up on something (even if its basic ) I can’t move on. ha.
Anyways, here are my questions/issue I am running into:
Questions:
-
From my research it seems WebCore uses a number of programming languages. What I am hoping to find is more information on how the different functions work, their syntax, etc. Is there a comprehensive list anywhere? I know the Wiki has some information, but was hoping to dig more in depth. Are these functions from a library that is commonly used in a programming language, i.e. Java, Shell Script, Groovy, etc, where I can read more into the functions? I am an EE, but don’t have a lot of in depth programming knowledge with the above languages, but can spend the time to learn it if I have a general direction to go in.
-
I am looking for more information on how to use the time() function, and the related datetime variables $now, $minute, $second, etc.
-
Is there a good function to use for a timer (see below)?
Issue:
I am trying to do something pretty simple, which is when the virtual status changes from Away to Home, to start a timer. If while this timer has not expired and I open my door, the contact sensor will trigger enabling some lights. The problem I am having here is implementing a timer, the rest I can do. Here is some test code I generated to try and debug the issue I am having.
When running this routine, I come across this issue (bolded below):
1/4/2018, 11:42:31 AM +507ms
+0ms ╔Received event [Home].routineExecuted = acf79887-7969-4a6f-b97b-82b8c92afdb7 with a delay of 38ms
+73ms ║RunTime Analysis CS > 10ms > PS > 42ms > PE > 22ms > CE
+75ms ║Runtime (38190 bytes) successfully initialized in 42ms (v0.2.100.20171211) (74ms)
+76ms ║╔Execution stage started
+83ms ║║Comparison (string) :79a59b304b237699dd658e01dfd4bee9: executes (string) :79a59b304b237699dd658e01dfd4bee9: = true (2ms)
+84ms ║║Cancelling condition #2’s schedules…
+85ms ║║Condition #2 evaluated true (4ms)
+85ms ║║Cancelling condition #1’s schedules…
+86ms ║║Condition group #1 evaluated true (state changed) (6ms)
+88ms ║║Cancelling statement #3’s schedules…
+93ms ║║Executed virtual command setVariable (1ms)
+100ms ║║Calculating (datetime) 1515094951597 + (integer) 1000 >> (datetime) 1515094952597
+103ms ║║Comparison (datetime) 1515094951603 is_between (datetime) 1515094951597 … (datetime) 1515094952597 = false (2ms)
+104ms ║║Condition #12 evaluated false (9ms)
+105ms ║║Condition group #6 evaluated false (state did not change) (10ms)
+107ms ║╚Execution stage complete. (31ms)
+108ms ╚Event processed successfully (108ms)
This is probably not the best way to generate a timer, or add time to an epoch time, but I honestly don’t know how else to do it. Any guidance here is appreciated. The real issue is the comparison false when …1603 is clearly between …1597 and …2597, so this method wont work. Any and all help is appreciated here!! Thanks!!!