[DEPRECATED THREAD] webCoRE Beta Milestone 1

When I created my first piston I didn’t choose automatic backup, and now I want to enable it. When I click on the “Enable Automatic Backup” button, nothing happens. Am I missing something?

1 Like

Thanks! That worked.

1 Like

@ady624 Possible problem with Cancel on Piston State Change

Hi Ady - Have been migrating from CoRE. Thanks for the great work on WebCoRE.

Have replicated a latching piston from CoRE by manually setting the Piston State :

It appears (to me) that the Cancel on Piston State Change on line 56 is not operating correctly. Excerpt from Logs follow (see job created in bold italics to handle the 30 second light timeout). Hence the lights flash off and on again before finally operating correctly :

2017-5-29 13:20:54 +13ms
+0ms ╔Received event [Home].webCoRE = @LivingRoomMotion with a delay of 95ms
+327ms ║RunTime Analysis CS > 16ms > PS > 58ms > PE > 254ms > CE
+336ms ║Runtime (36167 bytes) successfully initialized in 58ms (v0.1.0b1.20170524) (335ms)
+337ms ║╔Execution stage started
+352ms ║║Comparison false is true = false (3ms)
+354ms ║║Cancelling condition #6’s schedules…
+355ms ║║Condition #6 evaluated false (9ms)
+356ms ║║Cancelling condition #1’s schedules…
+357ms ║║Condition group #1 evaluated false (state changed) (13ms)
+365ms ║║Comparison false is true = false (3ms)
+367ms ║║Condition #9 evaluated false (9ms)
+368ms ║║Condition group #8 evaluated false (state did not change) (10ms)
+376ms ║║Comparison false is true = false (3ms)
+378ms ║║Condition #13 evaluated false (8ms)
+379ms ║║Condition group #12 evaluated false (state did not change) (10ms)
+390ms ║║Comparison false is false = true (2ms)
+392ms ║║Cancelling condition #40’s schedules…
+393ms ║║Condition #40 evaluated true (9ms)
+400ms ║║Comparison false is false = true (3ms)
+402ms ║║Condition #41 evaluated true (8ms)
+415ms ║║Comparison on is on = true (3ms)
+417ms ║║Cancelling condition #42’s schedules…
+418ms ║║Condition #42 evaluated true (14ms)
+419ms ║║Cancelling condition #31’s schedules…
+420ms ║║Condition group #31 evaluated true (state changed) (38ms)
+423ms ║║Cancelling statement #32’s schedules…
+429ms ║║Executed virtual command setState (0ms)
+433ms ║║Cancelling statement #34’s schedules…
+542ms ║║Executed physical command [Study Light].setLevel([5]) (103ms)
+543ms ║║Executed [Study Light].setLevel (105ms)
+550ms ║║Executed virtual command [Study Light].wait (1ms)
+551ms ║║Waiting for 2000ms
+2591ms ║║Executed physical command [Study Light].setLevel([50]) (33ms)
+2592ms ║║Executed [Study Light].setLevel (35ms)
+2600ms ║║Executed virtual command [Study Light].wait (2ms)
+2602ms ║║Requesting a wake up for Mon, May 29 2017 @ 1:21:26 PM BST (in 30.0s)
+2841ms ║╚Execution stage complete. (2504ms)
+2946ms ║**Setting up scheduled job for Mon, May 29 2017 @ 1:21:26 PM BST (in 29.658s)**
+2967ms ╚Event processed successfully (2966ms)

If I override this by having a further motion event trigger I had expected the job #34 to be completely cancelled. However, the logs show that the Job is firstly cancelled but is then recreated for the ORIGINAL time and not a new 30 second increment ?

2017-5-29 13:21:18 +889ms
+0ms ╔Received event [Home].webCoRE = @LivingRoomMotion with a delay of 86ms
+221ms ║RunTime Analysis CS > 16ms > PS > 64ms > PE > 142ms > CE
+233ms ║Runtime (36168 bytes) successfully initialized in 64ms (v0.1.0b1.20170524) (232ms)
+234ms ║╔Execution stage started
+249ms ║║Comparison true is true = true (2ms)
+251ms ║║Cancelling condition #6’s schedules…
+252ms ║║Condition #6 evaluated true (10ms)
+259ms ║║Comparison Dark is Dark = true (3ms)
+261ms ║║Condition #7 evaluated true (8ms)
+262ms ║║Cancelling condition #1’s schedules…
+263ms ║║Condition group #1 evaluated true (state changed) (21ms)
+266ms ║║Cancelling statement #4’s schedules…
+279ms ║║Skipped execution of physical command [Study Light].setLevel([50]) because it would make no change to the device. (6ms)
+280ms ║║Executed [Study Light].setLevel (7ms)
+284ms ║║Cancelling statement #25’s schedules…
+289ms ║║Executed virtual command setState (1ms)
+301ms ║║Comparison true is false = false (3ms)
+303ms ║║Cancelling condition #40’s schedules…
+304ms ║║Condition #40 evaluated false (9ms)
+305ms ║║Cancelling condition #31’s schedules…
+306ms ║║Condition group #31 evaluated false (state changed) (13ms)
+521ms ║╚Execution stage complete. (287ms)
+613ms ║**Setting up scheduled job for Mon, May 29 2017 @ 1:21:26 PM BST (in 7.115s)**
+632ms ╚Event processed successfully (632ms)

Can you see the problem or have I made a schoolboy error :thinking: Hope you can help.

1 Like

Thanks Dustin. I tried working with this today and ran into a few challenges I’m hoping you can help with.

  1. See screenpic below. “Column 1” is one of my LIFX lights. I have “With Column 1” for “With…” and selected “location Set variable” for “Do…” as you can see. However in the second line for “Variable”, where you have “dynamic light”, mine says “Nothing selected” with an “invalid variable” warning label in red - however there is no way to select anything in the box that says “Nothing selected”. When I click in it there is no dropdown, just an empty list. And it won’t let me type anything in the box. What am I doing wrong?

  1. Once I am able to get past question #1 - I am unsure of how to set these variables back into the LIFX light. What type of statement can do that? If its easier perhaps you can whip up a quick example that shows how to get the values from the light and then how to set those values back to the light?

  2. Do you happen to know what “switch” is - is that on/off state? I assume “color” is a text label like “blue” and color temp is a hex value. I assume hue level and saturation are 0-255? I can experiment with debugging and probably figure it out, but was just curious if you knew.

Thanks!

1 Like

You will need to define a variable for each attribute you want to save. This will populate in the drop down list.

To restore you just select the device again and change value to variable and select that variable.

Switch is on/off. Level is 0-100. Color is the name. Those are the ones I can recall off the top of my head.

1 Like

Great, thanks. It took me a little while to figure out how to define local variables, but after a little digging I figured it out from the Wiki. This seems a bit inconsistent compared to the Add Global Variable command in the top right. Seems that there should also be a Add Local Variable option there just to make it a bit more intuitive.

Is there a way to define global subroutines / functions? For instance let’s say I wanted to define a global CustomFlash function that would take a device (RGB Light) and flash color and brightness as inputs, then inside the function save the passed in light device’s current state/color/birightness etc, flash it according to the passed in params, and then reset the light back to its original state. Can I define that globally someway, and then call it from various pistons?

This may be more trouble than its worth since Adrian said he would look at adding a custom Flash function, but I’m curious if in general its possible to create subroutines like thiat. Thanks.

1 Like

There is no global functions/subroutines, yet. I’m not sure if it’s in the plans but I see how it could be useful when doing repetitive tasks/expressions.

1 Like

It is actually something I have requested on the to do list. He had mentioned doing it before in a developer channel but I didnt have a use for it at the time. But I have since come across a couple use cases for it in my pistons now. So maybe but not guaranteed.

1 Like

Thanks. I suppose one pseudo way to handle this would be to make a piston that served as a subroutine and call that Piston from the piston where you needed it. I think that could work, assuming you have the ability to pass a Device in a object from one piston to another (so that it would know what target RGB Light you wanted the piston to blink). @eibyer

1 Like

Maybe. But my current work around is setting variables for all the different possibilities then if below it in a separate IF statement checking those variables and running the actions I wanted.

1 Like

Can someone help with changing the displayed value from present and not present to home and away.

I have a piston set to send a push notification on arrival departure of family members. I’m use.
$currentEventDevice is now $currentEventValue

I get Jim is now not present

I would like Jim is now away.

1 Like

{$currentEventDevice} {string([$currentEventDevice: presence]) == 'present' ? ' is home' : ' is now away'}
This should work as an expression.

3 Likes

I fixed the requirement for string() over the weekend, it will be pushed out in an update later on today

4 Likes

Works perfectly. Thank You :grinning:

3 Likes

I think there may be a bug in SmartThings thinking that it does not need to send an updated value to a bulb because it already has that value, when it does not. Here are the details.

First please see this piston:

