Creating a complex thermostat schedule


#1

1) Give a description of the problem
I want to implement a schedule for a Gym in my home town with their smart thermostats. The problem is that they wont cool when a set the heating point.

2) What is the expected behaviour?
I want the theromostat to heat 21 Degrees during some group lessons like Yoga, but after the lesson ends i need it to go back to 14 when it ends.

3) What is happening/not happening?
The temperture is snapping back to 14 or the commends wil get an error

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

here is the schedule, sorry it is in dutch but i think you guys will understand


#2

There are MANY ways you can do this. You have multiple thermostat changes throughout the day/week. I envision a somewhat complex piston with multiple IF-THEN-ELSE statements for each day, based on time. But ELSE statements may do things unexpectedly. And I think that would get somewhat complicated to maintain. Others will probably disagree, but I would consider writing a single piston for each day. Something like :

Every day at 10:00 but only on Monday
Set temp to 21

Every day at 11:00 but only on Monday
Set temp to 14

Every day at 20:30 but only on Monday
Set temp to 21

Every day at 21:30 but only on Monday
Set temp to 14

You could write a segment of code for each day (like above) and combine it all into a single piston. But my first thought here is that it would be easier (for me) to have a piston for each day.


#3

@Pantheon’s idea is dead on…

My notes is on your current piston,
The reason it doesn’t work because you have an IF block WITHIN an IF block… that is not possible to execute.
The time has to be BEFORE 11.00 and AFTER 11.00 AT THE SAME TIME for this piston to execute…

Separate the second IF block.

But again, above idea is great. Each day gets it’s own piston…


#4

Sorry to butt in… but I notice that 90% of the events are exactly one hour long… If you wanted all heating cycles to last for an hour, I know a way to reduce @Pantheon’s code by half.

Let me know if you are interested…


#5

Me!..Me! I’m interested :slight_smile:


#6

The reset afterwards can be achieved easily if you use a Simulated Switch…

Every day at 10:00 but only on Monday
    Set temp to 21
    Turn on SimSwitchYoga
END EVERY

Every day at 20:30 but only on Monday
    Set temp to 21
    Turn on SimSwitchYoga
END EVERY

etc

IF SimSwitchYoga's switch stays on for 1 hour
    Set temp to 14
    Turn off SimSwitchYoga
END IF

This method reduces your triggers by half, but only works if the ‘on’ durations are all the same…


#7

Thanks everyone for all your reaction! I will be implementing @Pantheon idea right away; I needs to be working ASSAP.

After that I will be looking into @WCmore, im still a bit new to this and need to learn what a simulated switch is. I will be needing this sort of code more in the future so cutting a code in half would be handy :stuck_out_tongue:

I will keep you guys updated when it will be running
Thanks again


#8

This is the piston i made for Thurday

