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.)
api:
# These services can be called from Home Assistant for manual testing and temporary overrides.
services:
# 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}
then:
- 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
then:
- script.execute: S07_cancel_hold_inout_neutral_zone
# Moves the fan speeds one step UP the ramp
- service: crank_up
then:
- script.execute: S08_crank_up
# Moves the fan speeds one step DOWN the ramp
- service: crank_down
then:
- 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
tap_action:
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:
- Turn the fans on and have them ramp all the way up to the configured full speed.
- Turn the fans off and have them ramp all the way down to off.
- At any point, I can step the fan speeds up or down to the next step of the configured ramps.
- Not shown, but when any of these services are called, they tell the device to ignore temperature triggers for a while (5 minutes).
- The cancel button turns off that hold and lets the temperature triggers have their normal effects.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.