System Variables listing?


#1

Hi all,

Is there a way to view a list of the available system variables in webcore? Instead of creating precanned messages such as “{$currentEventDevice} is Unlocked!” I would prefer to do something like

{$currentEventDevice} is {DeviceStatusVariableHere}

this way I am receiving the true status of the device.

Here is a piston I am working on:

The problem is, {$currentEventValue} returns something like: 15123…

So the push notification reads: “The Christmas lights are now 15123…”

So I’m assuming I’m either using the wrong variable or I did something wrong regards to the coding. While I would definitely appreciate any help on fixing the piston, is there a master list of global and system variables so I can reference them while coding in the future?

Thank you!


#2

The $currentEvent variables deal with what cause the piston to execute.

If you do something like [device:attribute] then you will get what you are looking for. Example [lights:switch] will return on/off

System variables are below the script editor


#3

Ahhh, interesting. Ok, so in a case like this, if I’m using two GE outdoor outlets to control two sets of lights, to do this would be pretty involved, no? I would need to evaluate their current status and if they are on, I would need to store “On” in a variable and then print that variable in the message. If they are off, then I would do the opposite, using the same variable.

Does that seem like the most efficient way?


#4

Are you only wanting to say one thing is on in reference to both devices?

Device 1 is on and device 2 is on then say on

Device 1 is off and device 2 is off then say off

What about when device 1 is different than device 2?

In this case I would just output the status of 1 device and assume the that if it turned on then so did the other.


#5

Yeah, that’s a good point as well. I may go that route considering it’s only going to run for ~ 1 month and technically, it’s not like a door lock or open/close. If the rule fails, worst thing that happens is I waste a little electricity versus a potential security issue!

Thanks!


#6

In regards to the [lights:switch] example, am I understanding this as you need to change ‘lights’ to the name of the device and change ‘switch’ to one of it’s valid attributes? If the device name has spaces, is there an issue there?


#7

Spaces are ok. Write it exactly as it is displayed. If you are using the expression editor then it will auto fill in.

Switch would more than likely be the attribute needed for an outlet or light switch.


#8

Got it, thanks! I was just playing with the expression editor. I believe I got it to work. The next iteration would be could I create a variable that uses the expression but when the variable is returned it outputs the status? For example, would this work:

string DoorLockStatus = {Front Door Lock:Lock]}

Send PUSH notification: “The Front Door Lock is {DoorLockStatus}”

This is the piston I’m applying it to. I have duplicate notifications as a fail-safe while testing new methods:

I’m just not sure if the variable DoorLockStatus will return the status or if it will just return literally “[Lock1:Lock]” as a string.


#9

This looks like it is correct. I don’t have any locks but if that attribute is what popped up then you’ll be good.

Also you are introducing extra steps with the variable. You could add that expression into the message itself instead of using the variable


#10

Thanks for the confirmation! The reason for the variable is, depending on how many times I need to use it in the piston, it would be way easier to type the variable as I could make it short and sweet, then to type that syntax everytime. Less room for error :smiley:


#11

That makes sense. Just looking at what was available and it wasn’t making sense. You are just future proofing.