Home Assistant integration

A project log for Ventbot: warm side cool, cool side warm

A speculative DIY register booster project to even out the temps around my home.

WJCarpenterWJCarpenter 12/02/2022 at 21:340 Comments

In case someone else wants to build some of these, I'm designing it with no external dependencies. The devices can operate completely standalone once built and configured. However, I do run Home Assistant in my house, and it's fairly easy to integrate ESPHome devices with Home Assistant. In particular, you can define services on the ESPHome device and call those services from Home Assistant. I never fooled around with that stuff before, but I found it pleasantly easy to set up.

This might change in the final form, but here's all it takes to define the services on the ESPHome device. (Most of the logic resides in separate ESPHome scripts, not shown in this listing. Except for the names being suggestive, don't worry about the implementation logic at this point. Those will be visible in the ESPHome config file when it's ready and published.)

  # These services can be called from Home Assistant for manual testing and temporary overrides.

    # Force pretending that the temperature is either in (true) or out (false) of the neutral zone.
    # Temperature sensor readings will be ignored until the duration expires or the hold is
    # canceled.
    - service: set_inout_neutral_zone_and_hold
      variables: {in_neutral_zone: bool, duration_seconds: int}
        - globals.set:
            id: IN_NEUTRAL_ZONE
            value: !lambda 'return in_neutral_zone;'
        - script.execute:
            id: S10_set_inout_neutral_zone_and_hold
            in_neutral_zone: !lambda 'return in_neutral_zone;'
            duration_seconds: !lambda 'return duration_seconds;'

    # This can be used to cancel the above hold action before the duration has expired.
    - service: cancel_hold_inout_neutral_zone
        - script.execute: S07_cancel_hold_inout_neutral_zone

    # Moves the fan speeds one step UP the ramp
    - service: crank_up
        - script.execute: S08_crank_up

    # Moves the fan speeds one step DOWN the ramp
    - service: crank_down
        - script.execute: S09_crank_down

 I made a simple Home Assistant dashboard for my breadboard rig. 

The bottom portion is just normal Home Assistant despiction of entities from the device. The top row of buttons were created with custom:button-card, a popular Home Assistant add-on. It doesn't have a GUI editor, but here is the raw YAML configuration for the leftmost button:

name: Step Up
show_name: true
show_icon: true
type: custom:button-card
  action: call-service
  service: ESPHome.ventbot_f56ed8_crank_up
entity: automation.ventbot
icon: mdi:fan-chevron-up
show_state: false

 You can see that it calls the "crank_up" service defined on an ESPHome device known to Home Assistant as "ventbot_f56ed8" (the hex stuff is part of that device's specific MAC address, for disambiguation).

With these services and controls, I can: