[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

What happened to time comparisons?

Time is between 15 minutes past (@globaltimevar) and 60 minutes past {$sunset}

is returning false:

383ms ║║Comparison 1497048857827 is_between 1970-01-01T16:15:00.000Z … 1497067080000 = false (11ms)

This is breaking another timer based piston for me as well. It seems the global time var isn’t being converted into a long seconds from epoch like it used to?

How did you set that @ global var? Is it a time or a datetime?

its a time. I set it a couple of ways. By hand. Also from a piston.

If I set it by hand every time I go back to the dialog the value is blank again, just:
–:-- --. But it allows me to type in the variable and hit save, and it shows up in the variable list with the value I entered as type time. I also set it from the piston below.

The error I see in one of my other pistons that uses this variable is:

║║An error occurred while executing the event: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘2017-06-09T15:15:00.000Z’ with class ‘java.lang.String’ to class ‘long’

Oddly I have a couple of other pistons that also use this value which continue to work. Or at least they did this morning before the latest update.

Setting it the 2nd time is incase I stay up late drinking and change my mind!

Why is my piston not fully firing? What I want is if the temp in a certain room goes to 86 when I am away from home, I get a text, I get an email, and the thermostat changes to 65 then waits one hour and sets to 85 and hold. Everything works up until the wait one hour and set to 85…that part is not happening, it just stays at 65 degrees??? What am I missing? Thanks

Can you please make it a datetime and see if that works?

Here is what I am testing it with. Basically every 30 minutes it will gather all the temps in the house and write it to three different streams under the House V3 canister.

This is the output when all three are selected

7 Likes

Is anyone using the Arlo or Arlo Pro wireless cameras? I’m picking up 4 of these in the Pro kit with base station tomorrow. I’d love to see some example pistons that some basic as well as more advanced things in working with these cameras. As I understand it from another thread here, the SHM and Arlo app themselves have some pretty big bugs and issues, so hopefully I can work around that by doing my own rules using webCoRE. Also I am curious if through webCoRE I can issue a command to start and stop video recording?

sure. sorry to hear that. if you want to try it again, ping me and i will work with you to get it working.

OK I’ve changed to date time:

datetime@WakeUp6/9/2017, 8:15:00 AM

I still see this when I test my broken timer triggered piston:

+1097ms ║An error occurred while executing the event: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘2017-06-09T15:15:00.000Z’ with class ‘java.lang.String’ to class ‘long’

In the other piston that uses the time or now datatime variable in a restriction. This seems to evaluate properly, though it looks a bit odd:

+393ms ║║Comparison 1497063028957 is_between 2017-06-09T15:15:00.000Z … 1497067080000 = true (15ms)

How did you set the value? From another piston? By hand? What error line do you get in the IDE please?

by hand. I’m not sure where to look in the IDE for the error.

If I test the piston then go to Location -> smartapp -> webcore -> piston name -> logs

there’s a bunch of stuff but nothing different than whats in the dashboard:
m=An error occurred while executing the event: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘2017-06-09T15:15:00.000Z’ with class ‘java.lang.String’ to class ‘long’}, {c=trace, p=║╚, o=538, m=Execution stage complete. (151ms)}, {c=info, p=╚, o=570, m=Event processed successfully (571ms)}, {t=1497062934001}, {c=info, p=╔, o=13, m=Starting piston… (v0.2.0bb.20170609)}, {c=trace, p=║╔, o=610, m=Subscribing to devices…}, {c=trace, p=║║, o=946, m=Subscribing to Bedroom Ceiling Light…}, {c=trace, p=║║, o=948, m=Subscribing to Bedside Lights…}, {c=trace, p=║║, o=949, m=Subscribing to Office Window North…}, {c=trace, p=║║, o=950, m=Subscribing to Motion Bed…}, {c=trace, p=║╚, o=952, m=Finished subscribing (345ms)}, {c=debug, p=║, o=1036, m=Comparison :38257d9da371f028a2fb17a159be81d1: is_any_of

What’s a good way to say “If a switch A is ON, then the temperature to Fuel every 5 minutes”? Would it be better to have an timer that runs every 5 minutes all the time and then inside the timer do the IF ON then Log? That doesn’t seem very efficient. Seems like there’s a better way but not sure what.

How about…

while
  switch A is on
do
   write to fuel
   wait 5 minutes
end while
2 Likes

Simple Query
If I want to run a piston twice or three times a day at a fixed time, is it possible to achieve without cutting and pasting the routine into the time slots

I have it currently set up whereby EveryDay at 9.00am run piston. What I can not find (it may not exist) is Everyday at 9.00am, 13.00pm, 17.00pm run piston.

I can achieve it setting up 3 different On execute commands. Just wondering if I can combine into one.
Thanks

Perfect solution :ok_hand::+1: thanking you kindly.

1 Like

I would like to pull just the “12hr: temperature”:? info that is highlighted in the logs. It is from Accuweather and is the 12hr forecast, but it is within the device state “forecast”. I want to get just the 12hr temp forecast. I tried and can get just the current temp.
Here is the log:
6/10/2017, 8:49:52 AM +276ms
+1ms ╔Received event [Home].test = 1497098992268 with a delay of 6ms
+157ms ║RunTime Analysis CS > 25ms > PS > 82ms > PE > 51ms > CE
+166ms ║Runtime (31869 bytes) successfully initialized in 82ms (v0.2.0bb.20170609) (165ms)
+168ms ║╔Execution stage started
+519ms ║║Comparison 67 rises_to_or_above 80 = false (9ms)
+521ms ║║Condition #7 evaluated false (344ms)
+523ms ║║Condition group #1 evaluated false (state did not change) (345ms)
+527ms ║╚Execution stage complete. (359ms)
+648ms ╚Event processed successfully (648ms)
Here is the piston:


Here is the device state:
forecast: {“1hr”:{“precipitation”:0.0,“temperature”:70.0,“realFeel”:72.0},“2hr”:{“precipitation”:0.0,“temperature”:76.0,“realFeel”:79.0},“3hr”:{“precipitation”:0.0,“temperature”:81.0,“realFeel”:83.0},“4hr”:{“precipitation”:0.0,“temperature”:82.0,“realFeel”:84.0},“5hr”:{“precipitation”:0.0,“temperature”:84.0,“realFeel”:85.0},“6hr”:{“precipitation”:0.0,“temperature”:86.0,“realFeel”:87.0},“7hr”:{“precipitation”:0.0,“temperature”:87.0,“realFeel”:88.0},“8hr”:{“precipitation”:0.0,“temperature”:88.0,“realFeel”:88.0},“9hr”:{“precipitation”:0.0,“temperature”:88.0,“realFeel”:86.0},“10hr”:{“precipitation”:0.0,“temperature”:87.0,“realFeel”:84.0},“11hr”:{“precipitation”:0.0,“temperature”:84.0,“realFeel”:81.0},“12hr”:{“precipitation”:0.0,“temperature”:81.0,“realFeel”:77.0}}

Trying a sunset routine where at specified times the lights fade from X to Y% over Z minutes…what is actually happening is the lights are fading off, then backon, then fade off again over the period of Z minutes…what am I missing?

Interesting idea. Does that need to be in its own piston? I assume the Wait blocks the rest of the piston from continuing? IOW I like to have an analytics piston that has lots of different things it monitors and logs, with several different “blocks” of code that each could be their own piston. But for convenience I like to have them all under one piston. I’m assuming in your code snippet the loop and wait would prevent the rest of the piston from executing? Or would another thread come in somehow to do that?

Does anyone have a good example piston they can post that tracks energy use? I have a smart outlet that gives me watts used at the time. I can capture this data on every event (each time energy usage is reported). But I don’t want to just see raw watts graphed over time. Instead I want to be able to see that during this particular hour or this particular day (week/month etc) that a piece of equipment used a total of X kW hours. Ideas? Thanks.

Can anyone help me with this piston? IT currently works fine, but I want it to fire at 11pm, and wait until next day at 8am to send the notifications.

The concern is that using the variables in the notifications will cause the numbers to be incorrect at the time of the notification being sent. I.E. a door opening at 2am…@Townsmcp