Hot Water Cylinder Visualiser #294
Replies: 5 comments 26 replies
-
That's very neat! |
Beta Was this translation helpful? Give feedback.
-
I was hoping to iron out an issue or two first (e.g. tapping on the plot on HA mobile shows a hover box for a point much lower than where tapped etc.) but I think that may be something to do with nesting it in a config-template card to get the temperature sensor states to display as tick labels. Here's the first pass in any case: type: custom:config-template-card
title: Hot Water
variables:
T1: |
temp => {
return states[temp].state;
}
entities: >-
-sensor.myenergi_eddi_21508400_temp_tank_1
-sensor.myenergi_eddi_21508400_temp_tank_2
card:
type: custom:plotly-graph
fn: |
$ex {
// specify order of temperature sensors
let Ts = [10 - 0.01, // simplifying assumption - bottom sensor - 0.01 deg
10, //this is a placeholder for a sensor yet to be installed
'sensor.myenergi_eddi_21508400_temp_tank_2',
'sensor.myenergi_eddi_21508400_temp_tank_1',
60, //this is a placeholder for a sensor yet to be installed
60 + 0.01 // simplifying assumption - top sensor - 0.01 deg
].map(sensor=>isNaN(hass.states[sensor]?.state) ? sensor : Math.round(hass.states[sensor]?.state))
// specify positions of temperature sensors w.r.t cylinder base
let Hs = [0, // bottom of the tank = 0cm
36, // 1st sensor, 36cm above bottom of tank
51, // 2nd sensor height
96, // 3rd sensor height
163, // 1st sensor height
186, // height of the tank
];
// now we linearly interpolate between sensors in steps of 1cm (not accurate)
let interps = [];
for (let i = 0; i < Ts.length - 1; i++) {
for (let step = 0; step < Hs[i + 1] - Hs[i]; step++) {
let interp = [Ts[i] + (step * (Ts[i + 1] - Ts[i])) / (Hs[i + 1] - Hs[i]),
Ts[i] + (step * (Ts[i + 1] - Ts[i])) / (Hs[i + 1] - Hs[i]),
Ts[i] + (step * (Ts[i + 1] - Ts[i])) / (Hs[i + 1] - Hs[i])];
interps.push(interp);
}
}
vars.z = interps
// arbritraty width - X axis length unimportant
vars.x = [0,1,2]
// array 0 - to height of tank (-1)
vars.y = Array.from({ length: Hs[Hs.length -1] }, (_, i) => i)
}
entities:
- entity: ''
z: $ex vars.z
x: $ex vars.x
'y': $ex vars.y
text_auto: true
type: heatmap
zmax: 60
zmid: 40
zmin: 20
showscale: false
colorscale: RdBu
contours_coloring: heatmap
hovertemplate: '<b>Temp: </b>%{z:.2f}°C</br><extra></extra>'
raw_plotly_config: true
refresh_interval: auto
ha_theme: true
layout:
hovermode: true
paper_bgcolor: rgba(0,0,0,0)
plot_bgcolor: rgba(0,0,0,0)
title:
text: Cylinder Temperature
x: 0.5
xref: paper
yref: paper
font:
size: 22
family: Balto
color: Black
yaxis:
tickvals:
- 36
- 51
- 96
- 163
ticktext:
- ${"10°C"}
- ${T1("sensor.myenergi_eddi_21508400_temp_tank_2") + "°C"}
- ${T1("sensor.myenergi_eddi_21508400_temp_tank_1") + "°C"}
- ${"60°C"}
tickwidth: 3
tickcolor: Grey
tickfont:
size: 20
family: Balto
color: Black
tickangle: 0
showgrid: true
zeroline: false
showticklabels: true
visible: true
xaxis:
showgrid: false
zeroline: false
showticklabels: false
ticks: false
visible: false
height: 600
width: 400
margin: null
l: 80
t: 40
|
Beta Was this translation helpful? Give feedback.
-
Very cool!
If the template card creates some weirdness (like zoom getting reset) Then you can replace the $ with $ex |
Beta Was this translation helpful? Give feedback.
-
What sensors do you use to measure the hot water cylinder temperature? |
Beta Was this translation helpful? Give feedback.
-
How do you get the gradient transition between the heatmap blocks? I assumed it was |
Beta Was this translation helpful? Give feedback.
-
I have 2 temperature sensors, (soon to be 4) in my hot water cylinder. It's a very tall cylinder and can often have significant temperature differences between the top and the bottom of the tank.
I put this visualization together using a heatmap and linearly interpolating between the temperature sensor states to get an idea of the cylinder's overall "state of charge". It's useful for planning hot water availability and best using available solar thermal, hot water diversion and deciding when to boost it with the immersion where automations can't help so well- e.g. if you have many guests staying over and your consumption pattern is discontinuous.
The tick labels are at the relative height of the four sensors in the cylinder (the top and bottom are placeholders until I get the 2 additional sensors into HA.)
Beta Was this translation helpful? Give feedback.
All reactions