+1ms ╔Received event [Sport2BFit].test = 1574935361623 with a delay of 1ms
+91ms ║RunTime Analysis CS > 21ms > PS > 42ms > PE > 27ms > CE
+94ms ║Runtime (39144 bytes) successfully initialized in 42ms (v0.3.10e.20190628) (90ms)
+95ms ║╔Execution stage started
+110ms ║║Comparison (time) 39761726 is_after (time) 36000000 = true (6ms)
+112ms ║║Time restriction check passed
+114ms ║║Condition #2 evaluated true (12ms)
+117ms ║║Cancelling statement #2’s schedules…
+121ms ║║Requesting time schedule wake up at Fri, Nov 29 2019 @ 12:00:00 AM CET
+126ms ║║Condition group #1 evaluated true (state did not change) (25ms)
+129ms ║║Cancelling statement #3’s schedules…
+1488ms ║║Executed physical command [Verwarming Kleine Zaal 1].setHeatingSetpoint([21.0]) (1350ms)
+1489ms ║║Executed [Verwarming Kleine Zaal 1].setHeatingSetpoint (1353ms)
+1545ms ║║Executed physical command [Verwarming Kleine Zaal 2].setHeatingSetpoint([21.0]) (52ms)
+1546ms ║║Executed [Verwarming Kleine Zaal 2].setHeatingSetpoint (54ms)
+1593ms ║║Executed physical command [Verwarming Kleine Zaal 3].setHeatingSetpoint([21.0]) (43ms)
+1594ms ║║Executed [Verwarming Kleine Zaal 3].setHeatingSetpoint (45ms)
+1639ms ║║Executed physical command [Verwarming Kleine Zaal 4].setHeatingSetpoint([21.0]) (41ms)
+1641ms ║║Executed [Verwarming Kleine Zaal 4].setHeatingSetpoint (43ms)
+1653ms ║║Comparison (time) 39763268 is_after (time) 39600000 = true (7ms)
+1655ms ║║Time restriction check passed
+1657ms ║║Condition #6 evaluated true (12ms)
+1662ms ║║Cancelling statement #6’s schedules…
+1667ms ║║Requesting time schedule wake up at Fri, Nov 29 2019 @ 12:00:00 AM CET
+1670ms ║║Condition group #5 evaluated true (state did not change) (25ms)
+1672ms ║║Cancelling statement #7’s schedules…
+1718ms ║║Executed physical command [Verwarming Kleine Zaal 1].setHeatingSetpoint([14.0]) (41ms)
+1719ms ║║Executed [Verwarming Kleine Zaal 1].setHeatingSetpoint (43ms)
+1760ms ║║Executed physical command [Verwarming Kleine Zaal 2].setHeatingSetpoint([14.0]) (39ms)
+1761ms ║║Executed [Verwarming Kleine Zaal 2].setHeatingSetpoint (41ms)
+1831ms ║║Executed physical command [Verwarming Kleine Zaal 3].setHeatingSetpoint([14.0]) (68ms)
+1832ms ║║Executed [Verwarming Kleine Zaal 3].setHeatingSetpoint (70ms)
+1875ms ║║Executed physical command [Verwarming Kleine Zaal 4].setHeatingSetpoint([14.0]) (41ms)
+1876ms ║║Executed [Verwarming Kleine Zaal 4].setHeatingSetpoint (43ms)
+1890ms ║║Comparison (time) 39763505 is_after (time) 70200000 = false (6ms)
+1891ms ║║Condition #10 evaluated false (10ms)
+1893ms ║║Cancelling statement #10’s schedules…
+1897ms ║║Requesting time schedule wake up at Thu, Nov 28 2019 @ 7:30:00 PM CET
+1900ms ║║Condition group #9 evaluated false (state did not change) (19ms)
+1910ms ║║Comparison (time) 39763527 is_after (time) 73800000 = false (6ms)
+1912ms ║║Condition #14 evaluated false (9ms)
+1914ms ║║Cancelling statement #14’s schedules…
+1919ms ║║Requesting time schedule wake up at Thu, Nov 28 2019 @ 8:30:00 PM CET
+1921ms ║║Condition group #13 evaluated false (state did not change) (19ms)
+1953ms ║╚Execution stage complete. (1859ms)
+1958ms ║Setting up scheduled job for Thu, Nov 28 2019 @ 7:30:00 PM CET (in 30436.419s), with 3 more jobs pending
+1968ms ╚Event processed successfully (1968ms)

#9

You are getting there…But, I’m concerned about your piston. Others (@ike2018, @WCmore) can check me on this. But I think each successive IF will be true each time the piston runs because of the “If Time is after…”. Your piston will execute from top to bottom at least 4 times on Thursday. And each IF statement will be true as time goes from “after 10:00”, “after 11:00”, “after 19:30” and “after 20:30”. So your piston will be making multiple thermostat changes each time it runs. I would use the “Every day at 10:00”, “Every day at 11:00” etc…so that those instructions (thermostat changes) will only occur ONCE a day at your specified times.


#10

You can find the “Every day at…” here :


#11

I get what you mean now! Something like this ?


#12

:+1: I think that will work for you.


#13

Thanks you, i will keep you updated!!


#14

great catch


#15

Now that Google has taking over the Nest and we can no longer talk to them I went out and purchased Ecobee’s and have started to create my own complex piston to support multiple thermostats and smart vents. Yes I know there are two of these, at least, out there that people are using. One you have to pay for and the other is OK but I would rather put my own fate in my own hands. So I am just wondering who else is out there that went the same route and doing their own thing with webcore. I have created my own but have a little more work to do to fine tune. It is pretty complex so dont want to send it out there till I have fixed a few kinks. It is made up of a few pistons and has a daily schedule and again it controls multiple thermostats and smartvents.


#16

I use Honeywell thermostats. Most of my settings and control are done with webcore.