With many of you jumping on the Home Assistant train I thought I would share with you my power graph, made using the Apex Charts custom integration that mimics the GivEnergy one but with a few tweaks to make the colours more userfriendly with light and dark themes and the layers optimized.
It also includes some calculations to show values as Watts until it hits 1,000 and then moves to kW. You can tweak things like decimal places if you so wish.
Add the code pasted below into a new visual and replace the xxxxxx with your inverter serial number.

type: custom:apexcharts-card
cache: true
experimental:
color_threshold: true
header:
show: true
title: Power Graph
graph_span: 24h
show:
last_updated: false
loading: false
apex_config:
chart:
height: 450px
markers:
shape: circle
xaxis:
type: datetime
tooltip:
enabled: false
tooltip:
shared: true
enabled: true
followCursor: false
intersect: false
style:
fontSize: 12px
fontFamily: Helvetica, Arial, sans-serif
fontWeight: 400
custom: |
EVAL:function a({ series, seriesIndex, dataPointIndex, w }) {
const hoverXaxis = w.globals.seriesX[seriesIndex][dataPointIndex];
const hoverIndexes = w.globals.seriesX.map((seriesX) => {
return seriesX.findIndex((xData) => xData === hoverXaxis);
});
const units = ['W', 'W', 'W', 'W', '%'];
const formatValue = (value, index) => {
if (index === 4) {
return Math.round(value) + '%';
}
const absValue = Math.abs(value);
if (absValue >= 1000) {
return (value / 1000).toFixed(1) + ' kW';
}
return Math.round(value) + ' W';
};
let hoverList = "";
hoverIndexes.forEach((hoverIndex, seriesEachIndex) => {
if (hoverIndex >= 0) {
hoverList += `
<div class="apexcharts-tooltip-series-group apexcharts-active" style="order: 1; display: flex; font-size: 12px; font-weight: 400; font-family: Helvetica, Arial, sans-serif;">
<span class="apexcharts-tooltip-marker" style="background-color: ${
w.globals.markers.colors[seriesEachIndex]
}; border-radius: 50%; width: 12px; height: 12px;"></span>
<div class="apexcharts-tooltip-text">
<div class="apexcharts-tooltip-y-group">
<span class="apexcharts-tooltip-text-y-label">${
w.globals.seriesNames[seriesEachIndex]
}: </span>
<span class="apexcharts-tooltip-text-y-value" style="font-weight: 800;">${formatValue(
series[seriesEachIndex][hoverIndex], seriesEachIndex
)}</span>
</div>
</div>
</div>`;
}
});
const date = new Date(hoverXaxis);
const parsed = date.toDateString().split(" ").slice(1);
const time = date.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
return `<div class="apexcharts-tooltip-title" style="font-size: 12px; font-weight: 400; font-family: Helvetica, Arial, sans-serif;">${
parsed[1] + " " + parsed[0] + " " + time
}</div>${hoverList}`;
}
series:
- entity: sensor.givtcp_xxxxxx_pv_power
name: Solar
type: area
opacity: 0.2
color: "#FFCC01"
yaxis_id: power
unit: W
stroke_width: 1
extend_to: now
show:
legend_value: false
- entity: sensor.givtcp_xxxxxx_battery_power
name: Battery
type: area
opacity: 0.3
color: "#4593f1"
yaxis_id: power
unit: W
stroke_width: 1
extend_to: now
show:
legend_value: false
- entity: sensor.givtcp_xxxxxx_grid_power
name: Grid
type: area
opacity: 0.3
color: "#EA5A56"
yaxis_id: power
unit: W
stroke_width: 1
extend_to: now
show:
legend_value: false
- entity: sensor.givtcp_xxxxxx_load_power
name: Home
type: area
opacity: 0.3
color: "#50baa9"
yaxis_id: power
unit: W
stroke_width: 1
extend_to: now
show:
legend_value: false
- entity: sensor.givtcp_xxxxxx_soc
name: Battery Percentage
type: line
color: "#233C7B"
yaxis_id: soc
stroke_width: 2
extend_to: now
yaxis:
- id: power
align_to: 1000
min: ~6000
max: ~6000
decimals: 0
apex_config:
tickAmount: 10
labels:
formatter: |
EVAL:function(value) {
if (Math.abs(value) >= 1000) {
return (value / 1000).toFixed(1) + ' kW';
}
return Math.round(value) + ' W';
}
- id: soc
min: 0
max: 100
decimals: 0
opposite: true
apex_config:
tickAmount: 10
labels:
formatter: |
EVAL:function(value) {
return Math.round(value) + '%';
}
all_series_config:
group_by:
duration: 5min
func: avg
fill: last
float_precision: 0




