-
Notifications
You must be signed in to change notification settings - Fork 6
Water Heaters
The Home Assistant implementation of a water heater works pretty well for pool heaters. There are a couple of things I've done to improve how the base entity works that might be helpful to others.
There are a couple of great cards which will give you a nice look and control for your Water Heater. (Note that if you have your Home Assistant set to metric, your water heater will be in Celcius for the time being - the water heater entity in Home Assistant doesn't yet support custom units of measure).
You will need two custom cards from the HACS repository for this to work:
- custom:water-heater-card
- custom:button-card
Then the following YAML will give you the card shown above:
cards:
- entity: water_heater.POOL_HEATER_ENTITY
name: Pool Heater
sensors:
- entity: sensor.POOL_WATER_TEMP_SENSOR_ENTITY
name: Water Temperature
- entity: sensor.POOL_AIR_TEMP_SENSOR_ENTITY
name: Air Temperature
- entity: water_heater.POOL_HEATER_ENTITY
name: Heater Running
- attribute: operation_mode
entity: water_heater.POOL_HEATER_ENTITY
name: Operating Mode
type: custom:water-heater-card
- cards:
- icon: mdi:fire
layout: icon_name_state2nd
name: 'Heater Mode:'
show_label: true
state:
- icon: mdi:toggle-switch
label: 'On'
operator: template
value: |
[[[
return states['water_heater.POOL_HEATER_ENTITY'].attributes.operation_mode == 'on';
]]]
- icon: mdi:toggle-switch-off
label: 'Off'
operator: template
value: |
[[[
return states['water_heater.POOL_HEATER_ENTITY'].attributes.operation_mode == 'off';
]]]
tap_action:
action: call-service
service: water_heater.set_operation_mode
service_data:
entity_id: water_heater.POOL_HEATER_ENTITY
operation_mode: |
[[[
if (states['water_heater.POOL_HEATER_ENTITY'].attributes.operation_mode == 'on')
return "off";
else
return "on";
]]]
type: custom:button-card
type: horizontal-stack
type: vertical-stack
I like to know how long my heater has run for gas/energy tracking purposes (and to shame myself into putting on my solar blanket more often). To do that I created a custom sensor using the history_stats
platform that tracks that usage.
To create the sensor, you will need to edit your configuration.yaml
file and add the following (add to your existing sensor:
section if you already have one):
sensor:
- platform: history_stats
name: Pool Heater Today
entity_id: water_heater.POOL_HEATER_ENTITY
state: "on"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
Of course you'll want to visualize the data you get out of the pool heater history sensor you just created, so I use a history-graph
card in my dashboard:
entities:
- entity: sensor.pool_heater_today
hours_to_show: 168
refresh_interval: 0
type: history-graph