webCoRE for Hubitat Updates

The tricky part of sunrise and sunset, is they change 'at midnight'.

So if you are trying to get a future one, if it has not happened yet today, you get a future one, otherwise you have the past one, which webcore could push ahead by 24 hours, which is not exactly right.

So what to do?

if you schedule these (sunrise or sunsets) at a top level (not indented level) of a piston, you could add at the end of your piston

if time happens daily at 3:00:00 AM
then (nothing listed)

ie all you are doing is forcing the piston to run at 3:00, where it will use today's values for sunrise, sunset for future runs (so always accurate).

You could have chosen 12:01:00 AM, or 12:30, etc. You may not want to use 1 or 2 AM due to daylight savings times adjustments, but likely even those work.

Here is an example of my use (my mode controller)

My problem is that webcore for me doesnt seem to update those variables correctly. $sunrise and $sunset both are dated for yesterday (2/20 not 2/21) and $nextSunrise and $nextSunset are dated for tomorrow (2/22). Seems to not update for today's date but lag a day.

That's happened to me also. I saw it once a few months ago and never since. You can try rebooting your hub and see if it goes away. I think that's what fixed it for me.

Out of curiosity, are you on the latest hub platform?

Yes. C7 on latest update. Rebooting seemed to do the trick :+1:

All these years and never noticed that line, thanks.
Stuck a 500ms delay in there so I'll see if the cameras are more consistant now.

I never knew that was available either. where can I find the command execution delay setting?

