Skip to content

Comparison of temperatures for triggers and notifications in HomeKit

Comparison of temperatures for triggers and notifications in HomeKit

Some posts (now archived) noted the need to compare temperatures from multiple sensors in the HomeKit. For example, it could be used to start a fan in the attic if the outside temperature drops below the inside temperature. There are no examples posted on AFAIK to demonstrate a way to do this. Here is an example, quite heroic, because it involves homebridge, infinitude, json decoding, an apache / php server with PHP script, an Apple shortcut and the pushcut application. In San Francisco it can be heated enough (despite claims to the contrary) that air conditioning is very welcome. But when the fog forms, the temperature drops very quickly and you can run cooler when the temperature outside is 10 degrees colder than inside. We wanted an iPhone / AppleWatch notification to remind us to open windows when this happens. The notification is set to work if the outside temperature is lower than inside and the heat pump cools down. I have homebridge running on a pi raspberry. A second raspberry pi runs infinitude and an Apache server and serves a number of php files for http calls. (Infinitude provides JSON data from a Carrier Infinity heat pump thermostat because Carrier does not provide any HomeKit APIs or support (ahem!).) The Homebridge HTTP-SWITCH plugin creates a HomeKit switch and turns it on and off based on a model state. is appropriate. I configured it as follows in HomeBridge: {“accessory”: “HTTP-SWITCH”, “name”: “OpenUpstWindows”, “switchType”: “stateful”, “onUrl”: “http://172.16.1.57/ opentheLRdoor .php “,” offUrl “:” http://172.16.1.57/opentheLRdoor.php “,” statusUrl “:” http://172.16.1.57/opentheLRdoor.php “,” statusPattern “:” true “,” pullInterval “: 60000}, the ph file opentheLRdoor.php reaches the internal (rt) and external (oats) temperatures and the state of the heat pump in different areas. If the outside (garden) is cooler than the inside and the cooling state is active (active _cool), it returns “true”, so the HomeUk OpenUpstWindows switch is activated by the homebridge. $ dnstairs); $ upcooloutside = $ gradina <$ sus; if (($ upcooloutside) și ($ upcoolheat == "active_cool")) {echo "true"; } else {echo "false"; }?> A HomeKit automation is triggered on the OpenUpstWindows switch and runs a shortcut that calls a pushcut application URL that then generates the corresponding notification. The shortcut uses the “URL” and “get the contents of the URL” entry. Because pushcut works for a single Apple account, I had to have 2 calls to receive notifications from both me and my wife. Maybe one day this type of heroic will no longer be necessary, and temperature comparisons and more complete automation options and notifications will be available in the HomeKit.