From 6a45ee34e70b13409562394dd6670222c2721e87 Mon Sep 17 00:00:00 2001 From: Martin Sebald Date: Tue, 14 Nov 2017 17:59:36 +0100 Subject: [PATCH] added heating rules --- README.md | 3 +++ heating/README.md | 10 ++++++++ heating/heizungen.rules | 54 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 heating/README.md create mode 100644 heating/heizungen.rules diff --git a/README.md b/README.md index 1c716f4..232171e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ If you find problems or errors, please [let me know](https://www.sebald.com/kont The stuff I provide is based on [openHABian](http://docs.openhab.org/installation/openhabian.html) on a Raspberry Pi 3 using openHAB 2.1 and sometimes might reflect on my own (sometimes special) hardware and environment in and around my house. +## heating +Some heating rules, based on a time schedule, presence and TV status. + ## presence Wifi Presence - Detect a person with his/her smartphone entering or leaving the wireless home network (based on a Fritzbox and two DD-WRT based access points). diff --git a/heating/README.md b/heating/README.md new file mode 100644 index 0000000..501567c --- /dev/null +++ b/heating/README.md @@ -0,0 +1,10 @@ +# Heating rules +Some heating rules, based on a time schedule, presence and TV status. + +I use HomeMatic controls for our heating devices. These example rule only covers one of six HomeMatic controls. Also the time schedule is just an example. You can add as many on and off timers as you like. + +The rules also check if someone is at home (I use presence detection by wifi, setup see here in the repository) and if the TV in the living room is (still) on or already turned off. If nobody is at home when the heating time period starts, it will not adjust the temperature setting and wait until someone returns home during the heating time period. Also if everybody leaves home during the heating time period the temperature is lowered to the off-temperature. + +Btw: With HomeMatic devices it does not make much sense in my eyes to turn off the heaters, so I just lower the temperature to a basic temperature which I want inside all the time, even if there is nobody at home or in the room. + +* **heizungen.items**: Put this file into your */etc/openhab2/rules* directory and modify it for your specific setup. \ No newline at end of file diff --git a/heating/heizungen.rules b/heating/heizungen.rules new file mode 100644 index 0000000..7f620fd --- /dev/null +++ b/heating/heizungen.rules @@ -0,0 +1,54 @@ +// Turn on heating if someone is at home +rule "Heizung Wohnzimmer ein" + when + Time cron "0 30 6 ? * MON" or + Time cron "0 30 6 ? * TUE" or + Time cron "0 30 6 ? * WED" or + Time cron "0 30 6 ? * THU" or + Time cron "0 30 6 ? * FRI" or + Time cron "0 0 8 ? * SAT" or + Time cron "0 0 8 ? * SUN" + then + ThermostatEGWohnzimmer_Status.sendCommand(ON) + if (Presence_Overall.state==ON) { + sendCommand(ThermostatEGWohnzimmer_4_SetTemperature, 19) + } +end + +// Turn on heating if someone returns home during heating time period +rule "Heizung Wohnzimmer ein 2" + when + Item Presence_Overall received command ON + then + if (ThermostatEGWohnzimmer_Status.state==ON) { + sendCommand(ThermostatEGWohnzimmer_4_SetTemperature, 19) + } +end + +// Turn off (turn to a lower temperature) heating if everybody has left home or heating time period is over +rule "Heizung Wohnzimmer aus" + when + Item Presence_Overall received command OFF or + Time cron "0 0 22 ? * MON" or + Time cron "0 0 22 ? * TUE" or + Time cron "0 0 22 ? * WED" or + Time cron "0 0 22 ? * THU" or + Time cron "0 0 22 ? * FRI" or + Time cron "0 0 22 ? * SAT" or + Time cron "0 0 22 ? * SUN" + then + ThermostatEGWohnzimmer_Status.sendCommand(OFF) + if (TV_Power.state==OFF) { + sendCommand(ThermostatEGWohnzimmer_4_SetTemperature, 16) + } +end + +// Turn off (turn to a lower temperature) heating after TV has turned off +rule "Heizung Wohnzimmer aus TV aus" + when + Item TV_Power changed from ON to OFF + then + if (ThermostatEGWohnzimmer_Status.state==OFF) { + sendCommand(ThermostatEGWohnzimmer_4_SetTemperature, 16) + } +end