Read data from csv file and display it in a graph

Hello,
I’m really fresh with HomeAssistant, so bear with me
so I have a static csv file formatted as such

0,00:00 - 01:00,126.93
1,01:00 - 02:00,115.01
2,02:00 - 03:00,105.64
3,03:00 - 04:00,110.09
4,04:00 - 05:00,112.96
5,05:00 - 06:00,114.7
6,06:00 - 07:00,188.44
7,07:00 - 08:00,220.1
8,08:00 - 09:00,170.06
9,09:00 - 10:00,220.0
10,10:00 - 11:00,219.95
11,11:00 - 12:00,170.05
12,12:00 - 13:00,134.52
13,13:00 - 14:00,131.35
14,14:00 - 15:00,122.34
15,15:00 - 16:00,142.3
16,16:00 - 17:00,150.0
17,17:00 - 18:00,134.7
18,18:00 - 19:00,127.0
19,19:00 - 20:00,130.22
20,20:00 - 21:00,101.29
21,21:00 - 22:00,94.97
22,22:00 - 23:00,88.81
23,23:00 - 00:00,65.06

And I’m trying to read every third value for example 126.93 115.01…
I wrote it up in a sensor

 - platform: file
    name: day_ahead_price
    file_path: /config/day_ahead_price.csv
    value_template: '{{ (value.split(",")[2]) }}'
    unit_of_measurement: "EUR/MWH"

However it only displays the last state in the graph 65.06

My graph:

 - type: 'custom:apexcharts-card'
        view_layout:
          grid-area: col3

        graph_span: 24h
        cache: true
        stacked: true
        now:
          show: false
        apex_config:
          grid:
            show: false
          stroke:
            width: 1
            curve: smooth
          chart:
            height: 246px
          legend:
            show: true
            position: bottom
            horizontalAlign: left
        span:
          end: day
        header:
          show: true
          title: 'Electricity Day Ahead Prices'
          colorize_states: true
        series:
          - entity: sensor.day_ahead_price
            name: Day Ahead Price
            color: '#5F4B87'
            type: column
            unit: Eur
            transform: return x /1;

Thank you!


https://www.home-assistant.io/integrations/file/#sensor

Oh i see, is there any other way to display data from a file?

1 Like

Not that I know of. Home assistant expects data in real time and has no way of injecting past date into the recorder database.

Oh okay got it. I have a python script that creates that csv with new data everyday, is there away to implement that?