Hot-reload with data from CSV

Hello,
does “hot-reloading” include reading data from a csv?
I have a Dash installation on raspberry and it reads data from csv which is updated each 5 minutes.
Would be it available in this case, to get chart updated without dash page reloading?

Greetings,
Jan

1 Like

Hot reloading means that when debug mode is on and the default Flask development server is running, saving changes to any of the files in the directory forces the app to reload entirely.

What you want is to have a function that re-reads the CSV that is triggered every N minutes by a dcc.Interval component.

https://dash.plot.ly/live-updates

2 Likes

Very clever @russellthehippo. I like to use the dangerouslysettinnerhtml component for plain text html and was looking for a way to re-read the html on changes. I think this just my solve that.

I have read live-updates documentation.
Yet I am not sure if I understad it correctly. I have:

daq.LEDDisplay(
    id='today_time_led',
    value= today_time_led(),
    color= colors['time'],
    size=30,
)

and value I computed in function to current time eg (10:45)

than I add:

    dcc.Interval(
                id='interval-component',
                interval=1*1000, # in milliseconds
                n_intervals=0
            )

and

    @app.callback(Output('today_time_led', 'value'),
                  [Input('interval-component', 'n_intervals')])

Could you tell me where I do mistake?

I don’t know, I can help if you post your error and the content of the callback function. You have the right idea though