Ecobee Control During Holidays

Hello everyone, I wanted to share a new rule that I implemented for my Ecobee thermostats. I do not use the presence sensors to control my schedule (our schedule is pretty rigid), so I wanted to be able to automatically prevent our thermostats from going into away mode during the week on public holidays, such as Memorial Day. Here is my solution.

First, I wrote a rule that switches sPublicHoliday to ON or OFF at midnight based on if/then statements. There are plenty of programming sites where the work has already been done.

Then, I use that switch in the following rule every time the “program.currentClimateRef” item changes to ‘away’ for any of my thermostats. If the current day is a public holiday and the thermostats are not in vacation mode (sOnVacation), the rule will set the climate back to “home.”

rule "Set Home on Public Holiday"
when
Item tDiningRoomCurrentClimate changed to “away” or
Item tMBRCurrentClimate changed to “away” or
Item tKitchenCurrentClimate changed to "away"
then
if (sPublicHoliday.state == ON && sOnVacation.state != ON) {
logInfo(“HVAC Controller”, “Setting thermostats back to home because it is a public holiday, so you’re probably home.”)
if (tDiningRoomCurrentClimate.state == “away”) {
ecobeeSetHold(tDiningRoomCurrentClimate, null, null, “home”, null, null, “nextTransition”, null)

  }
      if (tMBRCurrentClimate.state == "away") {
  	ecobeeSetHold(tMBRCurrentClimate, null, null, "home", null, null, "nextTransition", null)
  }

  if (tKitchenCurrentClimate.state == "away") {
  	ecobeeSetHold(tKitchenCurrentClimate, null, null, "home", null, null, "nextTransition", null)
  }

}
end

1 Like

This is a really good generic design pattern. I use a similar approach with time of day and notifications.

The only recommended improvement can suggest is if you end up with more than two states, change to use a String Item to represent the type of day instead of creating lots of switches. The resulting code will end up simpler to use and maintain.

Very nice! Yours is a good example of augmenting the thermostat’s built-in logic without trying to take over its basic functions, so even if your rule weren’t running, the thermostats are still doing their jobs.

Be aware that in the upcoming 1.9.0 release of the binding and action JARs, I had to change the action calls to take a String instead of an Item as the first parameter (for OH2 compatibility), so your calls to ecobeeSetHold will have to change to take a thermostat ID string (the long decimal number you use in binding config strings) instead of an Item.