I have built a heating controller around an ESPHome relay board for my underfloor heating system which is working very well for me.
(You can find the details here: Underfloor heating project for a HA Newbie)
There is one little quirk that I need some help on though:
I have a number of relays (10) that all correspond to a valve in the heating system. And one spare relay which is supposed to be connected to the pump circulating the hot water. The thing is that the pump relay should go active when either of the 10 valve relays go active. And when the last valve relay goes inactive, the pump relay should also switch off. It is a bit like the boolean expression:
relay_pump = relay_valve01 || relay_valve02 || … || relay_valve10
The valve relays are controlled using the thermostat-card (climate-entity), but at the moment I don’t have any way of controlling the pump-relay.
Personally I would literally create a binary sensor in the way you’ve described (call it “pump_should_be_on”) and then use that to drive the pump state.
So far I only had little time to play with the code, but I got as far as making a new binary sensor which combines all of the valves into one value, this code is in configuration.yaml:
template:
- binary_sensor:
- name: Underfloor Heating Circulation Pump Status
unique_id: binary_sensor.pumpcontrol
state: "{{
is_state('switch.relay01','on') or
is_state('switch.relay02','on') or
is_state('switch.relay03','on') or
is_state('switch.relay04','on') or
is_state('switch.relay05','on') or
is_state('switch.relay06','on') or
is_state('switch.relay07','on') or
is_state('switch.relay08','on') or
is_state('switch.relay09','on') or
is_state('switch.relay10','on') or
is_state('switch.relay11','on')
}}"
device_class: "running"
With this I can see the value of this sensor changing with the valves. So far so good.
Next thing is to attach the pump relay (which is also ESPHome) to any changing state of my binary sensor and I am not sure how I should do that. Any suggestions, hints or links to relevant pages are welcome!
You can also have automations defined in ESPHome itself. This way you can be sure that they will run even if HA is down. Take a look here: Automations and Templates — ESPHome