@alanrosesf I changed things a bit… Maybe this will show someone else who has a Centralite Pearl thermostat and Android phones how to save money on home energy costs and simultaneously stay comfortable.
Software required/configured: Centralite Pearl running on SmartThings (I’m using the Zigbee HA 1.2 model), IFTTT configured linked to Google Calendar & SmartThings (among a bunch of other stuff), and both my wife’s phone and my phone linked to SmartThings, and, of course, CoRE working great.
A. IFTTT reads my Google Calendar looking for an event string in the event title. I have three thermostatic “modes” - Mode A, Mode B & Mode C. The Event Description in each one contains a JSON string. All three modes are for “all year,” contain both a heat point and cool point (both a desired setpoint for the thermostat, and a buffer 2-3 degrees higher/lower that triggers a mode change (the Centralite Pearl does not have “auto-changeover” built in, but CoRE can totally do it for you. It worked perfectly last night for instance.)
My “Mode A” JSON in the Event Description is: {“low_t”:“68”;“low_s”:“70”;“high_t”:“74”;“high_s”:“72”} (B is cooler for nighttime, and C is damn near “off” - allowing things to get really cold in the winter or really hot in the summer, but not enough to cause damage to things in the house)
B. I have six virtual switches too; ScheduleA, ScheduleB, ScheduleC, VirtualA, VirtualB, and VirtualC. There’s also very simple event based trigger pistons for this; if ScheduleA switches on, do the following: turn off ScheduleB & C, and take the results of the LOCAL variable low_t and set the GLOBAL ModeAHeatTrigger to it, low_s goes to ModeAHeatSetpoint, high_t becomes ModeACoolTrigger and high_s becomes ModeACoolSetpoint. The things to remember: have the four local variables (low_t, low_s, high_t, high_s) in the three pistons (Schedule A/B/C) initialized, and have “Import Data Event on True” turned on.
The ScheduleA/B/C modes always correspond to the actual schedule (not necessarily what the thermostat is set to do) and always update the temperatures associated with that mode from what is taken from the Google Schedule, so if the wife decides the next time we go to bed to lower the temp, she can do that from Google Calendar without having to know any code.
The VirtualA/B/C switches actually trigger the modes though. There’s a myriad of pistons.
C. Each VirtualA/B/C switch has two pistons associated with it (though with other thermostats, I’m sure you could distill the whole thing down to probably three or maybe even less pistons. I have to split the mode change logic out from the setpoint logic due to the thermostat itself). So, SetModeAExec and SetModeATemp are two different pistons. SetModeATemp looks at VirtualA and if it is switched on, and CURRENTLY, it takes HARDCODED setpoint values (heatpoint at 70, coolpoint at 72) and loads them into the thermostat. I would love to use the “Load attribute from variable” and use ModeAHeatSetpoint and ModeACoolSetpoint, respectively. As it is right now, to set the temperature, the “disable command optimizations” has to be OFF (use command optimizations) to get the setpoints loaded. What does work fine is the triggers for changeover in the other piston, SetModeAExec. It’s an Else-If that, if VirtualA is on, and thermostat’s reported room temperature is less than ModeAHeatTrigger, it sets the thermostat’s MODE to Heat. The Else-If is to do the same for cool. The Else is to flip a dummy switch. Command optimizations have to be OFF for the mode change logic to work.
D. Then there’s another couple pistons that are Else-If’s that examine what mode we’ve switched into, and where the phones are. If either my wife or I are present, and the Schedule is A, it does Mode A. If either my wife or I are present and the Schedule is B, it does Mode B. If the Schedule is C and either of us are present, it does Mode A (this is so if either of us are home when not scheduled to be home (home during a Schedule C) it won’t let the temperature get crazy). If the Schedule is B and neither of us are present it does C (this is so if we forget to turn the schedule off while gone for the night, it doesn’t bother trying to get the house in sleeping conditions). However, if the mode switches to A but no one is home, we want it to do that anyway - it means one of us is scheduled to come home, and we want it to be nice when we walk in the door.
All that logic just flips (and turns off the other two) the appropriate VirtualA/B/C switch.
I’m sure there’s way better ways to do all of this stuff, but it’s been trial and error to get my logic structures to work to be both comfortable and efficient and to find the bugs with my thermostat.
My big goal, and the last step in all thermostatic control for me, will be getting the load attribute from variable function to work.