Heatmap of 30-Panel Solar Array's Current States #277
Replies: 6 comments 3 replies
-
That's a really cool use case, I'd really like to see the result!
|
Beta Was this translation helpful? Give feedback.
-
To handle the missing panels, just use empty strings as ids and use the "optional chaining operator" (question mark)
|
Beta Was this translation helpful? Give feedback.
-
type: custom:plotly-graph
entities:
- entity: sensor.openweathermap_temperature
z: |
$fn ({ hass }) => {
const panels = [[
// row 3
'sensor.teich_temperature','sensor.living_thermometer_temperature', // add more columns
],[
// row 2
'sensor.outside_temperature','sensor.keller_temperature',
],[
// row 1
'sensor.garden_temperature','sensor.senseair_temperature',
]]
return panels.map(row=>
row.map(sensor=>
hass.states[sensor]?.state
)
);
}
type: heatmap
hoverongaps: false
raw_plotly_config: true
title: Solar Panels
layout:
height: 300
margin:
t: 20 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
type: custom:plotly-graph
fn: | # fn has no meaning, this is just used to construct the panels matrix once an store then in vars
$ex {
vars.z = [[
// row 3
'','sensor.teich_temperature','sensor.living_thermometer_temperature', // add more columns
],[
// row 2
'sensor.outside_temperature','','sensor.keller_temperature',
],[
// row 1
'', 'sensor.garden_temperature','sensor.senseair_temperature',
]].map(row=>
row.map(sensor=>
hass.states[sensor]?.state
)
)
}
entities:
- entity: ''
z: "$ex vars.z"
text_auto: true
xgap: 2
ygap: 2
type: heatmap
hoverongaps: false
raw_plotly_config: true
title: Solar Panels
layout:
annotations: |
$ex vars.z.flatMap((row, y) => row.map((text="", x) => ({
x,
y,
text,
font: {
family: 'Arial',
size: 14,
color: 'white'
},
showarrow: false,
})))
yaxis:
showgrid: false
zeroline: false
showticklabels: false
visible: false
xaxis:
showgrid: false
zeroline: false
showticklabels: false
ticks: false
visible: false
height: 300
margin:
t: 20
l: 20
b: 20
|
Beta Was this translation helpful? Give feedback.
-
I would like to click on a heatmap tile to popup the standard Home Assistant entity detail dialogue. I tried the on_click approach shown in https://github.com/dbuezas/lovelace-plotly-graph-card but under text BTW, if you want to remove the colour scale, add entities:
- entity: ''
z: $ex vars.z
xgap: 2
ygap: 2
zmax: 400
zmin: 0
type: heatmap
hoverongaps: false
showscale: false |
Beta Was this translation helpful? Give feedback.
-
UPDATED: We have a solution. Big THANKS to @dbuezas for this awesome card and your help with the solution.
Plot a solar panel array's physical layout as a heat map based on the current states of say 30 panels. Each entity is its own cell in the heat map.
The matrix layout is categorical with three rows and 11 columns (cells [1,2], [1,3], and [6,1] are empty).

Here is the concept
Here is the plot showing some evening shading from the west and some overall production decline due to sun angle and a very high pollen count right now that has blanketed the panels. Time to hose them down

Here is the code with a couple of slight tweaks from what deuezas came up with below. I wanted to round the values to integers which required testing for empty cells. That's about it.
Beta Was this translation helpful? Give feedback.
All reactions