# Limit piston to only turning on during certain months

#1

1) Give a description of the problem
I have an old house with a VERY old Airconditioner which through some smart home witchcraft have managed to connect to both Google Home and ST (anyone wanting more information on how to connect a 25yr old A/C to ST feel free to contact me). However, I want to create a piston that reacts to a temperature sensor in one of my ST buttons in my home to turn the A/C on when the temp is above X⁰ but only during certain months. The reason being is I don’t want it coming on during the winter months when my central gas heating is trying to warm the house creating what I only imagine would be a super Saiyan battle between the two resulting in the ultimate destruction of the universe (or more likely my energy bill). Before anyone suggests smart thermostats etc to fix the whole thing this is, unfortunately, a rental property so changing the infrastructure of the house it out of the question, and I don’t want to invest in a sensibo unit as I’ve hear mixed reviews about them especially if you have an old A/C unit like mine.

2) What is the expected behaviour?
If ST button registers temp above X⁰ and it is December, January or February then turn on A/C. If not, do nothing.

3) What is happening/not happening?
I have tried adding a limitation using a restriction however I can’t seem to get the piston to register multiple different months.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
|+0ms|╔Received event [212 Montague].test = 1578896304241 with a delay of 0ms|
|—|---|
|+80ms|║RunTime Analysis CS > 24ms > PS > 34ms > PE > 22ms > CE|
|+83ms|║Runtime (38890 bytes) successfully initialized in 34ms (v0.3.110.20191009) (81ms)|
|+84ms|║╔Execution stage started|
|+93ms|║║Comparison (integer) 1 is_equal_to (integer) 1 = true (2ms)|
|+94ms|║║Condition #11 evaluated true (5ms)|
|+96ms|║║Condition group #10 evaluated true (state did not change) (7ms)|
|+97ms|║║Cancelling condition #1’s schedules…|
|+98ms|║║Condition group #1 evaluated true (state changed) (9ms)|
|+105ms|║║Comparison (decimal) 24.0 is_greater_than_or_equal_to (integer) 25 = false (1ms)|
|+107ms|║║Condition #2 evaluated false (8ms)|
|+108ms|║║Cancelling condition #1’s schedules…|
|+109ms|║║Condition group #1 evaluated false (state changed) (11ms)|
|+118ms|║║Comparison (decimal) 24.0 is_less_than_or_equal_to (integer) 22 = false (1ms)|
|+120ms|║║Condition #7 evaluated false (8ms)|
|+121ms|║║Condition group #6 evaluated false (state did not change) (10ms)|
|+126ms|║╚Execution stage complete. (43ms)|
|+128ms|╚Event processed successfully (127ms)|

#2

There are MANY ways to do this. See Where is the setting for between certain months? for assistance.

``````IF Keypad 2 temperature rises to or above 25      (Trigger)
AND
Time is any, but only in January, February, or December    (Condition)
Then
With Switch 1
Turn ON
END IF

IF Keypad 2 temperature drops to or below 22     (Trigger)
AND
Time is any, but only in January, February, or December    (Condition)
Then
With Switch 1
Turn OFF
END IF``````

#3

Here is how I do it:

``````IF Keypad's temperature is greater than 25°C
Then
IF \$month is NOT between 3 and 11
Then
Turn on
END IF
END IF

IF Keypad's temperature is less than 23°C
Then
Turn off
END IF
``````

Pro Tip:

This piston is best kept clean and concise, since it will `trigger` at every single temperature change.