Piston Trigger Question


#1

I’ve built several pistons at this point and largely they work as expected, e.g. IF statements triggered by changes in motion sensors, SHM settings, etc. all trigger when changes occur as I would expect. But I ran into a problem with a Thermostat piston I created. Specifically, I want to adjust the thermostat based upon the outside temperature but to varying set points depending upon the SHM mode.

PROBLEM - The piston is not triggering when the outside temperature changes in my virtual weather station. The weather station refreshes regularly. My first effort was a simple, IF - SHM is X - THEN, and a series of nested IF statements to set the thermostat to different points based upon the outside temp. That didn’t work, but it occurred to me that there wasn’t a “trigger” event to fire the piston. My second effort was to include an additional condition in the top level IF statement to include any CHANGE to the weather station reported temperature. I hoped this would create the necessary trigger. That also failed. The piston never fired.

SOLUTION - I found the magical “Advanced” button on the piston set-up dialog and put in a timer to execute the piston every 60 minutes, which is more than adequate. THIS WORKS. But. . . . . . . .

Why didn’t just a simple conditional IF statement work? It works for my motion sensors, and various other pistons I’ve created. Here though, it fails. What gives?

[Edit - Actual piston inserted for review]


#2

Open your piston and click on the green camera button.
Then copy the image and post on this thread.
As I’m sure you appreciate it can be difficult to advise with limited information.


#3

Indeed I do! I’ve edited the original post to show the piston in question. Thanks for the tip on cut/paste!!


#4

I’m reading the conditions and triggers tutorial… May hold the answers I seek!


#5

Try changing your conditions to ‘Always Subscribe’.
You have a couple of triggers in there and the rest are conditions.
Click on each statement, scroll down to the settings cog, click on it and change subscription method to always.
Not sure if this will help but at least you will know its not a conditions v triggers conflict.


#6

In the first part of your piston.
image
Why are you checking every 60 mins?
Can’t you just let it run and if your IF statements become true it sets your heating points?


#7

I would think it would, but no it doesn’t. Without that timed execute statement this piston will never run. I can’t explain why.


#8

Is it because of the trigger/condition mix?
How about making the conditions always subscribe.


#9

I suspect that may be the issue, I will check when I get back to my laptop. I feel like my original design was much more efficient, but I’d look and find that the temp should have adjusted and simply didn’t. Clicking “test” on the piston and it immediately worked and set everything appropriately. Thus my thinking that a something isn’t triggering it properly, specifically the temperature change on the weather station.


#10

Instead of every 60 minutes at the top, you could try ‘On Events From’ and use your weather station.
I would still subscribe everything though.


#11

Great idea! I will try all that and report back. Still learning this system which frankly is making all my clunky old groovy based apps totally obsolete!!


#12

Okay, honestly I wound up scrapping the old clunky series of IF statements. The “advanced” options (which I don’t think should be hidden from anyone!) opened up a whole new world for me. Rather than IF statements I’ve gone with a SWITCH evaluation. I updated the subscriptions to “always” as suggested but so far this one seems to be executing as expected.

NEW QUESTION: In my case evaluations I’m using a “clunky” set of ranges that I hate. I can’t seem to figure out the syntax to do a {> 32} evaluation in there. So I just did a silly 33-1000 range. That’s fine for this use case, but doesn’t feel right. There’s got to be a better way, but heck if I can figure out the proper syntax. Any ideas or a reference in the docs you could provide?