In your piston edit click on the title line (#2) and then open the * at the bottom right.

1 Like

ah great thanks I see it

Experiencing a strange issue with making an HTTP POST request and parsing the JSON returned. My piston is infrequently executed. The last time I noticed it working was Feb 6. Since then I've updated the HE platform to the latest and I've also upgraded Webcore to the latest.

I had been setting a variable to $response.url, where the response was valid JSON. Logging shows I'm now getting Error retrieving JSON data part null groovy.json.JsonException. Further debugging I decided to dump the entire response into a string and what I found was the string is now base64 encoded. If I paste the string contents into an online decoder I get my expected JSON.

So I'm not sure where the change came from but I do see some recent commits in github related to HTTP. Then again, if the API I'm hitting has changed and is the culprit, can anyone suggest how to decode this base64 response? There doesn't appear to be a function I can use in webcore.

Edit: I reverted to webcore Jan 22 version and I'm back in business. If this is a bug (and not working as intended) who would I report it to? I had previously tried reverting to Jan 31 version and it didn't work.

What content type are you requesting in http post request?

We can take this to private message if you like, but need to see the entire http request, headers, etc.

The POST has Request body type set to JSON. I ran the request with Postman to capture the headers. The response comes back with Content-Type "text/json;charset=utf-8". I can see in some of the recent diffs that modifications have been made around base64 decoding. Since this began working once I rolled back I'm guessing that the server is indeed sending the response encoded but we're not decoding it. Happy to move to PM to help with this. Thanks!

Just wanted to close the loop here. Thanks to @nh.schottfam who patched this and I've verified the fix (at least in my environment.)

@nh.schottfam
This might not be anything but I get no device data in the status variables for my Envisalink devices.
I doubt they are any different that any other device; all my other pistons work.
Just fishing for fixes, I'm lost on this one. Maybe it's the unsupported Envisalink app :frowning:

@nh.schottfam
Further to my last post after more testing it seems like it's a WC issue? :roll_eyes: Maybe?
I have looked at the logs and the Envisalin app responds in less than a second and the EVL3 card responds the same when looking at the local web service.
I have put delays in the piston to wait for the status (to update) after the event, which arrives instantly, but even though all the sources are pumping out data the status variables never change.
Here's an HE log and the piston that worked for years on the ST version.

app:1202021-03-04 12:07:03.998 debugEnvisalink Integration: Connection Driver: clearAllZones: Completed

app:1202021-03-04 12:07:03.736 debugEnvisalink Integration: Connection Driver: clearAllZones: called...

app:1202021-03-04 12:07:03.514 debugEnvisalink Integration: Connection Driver: partitionReady

app:1202021-03-04 12:07:03.270 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:07:03.050 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [6501CC]

app:1202021-03-04 12:07:02.806 debugEnvisalink Integration: Connection Driver: Partition Ready LED On

app:1202021-03-04 12:07:02.586 debugEnvisalink Integration: Connection Driver: 10010001

app:1202021-03-04 12:07:02.369 debugEnvisalink Integration: Connection Driver: keypadLedState 91

app:1202021-03-04 12:07:02.128 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:07:01.910 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [5109100]

app:1202021-03-04 12:07:01.649 debugEnvisalink Integration: Connection Driver: Contact Closed

app:1202021-03-04 12:07:01.429 debugEnvisalink Integration: Connection Driver: DSC Kitchen Nook Right

app:1202021-03-04 12:07:01.183 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:07:00.960 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [61001129]

app:1202021-03-04 12:06:59.016 debugEnvisalink Integration: Connection Driver: partitionNotReady

app:1202021-03-04 12:06:58.795 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:06:58.559 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [6511CD]

app:1202021-03-04 12:06:58.332 debugEnvisalink Integration: Connection Driver: Partition Ready LED Off

app:1202021-03-04 12:06:58.115 debugEnvisalink Integration: Connection Driver: 10010000

app:1202021-03-04 12:06:57.874 debugEnvisalink Integration: Connection Driver: keypadLedState 90

app:1202021-03-04 12:06:57.652 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:06:57.414 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [51090FF]

app:1202021-03-04 12:06:57.177 debugEnvisalink Integration: Connection Driver: Contact 011 Open

app:1202021-03-04 12:06:56.938 debugEnvisalink Integration: Connection Driver: DSC Kitchen Nook Right

app:1202021-03-04 12:06:56.715 debugEnvisalink Integration: Connection Driver: Panel Type: 0

app:1202021-03-04 12:06:56.475 debugEnvisalink Integration: Connection Driver: Parsing Incoming message: [60901131]

I don't see any webcore logs in this. I cannot comment on that device handler, but if you have some webcore information, can have a look.

This is what happens when I open and close a window.

3/4/2021, 12:41:18 PM +110ms
+5ms ╔Received event [Home].time = 1614890478022 with a delay of 88ms,canQueue: true, calledMyself: false
+35ms ║RunTime initialize > 34 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 32 6 28)
+38ms ║Runtime (13544 bytes) successfully initialized in 1ms (v0.3.113.20210211_HE)
+41ms ║╔Execution stage started
+48ms ║║ACTIVE
+50ms ║║Executed virtual command log (2ms)
+58ms ║║Ready
+60ms ║║Executed virtual command log (1ms)
+70ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+72ms ║║Comparison (enum) closed is (string) closed = true (0ms)
+74ms ║║Condition #8 evaluated true (11ms)
+79ms ║║Comparison (string) Ready is (string) Ready = true (1ms)
+80ms ║║Condition #9 evaluated true (4ms)
+81ms ║║Condition group #35 evaluated true (state did not change) (7ms)
+82ms ║║Condition group #2 evaluated true (state did not change) (20ms)
+84ms ║║Cancelling statement #14's schedules...
+87ms ║║Executed virtual command setState (0ms)
+91ms ║║Executed virtual command setVariable (1ms)
+95ms ║╚Execution stage complete. (54ms)
+98ms ╚Event processed successfully (95ms)
3/4/2021, 12:41:12 PM +967ms
+3ms ╔Received event [DSC Kitchen Nook Right].contact = closed with a delay of 53ms,canQueue: true, calledMyself: false
+28ms ║RunTime initialize > 27 LockT > 2ms > rtDT > 1ms > pistonT > 1ms (first state access 24 5 22)
+32ms ║Runtime (13543 bytes) successfully initialized in 1ms (v0.3.113.20210211_HE)
+33ms ║╔Execution stage started
+36ms ║║Cancelling statement #29's schedules...
+41ms ║║Executed virtual command setVariable (1ms)
+44ms ║║Executed virtual command setState (0ms)
+48ms ║║Executed virtual command setVariable (1ms)
+52ms ║║Executed virtual command wait (0ms)
+54ms ║║Requesting a wake up for Thu, Mar 4 2021 @ 12:41:18 PM PST (in 5000ms)
+60ms ║╚Execution stage complete. (26ms)
+75ms ║Setting up scheduled job for Thu, Mar 4 2021 @ 12:41:18 PM PST (in 5023ms)
+78ms ╚Event processed successfully (76ms)
3/4/2021, 12:41:07 PM +568ms
+6ms ╔Received event [Home].time = 1614890467488 with a delay of 80ms,canQueue: true, calledMyself: false
+28ms ║RunTime initialize > 27 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 25 7 20)
+31ms ║Runtime (13532 bytes) successfully initialized in 1ms (v0.3.113.20210211_HE)
+34ms ║╔Execution stage started
+41ms ║║ACTIVE
+43ms ║║Executed virtual command log (2ms)
+48ms ║║Ready
+49ms ║║Executed virtual command log (2ms)
+65ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+66ms ║║Comparison (enum) closed is (string) closed = true (0ms)
+68ms ║║Condition #8 evaluated true (16ms)
+72ms ║║Comparison (string) Ready is (string) Ready = true (1ms)
+74ms ║║Condition #9 evaluated true (4ms)
+75ms ║║Condition group #35 evaluated true (state did not change) (7ms)
+76ms ║║Condition group #2 evaluated true (state did not change) (25ms)
+78ms ║║Cancelling statement #14's schedules...
+81ms ║║Executed virtual command setState (0ms)
+85ms ║║Executed virtual command setVariable (1ms)
+89ms ║╚Execution stage complete. (55ms)
+91ms ╚Event processed successfully (90ms)
3/4/2021, 12:41:02 PM +434ms
+3ms ╔Received event [DSC Kitchen Nook Right].contact = open with a delay of 34ms,canQueue: true, calledMyself: false
+24ms ║RunTime initialize > 23 LockT > 1ms > rtDT > 3ms > pistonT > 2ms (first state access 19 4 19)
+31ms ║Runtime (13493 bytes) successfully initialized in 3ms (v0.3.113.20210211_HE)
+32ms ║╔Execution stage started
+35ms ║║Cancelling statement #29's schedules...
+40ms ║║Executed virtual command setVariable (1ms)
+43ms ║║Executed virtual command setState (0ms)
+48ms ║║Executed virtual command setVariable (2ms)
+51ms ║║Executed virtual command wait (0ms)
+54ms ║║Requesting a wake up for Thu, Mar 4 2021 @ 12:41:07 PM PST (in 5000ms)
+60ms ║╚Execution stage complete. (28ms)
+113ms ║Setting up scheduled job for Thu, Mar 4 2021 @ 12:41:07 PM PST (in 5021ms)
+115ms ╚Event processed successfully (113ms)

