[OBSOLETE] [BETA MILESTONE 1] CoRE (Community's own Rules Engine)

General question. If I run a piston to turn on a light for example, but the light is already on, does the piston automatically recognize that it is on and not try to turn it on again, or do I need an IF, THEN to check if it is already on? It appears it is the latter from my testing, is that correct?

It will just send the command to turn on the light. If the light is on, it will just stay on, no harm done. Having the versatility of supporting all device commands means I can’t test their state before sending a command - there is not one single line of code that deals with the ā€œonā€ command on its own. The same line of code that executes ā€œonā€ executes ā€œoffā€, ā€œsetLevelā€, ā€œsetHueā€, etc. I think it’s a small price to pay, sending the command to a device that’s already in that state. And no harm from it either. Performance wise, it’s me testing the attribute (using resources) or me sending the command (using resources). If the DTH is smart enough to filter the ā€œonā€ because the light is already ā€œonā€, it spares the zwave/zigbee network too…

There is a way. Via Save/Load state, but that’s not ready yet, I am currently testing the save/load state from variable. Then I’ll have the save/load state locally and globally, I’ll explain what they do. But I am now testing this, when I have it working, I’ll update the CoRE on github.

On switch on you could save the state of the two lights to either a variable or the local store, then turn both on. On switch off, you then load the state from the variable you previously saved it to. This will revert both lights to the state they were in before you turned them on…

Thanks and I will see what happens tonight!

No worries. I only ask because I noticed that my LED under-cabinet lights in the kitchen increase in brightness momentarily and then revert back to the setting specified in the piston, if they’re already on. I do have two actions for the light, Turn On and then Set Level. Maybe I can take out the Turn On action. I will experiment a little. Or for that light specifically, I can add an IF, THEN. I only have the issue with that light.

Thanks.

Yeah, for color/color temp lights, turn on may modify some other parameters too, depending on the DTH…

Another question. I recently integrated my ADT Alarm into ST using the approach detailed here. It works great. ST recognizes it as both a Lock, which allows toggling Arm Away, and as a switch, which allows toggling Arm Stay.

I want to create a piston that runs a Routine (I’m Back!) when the alarm is ā€˜unlocked’, i.e. when Arm Away is turned off (which can only mean it goes to Disarmed state, you can’t go from Arm Away to Arm Stay).

I created the below (Dashboard still not showing step details for me), but it just flat out didn’t work. Nothing happened when the alarm moved from Arm Away to Disarmed. Any ideas please?

Can you please enable debugging and then check the logs? Thank you

Turned on debugging. Where do i access the logs?

Go to your IDE and click on Live Logging. Then unlock that lock… and watch the screen.

Nothing shows up at all. I tested other things and those do show up, but nothing when I ā€˜unlock’ the alarm at all. Also tried re-locking it too. Nothing on the Live Logging page at all. Also don’t see the Home Alarm device in the top section that lets you filter by device. Perhaps the device handler (AD2SmartThings v4.1) doesn’t log?

Or not working?

Well its working in that it is in fact turning the alarm on and off - I verified in the ADT app.

So it can control ADT, but does it change the lock status when you disarm ADT? Is the ā€œlinkā€ bedirectional? Maybe it updates the lock status every few minutes?!

Yaaay. I can’t wait to be confused when setting it up when it’s ready :wink:

How are you guys seeing this visualization…?
I feel like I’m missing something really cool here…

Yep its bidirectional. I just disarmed it using the ADT app and it immediately showed as disarmed in ST. And I have ā€˜locking the lock’ (i.e. setting alarm to Arm Away) as part of my ā€˜Goodbye!’ routine which runs when all presence sensors leave the house, and that has been working fine.

Which ā€˜visualization’ are you referring to?

Do you see any logs from that device when you arm/disarm ADT?

No nothing, using both ST and the ADT app to arm/disarm. I found the below in the device handler code, should I change ā€˜false’ to ā€˜true’?

// Parse incoming device messages to generate events
def parse(String description) {
//log.debug "Parsing: ${description}"
def isDebugEnabled = false