CoRE - Get peer assistance here with setting up Pistons

Welcome to the CoRE Logic Thread. Here you will find many community members that are more than willing to help you with the Logic and Programming of your Pistons.

**There will be another thread for “How are you using CoRE?” and “How are you using the CoRE/AskAlexa integration?”.

So, this is the place to ask your questions and the place to get the answers.

24 Likes

Jason, I know you were trying to use the power meter but ran into issues, were you able to set up a piston like:

IF power greater than X
THEN do something

without firing every time the power changes above X

1 Like

I haven’t got the hang of the capture / restore state.

What I want is if lamp is off than turn on when closet door is open and off when closed (got that part easily).

What I cannot get working is using capture / restore state if the lamp is already on as the level would need to ramp from 20% to 100% and back to 20%

I tried this but no workie:

Hi,
First, thank you for everything you doing for this community!

I’m trying to see I can count the number of toggles form a specific switch with in a specific time.
something like -

IF
Switch is toggle
and then 
Switch is toggled again within 2 sec
and then 
Switch is toggled again within 2 sec

THEN
do something

I know I need to use the variables in some way, but I can’t understand how…
I did try to set a $second variable, but I don’t now how to use it…

Can you please give me some directions on where to start?

Gil :slight_smile:

I found that the power meter like to fluctuate on the reading, so when I was using the conditions “is greater than” or “is within range” the piston would evaluate every time the power reading changed.

I had to go with triggers to get it to behave.

Changes to, raises above, enters range - these triggers worked well, I just had to excitement and find the best one for my use case.

I actually used “raises above” to initiate the piston and then “enters range” turn it off.

2 Likes

I’ve been working on this as well, but I think there is still a bug.

I’m using a latching piston that captures the state of my bulbs when a switch turns on. It then restores them when the switch is turned off.

It does everything as programmed, but it does not restore the lights back. It is setting the levels properly, just not the colors.

Try this piston as it may work well for you.

@ady624

Hi Gil! !

Take a look at this piston and see if you can modify it to work for you.

This piston counts the number of times the dog food container has been opened, sends a message when it reaches 3 times it more, and resets the counter at midnight.

****note - not positive the counter reset is working. I have this one as an example I helped someone else with and I don’t actually use it.

2 Likes

Thank you, I will try to see what I manage to achieve and report back.

Gil :slight_smile:

1 Like

Jason, a lot of the attributes you selected override each other. colorTemperature for example affects hue and saturation. Try using only hue, saturation and level. Those three fully describe the color. Or try color alone, though I noticed that uses RGB.

I’ll try that and let you know. Fyi - This is using Phillips hue color bulbs

I took a stab at what you want to do, see if this makes sense. You will have to edit it since it counts 2 for each toggle I tested :slight_smile:

Edit: Looking at it now, it seems I should have put the Tasks outside of the group.

1 Like

Thank you, I will try this one as well…

Gil :slight_smile:

I fixed my double count

1 Like

@ady624

I can’t find a combination of the attributes that makes this work…

Not sure what’s up.

I do know when Bruce was setting this up in RM it would act differently with different brands of lights… I’m not sure what he had to do to get it to work.

Maybe there should be a dedicated capture and restore just for bulbs?

I just posted about this in the original thread, I thought it was similar to what you saw but for some reason didn’t connect the dots. Seems to me this shouldn’t be an issue with historical conditions vs current conditions. Like CoRE is evaluating the conditions as “did it change” followed by “is it in bounds” instead of the historical “did this go over/under in time specified.” Will try my other rule with trigger instead, thank you!

1 Like

This was for me :slight_smile: I added it but couldn’t get it to work. My biggest problem in troubleshooting - how do I check the value of the variable? I can’t find anywhere to read the value, thus can’t tell why it’s not firing the audio. I can tell in notifications that upon the container changing to open, the piston fires, but that is all.

Thanks

The dashboard lists all variables for the piston. Also the Local Variables page in the piston

Secsess!!
Based on the exemples of @bamarayne and @eibyer, I have managed to create something that works for me…
So far it works great!

Do I have any major mistakes in there?
Can I make it more simple?

Thanks!
Gil :slight_smile:

1 Like

Does anyone know why this extremely simple piston makes the light come on instantly at

100% instead of fading over 50 seconds like I programmed it to?

How is it switched off… By setting level to 0% or by switch turning off