HE Logs

app:322021-03-04 12:41:18.258 debugReleased Lock and exiting

app:322021-03-04 12:41:18.170 info ░║║ Ready

app:322021-03-04 12:41:18.160 info ░║║ ACTIVE

app:322021-03-04 12:41:13.107 debugReleased Lock and exiting

app:322021-03-04 12:41:07.709 debugReleased Lock and exiting

app:322021-03-04 12:41:07.617 info ░║║ Ready

app:322021-03-04 12:41:07.611 info ░║║ ACTIVE

app:322021-03-04 12:41:02.610 debugReleased Lock and exiting

please post a more readable form of your piston. It is so dark that I cannot make it out...

@nh.schottfam
I am now thinking it's not WC. I just noticed when monitoring the Envisalink device in HE on the "Device" page it never changes to Not Ready in the Current States. So, sadly, I think the app is processing the events but not setting the var that WC would hook too?

Current States

  • LastUsedCodePosition : 40
  • Status : Ready
  • contact : closed
  • switch : off
  • tamper : clear

Help cannot figure out why it will not increment a variable ...this piston came over from smartthings and was working

Line 30 is executed....but line 26 does not seem to ....i have no idea why...i deleted and reentered but no luck

Looks like when you created active you set it to a value of 1. Every time you start the piston it will be reset to 1.

Set it to no value in definition.