Close

Home Assistant in the middle

A project log for Calling for hot water

Remote controlled buttons for activating hot water recirculation.

wjcarpenterWJCarpenter 09/10/2023 at 21:030 Comments

Having great frameworks like Home Assistant and ESPHome makes it simple to do simple things. It's like many other IRL infrastructure things that act as multipliers for add-on projects. There are lots of ways to accomplish this in those frameworks, and I'm using mechanisms that make the most sense to me.

For this project, I've chosen to make Home Assistant automation the centerpiece tying things together. The overall flow looks like this:

  1. Someone presses one of the buttons.
  2. Home Assistant detects that button press as a trigger for an automation.
  3. Home Assistant "presses the button" that momentarily activates the relay.
  4. Home Assistant turns on the LED on the D1 Mini.
  5. The water heater starts the recirculation pump.
  6. Home Assistant calls the "set_led_hot" service on each Atom device.
  7. A timed delay happens.
  8. Home Assistant turns off the LED on the D1 Mini.
  9. Home Assistant calls the "set_led_cold" service on each Atom device.

The timed delay isn't the greatest situation. It means that Home Assistant has to know the timer configuration for the recirculation pump on the water heater. I'm hoping to eventually figure out a way of detecting if the pump is actually running and use that instead of a timer. I have plenty of spare GPIOs on the D1 Mini to use for that.

I've only got one Atom configured right now. Additional devices will be added to the triggers, along with the button on the D1 Mini. Here's what the automation looks like (the timeout is temporarily set to 15 seconds for testing purposes):

alias: Tankless hot button
description: Press the button, get hot water
trigger:
  - platform: state
    entity_id:
      - binary_sensor.hotbuttonkb_button
    from: "off"
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.hotbuttonrelay_button
    from: "off"
    to: "on"
condition: []
action:
  - type: turn_on
    device_id: 631ea0d418d7508fdbf35e046f077906
    entity_id: 556da559467ce707e6dd9f6c5ad39797
    domain: switch
  - type: turn_on
    device_id: 631ea0d418d7508fdbf35e046f077906
    entity_id: 2a370e76eeb5971f48e70e2f75f500e7
    domain: switch
  - service: esphome.hotbuttonkb_set_led_hot
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - service: esphome.hotbuttonkb_set_led_cold
    data: {}
  - type: turn_off
    device_id: 631ea0d418d7508fdbf35e046f077906
    entity_id: 2a370e76eeb5971f48e70e2f75f500e7
    domain: switch
mode: restart

The device and entity IDs in the YAML make it a little tricky to see what's going on, so here is a GUI screenshot of the same automation:

Discussions