Just got a second rewrite done of my HVAC system for RM 5.0 last night and am happy with the results testing so wanted to share:
HubiSaver HVAC Control System for RM by Rudi Cilibrasi (cilibrar@gmail.com)
An extensible, efficient, and comfortable HVAC controller for Hubitat
that utilizes sensor fusion so that most people don't need to manually
adjust their thermostats in order to save money.
This system combined presence detection from a mobile phone as well as a
motion sensor to have more reliable presence detection. It has a built in
timer so that whenever any presence is detected it will keep HVAC going for
up to 55 minutes. If there is 56 minutes of no presence detected the HVAC
will turn off until presence is again detected.
This approach saves a lot of energy when you are not home on hot summer
afternoons.
The system is structured with an abstract top level HVAC controller script
that is insulated from particular hardware devices or capabilities. In this
way this system can be easily adjusted or extended to integrate any kind of
thermostat, motion detector, or mobile phone.
TOP LEVEL STATE (Hub variables)
There are two user-set configuration variables:
idealTemperature is the target temperature for inside the home
idleHVACMin is the number of minutes of no presence before HVAC turns off
Global Hub Variables
Name Type Connector
hvacEnabled Boolean Variable
idealTemperature Number Create (suggested initial value: 74)
idleHVACMin Number Create (suggested initial value: 55)
minIdleMinutes Number Variable
minuteCounter Number Variable
noMotionMin Number Variable
noNetworkPresMin Number Variable
thirtySeconds Number Variable
Real Physical Devices
Advanced Honeywell T6 Pro Thermostat
Zooz 4-in-1 Sensor (for Motion detection)
mobile phone (for Wifi based presence detection)
User virtual devices:
iPhone WiFi Presence Sensor (must have phone set up for static IP address)
presence-full Virtual Presence device (System)
If using RuleManager 5.0, also need:
RM 5.0 Connectors for hub variables:
everyHalfMinute
hvacEnabled
minIdleMinutes
minuteCounter
noMotionMin
noNetworkPresMin
thirtySeconds
SOURCE CODE for Rule Machine (5.0 or earlier)
Seven short RM scripts:
everyHalfMinute
everyMinute
hvacToggle
iphone-wifi-presence
minuteHVACController
motionNetworkFusion
motion-present
This timer works around problems with configuring periodic events in
earlier versions of Hubitat platform by making a simple minuteCounter
using a periodic scheduled event that happens every thirty seconds.
everyHalfMinute
TRIGGERS
Every 30 seconds
ACTIONS
Add 1 to thirtySeconds
Set thirtySeconds to (thirtySeconds % 2.0)
everyMinute
TRIGGERS
Variable reports thirtySeconds = 1
ACTIONS
Add 1 to noMotionMinutes
Add 1 to noNetworkPresMin
Add 1 to minuteCounter
hvacToggle
TRIGGERS
presence-full changed
ACTIONS
IF (presence-full present(T) [TRUE]) THEN
Set hvacEnabled to true
ELSE
Set hvacEnabled to false
END-IF
iphone-wifi-presence
TRIGGERS
iphone wifi presence sensor arrives
ACTIONS
Set noNetworkPresMin to 0
minuteHVACController
TRIGGERS
minuteCounter reports variable(739) changed
ACTIONS
IF (Variable hvacEnabled(true) = true(T) [TRUE]) THEN
Thermostats: Advanced Honeywell T6 Pro Thermostat --> Mode: auto --> Heat: idealTemperature(76) --> Cool: idealTemperature(76) --> Fan: auto
ELSE
Thermostats: Advanced Honeywell T6 Pro Thermostat --> Mode: off --> Fan: auto
END-IF
motionNetworkFusion
TRIGGERS
Variable reports noMotionMin "changed"
OR
Variable reports noNetworkPresMin "changed"
ACTIONS
Set minIdleMinutes to noMotionMin
IF (noNetworkPresMin < minIdleMinutes) THEN
minIdleMinutes = noNetworkPresMin
END-IF
IF (minIdleMinutes < idleHVACMin) THEN
arrived() on presence-full
ELSE
departed() on presence-full
END-IF
motion-present
TRIGGERS
zooz 4-in-1 sensor 01 active
ACTIONS
Set noMotionMinutes to 0