How to set up an outlet that turns itself off after a set interval (how to get hot water without going into hot water...).

Cupertino, January 2, 2024

How to set up an outlet that turns itself off

I have a recirculation pump on my hot water heater (basement) which allows me to avoid wasting water while waiting for the shower (upstairs) to heat up. I want to run a bit every morning and evening (eg via automations) and I also want to be able to push it (eg a button on my phone's widgets page) at other times and run for 5 minutes and then turn itself off. off (so I don't forget). I spent some time trying to get around this behavior using the Home app and the Home+ app, looking at automations, scenes, hub shortcuts, and phone shortcuts. The shortcuts on the phone \_almost\_ worked if the phone went to sleep, the pump was never turned off. I ended up solving it using [RavenCore v2 (aka HomeKit Architect Assistant) firmware](https://github.com/RavenSystem/esp-homekit-devices) on an Athom US v2 connector; RavenCore v2 allows me to define multiple HomeKit services on a single device. I defined: * a "socket" that turned on and off normally and could be toggled by a double press of the button; and * an "outlet" that turned on and off normally, but had an associated timer (via the "inching" configuration) that would turn it off after a set interval and could be toggled with a single push of the button. The Home app sees two accessories ("sockets"), I added time-based automations to the first "socket" and defined a shortcut in the Shortcut app that starts the second "socket". Problem solved. I thought I'd share a how-to here on the off chance that it might be helpful to other people.

[The Home Architect Assistant wiki](https://github.com/RavenSystem/esp-homekit-devices/wiki) is excellent and has everything you need to install and configure the firmware. My Athom connection was running Tasmota (they sell them preflashed) so I was able to use the Tasmota firmware update page to install the HAA firmware `tasmota2haa.bin.gz`. It provides an access point (HAA-XXXXXX) that you can use to provide your Wi-Fi information and then proceeds to download and install the main firmware. It takes ~5 minutes to install and boot each of these firmwares, patience is a virtue. I found it useful to run a ping in a terminal window so I could watch it reboot itself. The other useful information might be my MEPLHAA script (configuration). It is configured for the Athom socket, similar sockets probably just need to adjust the GPIOs. * defines GPIO 12 and 13 as binary outputs * defines GPIO 5 as a binary input with button behavior * declares that there is an LED on GPIO 13 * sets an 8 second button press on GPIO 5 to restart the socket in push mode configuration * adds two "socket" services that are very similar * when off set GPIO 12 to 0 * when on set GPIO 12 to 1 * when one is on use a message service (`m`) to set the state of the other to disabled (turning on the timer overwrites the fact that it was already on, turning on the "normal" outlet cancels the fact that there was a timer running) * configures a button for each service (single press for timed outlet, double press for normal outlet) * **BUT/AND** the timer socket sets an "inching" (`i`) value of 360 seconds so that it turns itself off 6 minutes after powering on. Here's the corresponding JSON (I compact it into a single line with `jq -c` before pasting it into the config box, which HAA recommends to "save memory"). { "c": { "io": [
[
[
12,
13
]2 ],
[
[
5
]6 ]], "l": 13, "b": [
[
5,
5
]
]}, "A": [
{
"t": 2,
"0": {
"r": [
[
12
]
]}, "1": { "r": [
[
12,
1
]
], "m": [
[
2,
2
]
]}, "b": [
[
5,
2
]
]}, { "t": 2, "i": 360, "0": { "r": [
[
12
]
]}, "1": { "r": [
[
12,
1
]
], "m": [
[
1,
2
]
]}, "b": [
[
5,
1
]
]} ]}

Best selling & Top trending HomeKit product in our shop at this moment

HomeKit.Blog is in no way affiliated with or endorsed by Apple Inc. or Apple related subsidiaries.

All images, videos and logos are the copyright of the respective rights holders, and this website does not claim ownership or copyright of the aforementioned.

All information about products mentioned on this site has been collected in good faith. However, the information relating to them, may not be 100% accurate, as we only rely on the information we are able to gather from the companies themselves or the resellers who stock these products, and therefore cannot be held responsible for any inaccuracies arising from the aforementioned sources, or any subsequent changes that are made that we have not been made aware of.

HomeKit.Blog Is A Participant In The Amazon Services LLC Associates Program, An Affiliate Advertising Program Designed To Provide A Means For Sites To Earn Advertising Fees By Advertising And Linking To Amazon Store (Amazon.com, Or Endless.com, MYHABIT.com, SmallParts.com, Or AmazonWireless.com).

The opinions expressed on this website by our contributors do not necessarily represent the views of the website owners. 

Copyright © 2022 HomeKit Blog
. All rights reserved
United States