Dear all,
I managed to extract the power generation data of my inverter from the online json file and put it into a sensor by using rest:
- name: ABB_Aurora_graph_today
unique_id: sensor.abb_aurora_graph_today
value_template: "{{ (value_json.timestamp) }}"
json_attributes_path: "$.fields[1]"
json_attributes:
- values
Looking at the developer tools → states I see the result is a sensor with Attributes:
values:
- start: 1733034600
startLabel: '20241201073000'
- start: 1733035500
startLabel: '20241201074500'
value: '12.957703590393'
- start: 1733036400
startLabel: '20241201080000'
value: '23.511345863342'
I have shown just a few values as example, as you can see at the beginning I only have the timestamp (start) and the same date in string format (startLabel), then whan the inverter starts to generate power I also have the power value (value).
I would like to plot this in a chart, installed Apex card but now I’m stuck not understanding how I can get/convert those data into Apex…
Tried with the non-working:
type: custom:apexcharts-card
header:
title: Oggi
show: true
floating: false
show_states: true
colorize_states: true
span:
start: day
series:
- entity: sensor.abb_aurora_graph_today
name: Potenza
type: area
stroke_width: 2
data_generator: |
return entity.attributes.values.map((entry) => {
return [moment(entry.start).unix(), entry.value];
});
can somebody help?
Thx