+2ms ╔Received event [Door Sensor].contact = open with a delay of 213ms
+166ms ║RunTime Analysis CS > 43ms > PS > 64ms > PE > 58ms > CE
+177ms ║Runtime (31254 bytes) successfully initialized in 64ms (v0.1.0b1.20170524) (173ms)
+178ms ║╔Execution stage started
+203ms ║║Comparison open is open = true (5ms)
+206ms ║║Cancelling condition #10’s schedules…
+207ms ║║Condition #10 evaluated true (16ms)
+209ms ║║Cancelling condition #8’s schedules…
+210ms ║║Condition group #8 evaluated true (state changed) (19ms)
+213ms ║║Cancelling statement #2’s schedules…
+239ms ║║Skipped execution of physical command [Column 2].setHue([65]) because it would make no change to the device. (3ms)
+241ms ║║Executed [Column 2].setHue (18ms)
+1109ms ║║Executed physical command [Column 2].setLevel([70]) (859ms)
+1110ms ║║Executed [Column 2].setLevel (861ms)
+1121ms ║║Executed virtual command [Column 2].wait (2ms)
+1122ms ║║Waiting for 1000ms
+2703ms ║║Executed physical command [Column 2].off() (563ms)
+2705ms ║║Executed virtual command [Column 2].setSwitch (576ms)
+2783ms ║╚Execution stage complete. (2605ms)
+2826ms ╚Event processed successfully (2825ms)

Here’s the scenario:

  • I opened the door and the piston ran the first time as it should, setting the color (hue) correctly. This is a LIFX bulb BTW.
  • Then using the LIFX app separate from SmartThings/webCore I called up a scene that changed all bulbs including this one targeted by the piston to White.
  • Then I opened the door again. This time when the bulb turned on, it came on in White, even though there is the command there to set the device hue to another color. When I looked at the logs (above) it has a statement saying that the hue command was skipped because it wasn’t necessary… which is incorrect.
  • I am thinking that since the last time webCore touched the bulb, it hadn’t changed the color. But of course didn’t realize that a third party app changed the color.

Is this a case of command optimization fooling itself?

Is there a way I can make these commands to set the bulb properties such as Hue in a way that FORCES webCore to set the value, even if it thinks it is unnecessary (when in fact it actually is, as explained in this case)?

Thanks!

1 Like

Disable command optimization in the settings for that piston.

1 Like

Thanks. I did that and confirmed in the log that it then sent the color hue command. However the light still flashed white. :frowning:

I think for now I am going to give up on creating my own blink logic and wait for @ady624 to implement the improved version of it.

In the meantime I will use IFTTT. It works perfectly for what I need it to do, however it takes way too long before the light blinks. I suppose this is the delay caused by IFTTT?

Is there any way to make IFTTT respond faster? I timed it, and it took 3.6 seconds from the time the door opened until IFTTT blinked the light. Here is the piston and log of it running. Any way to speed this up? Ideally as soon as the door opens it would blink, so the shorter the delay the better. When using the webCore Flash light command it runs in about half the time, which is a great improvement. However the Flash command is a bit too limited for my needs (until the enhancements are added, at which time it will be perfect). Thanks!

5/30/2017, 5:58:31 PM +862ms
+2ms ╔Received event [Theater Door Sensor].contact = open with a delay of 503ms
+157ms ║RunTime Analysis CS > 24ms > PS > 76ms > PE > 57ms > CE
+168ms ║Runtime (30875 bytes) successfully initialized in 76ms (v0.1.0b1.20170524) (164ms)
+169ms ║╔Execution stage started
+197ms ║║Comparison open is open = true (6ms)
+200ms ║║Cancelling condition #10’s schedules…
+201ms ║║Condition #10 evaluated true (17ms)
+203ms ║║Cancelling condition #8’s schedules…
+205ms ║║Condition group #8 evaluated true (state changed) (21ms)
+209ms ║║Cancelling statement #2’s schedules…
+261ms ║║Executed virtual command [Column 1].iftttMaker (40ms)
+361ms ║╚Execution stage complete. (192ms)
+411ms ╚Event processed successfully (410ms)

1 Like

Are you talking about LIFX bulbs? Do they provide hardware support for flashing?

1 Like

Yes, LIFX. I don’t think they provide hardware support for flashing. On their IFTTT channel they have a “blink lights” command that works perfect. It allow you to specify whether you want it to still blink even if the light is off (yes, in my case), what color to flash and how bright, how long the on and off state should be used (to create the flash) and so forth.

I currently trigger this through a IFTTT Maker which works perfect. Except it takes 3.5 seconds before I see the flash. That’s what I was hoping to improve on with IFTTT or by native enhanced support for flashing/blinking within WebCoRE.

1 Like

That is hardware support. It uses an API. I will look for the whole API docs for LIFX. I always recommend using hardware-supported methods before relying on software emulated ones. webCoRE emulates such complex commands by building them out of basic commands. I guess I should buy a LIFX bulb. Does it need a hub?

1 Like