I started simple example with dash app but couldnt find some good reference to it. Here i am reading json file once and display it in LEDDisplay and then can change value from slider. Instead i would like to read json file after regular interval where counter value is updated and that i want to show in LEDDisplay. Any recommendations or comments.
# https://dash.plotly.com/dash-daq
import dash
from dash.dependencies import Input, Output
import dash_daq as daq
from dash import dcc
from dash import html
import json
import os
file = open(r'csv_file_test.json')
json_data = json.load(file)
app = dash.Dash(__name__)
app.layout = html.Div([
daq.LEDDisplay(
id='entry-LED-display',
label="Entry Counter",
labelPosition='top',
value=json_data['down'],
size=200,
color="#190CAF"
),
dcc.Input(
id='entry-LED-display-slider',
type='number',
value=json_data['down']
),
])
@app.callback(
Output('entry-LED-display', 'value'),
Input('entry-LED-display-slider', 'value')
)
def update_output(value):
return str(value)
if __name__ == '__main__':
app.server.run(port=8000, host='0.0.0.0')