CoRE and Piston Rules Engine, first design steps

One of the things that I have relied on pretty extensively in RM is the ability to control groups of smart lights (levels, on/off, tune white color temperature, and set rgbw colors/levels) via a properly enabled virtual switch. RM allowed me to create a triggered condition that used changes to the virtual switch (on, off/ dim) to change the states of the “underlying” devices very easily. I have a single RM rule, for example, that will turn a set of smart lights on, off, and change their dimming level when the state (on/off/dim) of the virtual switch changes.

For the dimming, RM has a “track event dimmer” switch that allows one to tell the rule that changes to the triggering device (the virtual dimmer) should be reflected by the physical devices that are controlled by the virtual switch. I can’t figure out how to do this using CoRE. Can somebody help me out?

Note: RM could only “pass through” the dimming level. It never had the ability to do that with white color temperature or RGBW color. I had put in an enhancement request, but that was during the dark days of March/early April and it never got addressed. I would really love to see it be possible to use a virtual switch/dimmer to pass through all characteristics that the underlying devices support.

neah, there’s got to be something, otherwise why is 042 opening it… can you leave it on and try and recreate it in .044 see when it crashes?

ok. I’m enabling all logs in the piston. I’m going to upgrade back to ver 44 and see what happens.

I’m about a week later on this particular post, but something I have been thinking about lately. I was current on this thread but then had 2 really busy days at work & @ady624 dropped his alpha code…(really nice work by the way).

Anyway, I find ST battery tracking to be terrible, notifications if battery at “X%” I would not trust. Anybody got an app or way to get a notification if a device stops reporting in its own RECENT tab (preferably after a user defined period of time)? It’s too late, the battery has failed, but I find most battery devices get to either 88% or 77% reported battery life and then die.

@ady624

this is interesting.
As soon as I attempt to open the piston I get this “hello Home” issue in the logs. It stops as soon as the Piston times out.

7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:35 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:35 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:34 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:34 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:33 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:33 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:33 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:32 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:32 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:31 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:31 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:31 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:30 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:30 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:29 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:29 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:28 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:28 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:28 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:27 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:26 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:27 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:26 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:25 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:25 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:25 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:24 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:24 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:24 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:23 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:22 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:23 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:22 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:22 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:21 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:21 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:20 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:20 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:20 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:19 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:19 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:18 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:18 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:18 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:17 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:17 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:17 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:16 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:16 PM: trace getPhrases(), state.welcomeIssue = null
7d7c0923-cbcb-44b9-8394-5d5442c33e8c 9:30:15 PM: trace getPhrases(), state.welcomeIssue = null

1 Like

At this point, CoRE is probably capable of doing all of that, but this SmartApp might also suit your needs.

2 Likes

I love this community. Ask and get awesome help! Thanks @krlaframboise. Cheers!

Can you try with this?

v0.0.045.20160525 - Alpha test version - Caching attributes - attempt to speed up some things

1 Like

Yep, all is good now… Thanks.

Though… I’m still rewriting it lol… I’m trying to get the If-Then piston to work for this like it was before… using a simple piston with lots of individual actions and stuff was slow. The if-then was much faster.

1 Like

Adrian,

Re: your latest version v0.0.045…

Thanks for adding in the revisions to the HSL values for color. It’s working great for me here with the Hue lights, including the white tone ones I care most about - Soft White, Warm White, etc.

Wish I could buy you a beer (or three) for all your amazing work with CoRE!

2 Likes

@ady624

Ok, I rebuilt this complex scenario using the Then-If piston.

Using the motion sensor as the primary trigger, leaving the primary then blank, I put the mode and switch conditions in the secondary then with each of those groups executing the actions.

If A, then nothing. Then if B, --> perform actions
This ask works great, no problems.

I run into a problem when I add in a power meter. The piston sensing the trigger of the power rising above or dropping below the set threshold seems to be having trouble. It’s only sensing the trigger about half of the time.

I’ll troubleshoot more when I can with the logs. Gotta go to bed cause I have to drive to Florida tomorrow for work.

1 Like

Ok. I’ve started setting up some non-essential things in CoRE… and I ran into the first thing that it seems that I can do with Rule Machine much easier than in CoRE - The Toggle Dimmer to % action. - I was originally using the Iris smart button Push and Hold to control two separate LIFX bulbs. I did have one rule for each, but it was a simple trigger - push or hold button would toggle dimmer on to a specific level or off. I was trying to combine both of these rules into one piston, using Or-if, but I had to set up two separate Or-if pistons, one for each, since I had no way to toggle and set the percentage at the same time… it would turn off the light, but the set level and toggle actions fight each other, resulting in in the light just turning off after turning it on with the button.

While it works, if there was a Toggle Dimmer to % action, it would certainly be cleaner, and let me combine both the press and hold action paths into the same piston.

1 Like

What happens if you chain the set level and toggle tasks? Does the setLevel turn on the light making the toggle not work?

Which part of Florida? :wink:

If it helps you… there is a smartapp called Gentle Wake Up out there… It can fade a bulb in or out. I use it to fade my bedroom lights at bedtime. Works decent… it does suffer a bit from, probably the issue being described on here… it’s usually a decent fade, but sometimes it ships a step in the fade which is noticeable, and sometimes it gets halfway through, hangs, then just kills the lights. I imagine it would probably have the same somewhat erratic behaviour if used to ramp the lights on too, but it works decent. It comes with a controller button built in, so I can use CoRE to trigger it and cancel it as needed.

2 Likes

Jason, be aware that “drops” only turns true once, when the level is below but wasn’t the last time. It will not evalute true again until the value actually goes above the threshold and then drops below it again. It works like that by design…

I use Gentle Wake Up as an alarm in our bedroom. Dim from 1% to 100% over 10 minutes, works ok and not any problems so far!

Also use it as a dimmer on the landing as my daughter likes the landing light on when she goes to bed. In this situation I dim from 100% to 0% over 30 minutes. Not got round to using CoRE to trigger this yet, but will look into it

1 Like

Gotta go down to Eglin AFB… Oh yay…

1 Like

That’s fine for this use case. When the pump is off it draws about 1/2 watt, when on about 8 watts. So, it should work just fine.

I’m not sure why is acting like this. I’m thinking I might just have to have two separate pistons for this use. One to react to turning on and one to react to turning off.

1 Like

Yeah I’ll be at the Workin FOB lol

1 Like