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

You’re welcome. There’s also the font awesome fonts that you can use as icons in the status page. I have not looked if it’s mentioned in the wiki. It’s easy to use, just enclose it the font name with a colon,ie

:fa-user-o: to give you

You can also rotate, spin, and enlarge them. The color and formatting classes from the wiki can also be applied to the font awesome icons.

Edit: Forgot the fontawesome link… http://fontawesome.io/icons/

2 Likes

I’m trying to envision the logic to create a core that will turn on randomly selected lights when I am away.

The condition is easy:

If location mode stays away more than x hours then

My challenge is selecting a random light, turning it on, waiting a random time and then turning that random light off.

I thought of using variables to pick a light at random but I do not know whether I can take the device captured in that variable and turn it on.

Any thoughts?

Something like this maybe…
It’s a ‘while’ piston so it just keeps looping roung while the conditions are met. When false it stops/does not run.
Switch 9 in the below piston is a virtual switch that turns on when lux drops below a certain level.
Switch 4 is a virtual switch I use to override it for testing etc.

Can anyone help me to understand why this isn’t working? I have good working knowledge of Core but just started using WebCore a few days ago and I’m trying to convert things over. I seem to be having a heck of a time populating variables with information from devices.

OK, I set the two local variables, but left them as unassigned.
To help I turned on extra logging and can see the Temperature is being read from the device but for some reason its not loading into the global variable @TempOut. In order to process the rest of the script I must first get the data from the devices.

This is not the answer to why the global variable is not setting but there is a dewPoint() function available for direct calculation.

https://wiki.webcore.co/Functions

1 Like

This is what I use for away-lighting. Sorry for the copy, it’s a screen shot off an iPad. It’s got some limitations so that all the lights shut off to make the house look ‘quiet’ after an somewhat active night. That happens in another piston.

How did you manage to set Var3 and Var4 when you do not gave them defined? Deleted them by any chance? Also, webCoRE is case sensitive, @HumOut is not the same as @humOut. Do you have two such global variables?

It is read once, but maintained throughout the piston, so writing something in a global var should read right back. They are also written back to the parent once, at the very end of a run. At that same time, events are generated by the global variables that changed, so that you can use subscribe to global variables

Yes, when I was experimenting trying different things I ended up deleting the local variable from the definitions. I have since put them back. Thank you for pointing out my typo on @humOut. I wish I could see my own mistakes. LOL! I will make that correction.

I am still trying to figure out why @TempOut is not being assigned the the temperature of the device.
When I created the global variables @TempOut and @HumOut I left them as unassigned. Not sure if that has something to do with it.

So you are saying they do not change even though you are sure to put different values into them?

I went back and set all the global variables back to unassigned. Right now when looking at their values it reports (not set)

When the piston fired the next time @HumOut was properly loaded with the correct humidity value but @TempOut was loaded with a 0 value and the same for @DewPnt. So in answer to your question the global variables are being populated.

After making the corrections to the piston it still is not loading @TempOut with the proper temperature. The log shows that the temperature was reported, its just not being assigned to @TempOut

Can u please update the app to the latest? There was a bug in the last version pertaining to decimals.

Checked all apps in the IDE and they report v0.1.0b7.20170603
I published all of them again thinking I may have missed a step

Still not loading @TempOut with the devices temperature. According to the log their both integers.

Update them again, there was a second publish under the same version

I’m having an issue with a piston that is checking the Hub Power Source where WebCore is showing it’s running on battery incorrectly.

Here’s the piston:

Logs:
6/4/2017, 8:09:02 PM +396ms
+1ms ╔Received event [Home].test = 1496621342390 with a delay of 6ms
+215ms ║RunTime Analysis CS > 26ms > PS > 82ms > PE > 107ms > CE
+245ms ║Runtime (46385 bytes) successfully initialized in 82ms (v0.1.0b7.20170603) (243ms)
+247ms ║╔Execution stage started
+268ms ║║Comparison battery changes_to battery = false (8ms)
+271ms ║║Condition #32 evaluated false (14ms)
+278ms ║║Comparison battery is battery = true (2ms)
+280ms ║║Condition #33 evaluated true (8ms)
+282ms ║║Condition group #1 evaluated true (state did not change) (26ms)
+285ms ║║Cancelling statement #9’s schedules…
+332ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at + (string) 8 >> (string) ST Hub is now running on battery power. Battery Power started at 8
+341ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8 + (string) : >> (string) ST Hub is now running on battery power. Battery Power started at 8:
+350ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8: + (string) 09 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+358ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+365ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) PM >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM
+372ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM + (string) on >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on
+379ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on + (string) Sunday >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+385ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+391ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) 6 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6
+397ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6 + (string) / >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/
+402ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/ + (string) 4 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+407ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+424ms ║║ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+425ms ║║Executed virtual command [Living Room Siren].log (8ms)
+461ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at + (string) 8 >> (string) ST Hub is now running on battery power. Battery Power started at 8
+470ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8 + (string) : >> (string) ST Hub is now running on battery power. Battery Power started at 8:
+478ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8: + (string) 09 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+486ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+494ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) PM >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM
+501ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM + (string) on >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on
+508ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on + (string) Sunday >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+514ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+520ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) 6 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6
+526ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6 + (string) / >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/
+531ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/ + (string) 4 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+535ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+561ms ║║Executed virtual command [Living Room Siren].sendPushNotification (19ms)
+594ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at + (string) 8 >> (string) ST Hub is now running on battery power. Battery Power started at 8
+603ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8 + (string) : >> (string) ST Hub is now running on battery power. Battery Power started at 8:
+611ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8: + (string) 09 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+619ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09
+626ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 + (string) PM >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM
+633ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM + (string) on >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on
+639ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on + (string) Sunday >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+645ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday
+650ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday + (string) 6 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6
+656ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6 + (string) / >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/
+660ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/ + (string) 4 >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+665ms ║║Calculating (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4 + (string) >> (string) ST Hub is now running on battery power. Battery Power started at 8:09 PM on Sunday 6/4
+675ms ║║Executed virtual command [Living Room Siren].setState (5ms)
+952ms ║║Executed physical command [Living Room Siren].customBeep1() (271ms)
+1004ms ║║Injected a 50ms delay after [Living Room Siren].customBeep1()
+1005ms ║║Executed [Living Room Siren].customBeep1 (328ms)
+1015ms ║║Executed virtual command [Living Room Siren].wait (5ms)
+1017ms ║║Requesting a wake up for Sun, Jun 4 2017 @ 8:29:03 PM EDT (in 1200.0s)
+1035ms ║╚Execution stage complete. (789ms)
+1039ms ║Setting up scheduled job for Sun, Jun 4 2017 @ 8:29:03 PM EDT (in 1199.98s)
+1059ms ╚Event processed successfully (1058ms)

Here’s the hub status showing it’s not running on battery power currently:

1 Like

So I converted about 1/3 of my pistons from CoRE to webCoRE and some worked for a while but none of them work anymore. They act like they are working but nothing in the real world, mostly with audio notifications but not all of it. Has anyone else ran into this?

That was it. Leave it to me to find that little bug. Both global and local variables are populating as they should. Thanks!

There is no way (yet) to read the current battery status, so it has to default to something (ST is adding a way). Can you unplug power and leave the hub on battery then plug it back? Get any events?

1 Like

No, I’m not seeing any new events in the logs on this piston or on the Logs in ST (Live Logging) if I unplug and replug the power to the ST Hub.