def __init__(self, monitor, room): super().__init__(className=['text-center', 'm-2']) self.monitor = monitor self.room = room self.title = html.H5(room.name, className='card-title') self.tank = daq.Tank(id='tank-%s' % (room.id, ), style=RoomView.TANK_STYLE, scale={'interval': 1}, min=0, value=room.occupancy_cur, max=self.room.occupancy_max) self.label = html.P(id='label-%s' % (room.id, ), children="0/0 people") self.input = daq.NumericInput(id='input-%s' % (room.id, ), min=1, value=room.occupancy_max, label='Max', labelPosition='top') self.update_color() self.update_label() self.children = [ dbc.CardBody([self.title, self.tank, self.label, self.input]) ]
def P1mydisplay_valve_tanks(myModCount): tanks = [] myValves = config.SGSConfigurationJSON["Valves"] columnCount = 0 for single in myValves: myValveNumber = single["ValveNumber"] if (single["ShowGraph"] == True): myControl = single["Control"] if (myControl[0:2] == "MS"): # found Moisture sensor columnCount = columnCount + 1 mySplit = myControl.split("/") MSNumber = mySplit[0][3:] myName = mySplit[1] myID = mySplit[2] myValue = returnLatestSensorValue(myID, MSNumber) #print ("myValue=", myValue) tanks.append( daq.Tank( min=0, max=100, value=myValue, showCurrentValue=True, units="percent", #style={'marginLeft': '70px', 'marginBottom' : '10px', 'fontFamily': 'Arial'}, style={ 'display': 'grid', 'gridTemplateColumns': 'repeat(3, 1fr)', 'gridTemplateRows': '1fr', 'gridColumnGap': '0px', 'gridRowGap': '0px' }, label=myName + "/" + str(myID) + "/" + str(myValveNumber), labelPosition='bottom', id={ 'type': 'MSTdynamic', 'index': myModCount, 'DeviceID': myID, 'MSNumber': MSNumber }, className='dark-theme-control', )) myModCount = myModCount + 1 #print("columnCount=",columnCount) return (myModCount, html.Div(tanks, style={ 'margin': '10px', 'columnCount': columnCount }))
id='darktheme-daq-stopbutton', className='dark-theme-control' ), html.Br(), daq.Slider( min=0, max=100, value=30, targets = {"25": {"label": "TARGET"}}, color=theme['primary'], id='darktheme-daq-slider', className='dark-theme-control' ), html.Br(), daq.Tank( min=0, max=10, value=5, id='darktheme-daq-tank', className='dark-theme-control' ), html.Br(), daq.Thermometer( min=95, max=105, value=98.6, id='darktheme-daq-thermometer', className='dark-theme-control' ), html.Br() ]) app.layout = html.Div(id='dark-theme-container', children=[ daq.ToggleSwitch( id='toggle-theme',
daq.LEDDisplay(id='leddisplay', size=60, color="#FF5E5E", className='pt-3 pb-4') ]), ], color="danger", outline=True, className='text-center'), dbc.Card([ dbc.CardHeader("Fuel", className='h4 text-light bg-danger'), dbc.CardBody([ daq.Tank(id='tank', min=0, max=10, showCurrentValue=True, units='gallons', color="#FF5E5E", style={'margin-left': '100px'}, className='pt-4 pb-4') ]), ], color="danger", outline=True, className='text-center'), ]) ], className='container-md mt-3') @app.callback([ Output('thermometer', 'value'),
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) # ************************************************************************* app.layout = html.Div( id="dark-light-theme", children=[ html.Div( [ html.H1("Water Valve Pressure", style={"textAlign": "center"}), html.Div( daq.Tank( id="my-tank", max=400, value=197, showCurrentValue=True, units="gallons", style={"margin-left": "50px"}, ), className="three columns", ), html.Div( daq.Gauge(id="my-daq-gauge1", min=0, max=10, value=6, label="Valve 1"), className="four columns", ), html.Div( daq.Gauge(id="my-daq-gauge2",
def Add_Dash(server): def protect_dashviews(dashapp): for view_func in dashapp.server.view_functions: if view_func.startswith(dashapp.url_base_pathname): dashapp.server.view_functions[view_func] = login_required( dashapp.server.view_functions[view_func]) dashapp = dash.Dash(__name__, server=server, url_base_pathname='/instant_dash/', external_stylesheets=[dbc.themes.BOOTSTRAP]) protect_dashviews(dashapp) server = dashapp.server body1 = dbc.Container( [ dbc.Row(dbc.Col(html.Div(html.H2('Volume Instantâneo das ETEs')))), dbc.Row([ dbc.Col( [ daq.Tank(label='ETE #1', id='tank_1', units="Vol H2O", style={'margin-left': '50px'}, showCurrentValue=True, max=5, min=0, value=2), html.P('', style={'padding': '2em 0 0 2em'}), dcc.Slider( id='tank_1-slider', min=0, max=5, step=1, value=2), ], md=4, ), dbc.Col( [ daq.Tank(label='ETE #2', id='tank_2', style={'margin-left': '50px'}, showCurrentValue=True, units="Vol H2O", max=5, min=0, value=3), html.P('', style={'padding': '2em 0 0 2em'}), dcc.Slider( id='tank_2-slider', min=0, max=5, step=1, value=3), ], md=4, ), dbc.Col( [ daq.Tank(label='ETE #3', id='tank_3', style={'margin-left': '50px'}, showCurrentValue=True, units="Vol H2O", max=5, min=0, value=4), html.P('', style={'padding': '2em 0 0 2em'}), dcc.Slider( id='tank_3-slider', min=0, max=5, step=1, value=4), ], md=4, ), ]), ], className="mt-4", fluid=True, ) body2 = dbc.Container( [ dbc.Row(dbc.Col(html.Div(html.H2('Status das Bombas')))), dbc.Row([ dbc.Col( [ daq.LEDDisplay(label="Bomba A / ETE #1", value='110.00', backgroundColor="#007acc"), html.P('', style={'padding': '2em 0 0 2em'}), daq.PowerButton( on='True', theme='dark', color="#009933"), ], md=4, ), dbc.Col( [ daq.LEDDisplay(label="Bomba A / ETE #2", value='110.00', backgroundColor="#007acc"), html.P('', style={'padding': '2em 0 0 2em'}), daq.PowerButton(on='True', color="#009933"), ], md=4, ), dbc.Col( [ daq.LEDDisplay(label="Bomba A / ETE #3", value='110.00', backgroundColor="#007acc"), html.P('', style={'padding': '2em 0 0 2em'}), daq.PowerButton(on='True', color="#009933"), ], md=4, ), ]), ], className="mt-4", fluid=True, ) dashapp.layout = html.Div([body1, body2]) ### Tanks @dashapp.callback(dash.dependencies.Output('tank_1', 'value'), [dash.dependencies.Input('tank_1-slider', 'value')]) def update_output_4(value): return value @dashapp.callback(dash.dependencies.Output('tank_2', 'value'), [dash.dependencies.Input('tank_2-slider', 'value')]) def update_output_5(value): return value @dashapp.callback(dash.dependencies.Output('tank_3', 'value'), [dash.dependencies.Input('tank_3-slider', 'value')]) def update_output_6(value): return value return dashapp.server
Tank = html.Div(children=[ html.H1('Tank Examples and Reference'), html.Hr(), html.H3('Default Tank'), reusable_components.Markdown("An example of a default tank without \ any extra properties."), reusable_components.Markdown( examples['tank'][0], style=styles.code_container ), html.Div( examples['tank'][1], className='example-container', style={'overflow-x': 'initial'} ), html.Hr(), html.H3('Current value with units'), reusable_components.Markdown("Display the current value, along with optional \ units with the `units` and `showCurrentValue` properties."), ComponentBlock('''import dash_daq as daq daq.Tank( value=6, showCurrentValue=True, units='gallons', style={'margin-left': '50px'} )''', style=styles.code_container), html.Hr(), html.H3('Height and width') , reusable_components.Markdown("Control the size of the tank by setting \ `height` and `width`."), ComponentBlock('''import dash_daq as daq daq.Tank( height=75, width=200, value=6, style={'margin-left': '50px'} ) ''', style=styles.code_container), html.Hr(), html.H3('Label'), reusable_components.Markdown("Display a label alongside your tank in the \ specified position with `label` and `labelPosition`."), ComponentBlock('''import dash_daq as daq daq.Tank( value=3, label='Tank label', labelPosition='bottom' )''', style=styles.code_container), html.Hr(), html.H3('Custom scales'), reusable_components.Markdown("Control the intervals at which labels are displayed, \ as well as the labels themselves with the `scale` property."), ComponentBlock('''import dash_daq as daq daq.Tank( value=3, scale={'interval': 2, 'labelInterval': 2, 'custom': {'5': 'Set point'}}, style={'margin-left': '50px'} )''', style=styles.code_container), html.Hr(), html.H3('Logarithmic'), reusable_components.Markdown("Use a logarithmic scale for the tank with the specified \ base by setting `logarithmic=True`."), ComponentBlock('''import dash_daq as daq daq.Tank( min=0, max=10, value=300, logarithmic=True, base=3, style={'margin-left': '50px'} )''', style=styles.code_container), html.Hr(), html.H3('Tank Properties'), generate_prop_info("Tank", lib=daq) ])
import dash import dash_daq as daq import dash_core_components as dcc import dash_html_components as html external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) app.layout = html.Div([ daq.Tank(id='my-tank', value=5, min=0, max=10, style={'margin-left': '50px'}), dcc.Slider( id='tank-slider', value=5, min=0, max=10, ), ]) @app.callback(dash.dependencies.Output('my-tank', 'value'), [dash.dependencies.Input('tank-slider', 'value')]) def update_tank(value): return value if __name__ == '__main__':
size=175, units="1000km/h", color="#fec036", ) ], n_clicks=0, ) elevation = html.Div( id="control-panel-elevation", children=[ daq.Tank( id="control-panel-elevation-component", label="Elevation", min=0, max=1000, value=650, units="kilometers", showCurrentValue=True, color="#303030", ) ], n_clicks=0, ) temperature = html.Div( id="control-panel-temperature", children=[ daq.Tank( id="control-panel-temperature-component", label="Temperature", min=0,
dcc.Interval(id="daq-interval", interval=1000, n_intervals=0), ]), # ➍ 計器を並べる html.Div( [ html.Div( [html.H2("ゲージ"), daq.Gauge(id="guage1")], className="three columns", ), html.Div( [html.H2("グラデュエートバー"), daq.GraduatedBar(id="guage2")], className="three columns", ), html.Div( [html.H2("タンク"), daq.Tank(id="guage3")], className="three columns", ), html.Div( [html.H2("LEDディスプレイ"), daq.LEDDisplay(id="guage4")], className="three columns", ), ], style={"margin": "auto"}, ), ]) # ➋ コールバック オンとオフを管理するコールバック @app.callback(Output("daq-interval", "disabled"),
# LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT # ------------------------------------------------------------------------------------------------------------------- app.layout = html.Div([ dcc.Tabs(id="tabs", value='tab1', children=[ dcc.Tab(label='STATUS', value='tab1'), dcc.Tab(label='MAGIE', value='tab2'), dcc.Tab(label='INVENTARIO', value='tab3'), ]), html.Div(id='tabs-content') ]) status = html.Div([ daq.Tank(id='hp', min=0, value=5, max=10), daq.NumericInput(id='damage', min=0, value=5, max=10), html.Button('Damage', id='hit'), html.Button('Heal', id='heal') ]) magie = html.Div([ dcc.Dropdown(options=[{ 'label': i, 'value': i } for i in pg['nome']], id='spell_list_pg'), dcc.Checklist(id='canrips_check', persistence=True), dcc.Checklist(id='spell1_check', persistence=True), dcc.Checklist(id='spell2_check', persistence=True), dcc.Checklist(id='spell3_check', persistence=True),
def update_values(n_intervals, values): try: data_entry = json.loads(values) i2c_bus = data_entry[0] data_filename = data_entry[1] data = pd.read_csv(data_filename) has_tof = data_entry[2] has_alp = data_entry[3] has_colour = data_entry[4] has_adc = data_entry[5] has_gas_sensor = data_entry[6] has_gas_sensor_gpio = data_entry[7] has_humidity = data_entry[8] has_led = data_entry[9] led_address = data_entry[10] system_timev = data[['system-time']].tail(1).iloc[0] system_time = round(system_timev[0], 3) ret_body = [] if (has_tof): tof_value = data[['TOF']].tail(1).iloc[0] ret_body.append( create_div( ('TOF Sensor'), [ daq.Tank(label="Distance", showCurrentValue=True, min=0, max=1000, value=tof_value['TOF'], size=80, style=block_style), #html.P(tof_value) #Replace with something pretty! ])) if (has_alp): als_value = data[['ALS:IR PROX', 'ALS:LIGHT', 'ALS:WB']].tail(1).iloc[0] ret_body.append( create_div( ('Ambient Light & Proximity Sensor'), [ daq.Tank(label="Proximity", showCurrentValue=True, min=0, max=400, value=als_value['ALS:IR PROX'], size=80, style=block_style), daq.Tank(label="Ambient Light", showCurrentValue=True, min=0, max=32000, value=als_value['ALS:LIGHT'], size=80, style=block_style), daq.Tank(label="White Balance", showCurrentValue=True, min=0, max=32000, value=als_value['ALS:WB'], size=80, style=block_style), #html.P(str(als_value)) ])) if (has_colour): col_value = data[['RED', 'GREEN', 'BLUE', 'WHITE']].tail(1).iloc[0] ret_body.append( create_div( ('Colour Sensor'), [ daq.Tank(label="Red", showCurrentValue=True, min=0, max=64000, value=col_value['RED'], size=80, color="#FFBBBB", style=block_style), daq.Tank(label="Green", showCurrentValue=True, min=0, max=64000, value=col_value['GREEN'], size=80, color="#BBFFBB", style=block_style), daq.Tank(label="Blue", showCurrentValue=True, min=0, max=64000, value=col_value['BLUE'], size=80, color="#BBBBFF", style=block_style), daq.Tank(label="White", showCurrentValue=True, min=0, max=64000, value=col_value['WHITE'], size=80, color="#BBBBBB", style=block_style), #html.P(str(col_value)) ])) if (has_adc): ir_value = data[['IR']].tail(1).iloc[0] ret_body.append( create_div( ('Analogue Infrared Phototransistor'), [ daq.Tank(label="Raw Value", showCurrentValue=True, min=0, max=400, value=ir_value['IR'], size=80, style=block_style), #html.P(str(ir_value)) ])) if (has_gas_sensor): gas_value = data[['GAS0', 'GAS1', 'GAS2', 'GAS3']].tail(1).iloc[0] ret_body.append( create_div( ('Analog Inputs (Gas Sensor)'), [ daq.Tank(label="Sensor 0", showCurrentValue=True, min=0, max=64000, value=gas_value['GAS0'], size=80, style=block_style), daq.Tank(label="Sensor 1", showCurrentValue=True, min=0, max=64000, value=gas_value['GAS1'], size=80, style=block_style), daq.Tank(label="Sensor 2", showCurrentValue=True, min=0, max=64000, value=gas_value['GAS2'], size=80, style=block_style), daq.Tank(label="Sensor 3", showCurrentValue=True, min=0, max=64000, value=gas_value['GAS3'], size=80, style=block_style), #html.P(str(gas_value)) ])) if (has_humidity): hum_value = data[['HUMIDITY', 'TEMPERATURE']].tail(1).iloc[0] ret_body.append( create_div( ('Humidity + Temperature Sensor'), [ #daq.Thermometer(label="Temperature",showCurrentValue=True,units="C",value=hum_value['TEMPERATURE'],min=0,max=100,size=60,style=block_style), daq.Tank(label="Temperature", showCurrentValue=True, units="C", value=hum_value['TEMPERATURE'], min=0, max=100, size=80, style=block_style), daq.Tank(label="Humidity", showCurrentValue=True, min=0, max=100, value=hum_value['HUMIDITY'], size=80, style=block_style, units="%"), #html.P(str(hum_value)) ])) ret_body.append( html.Div('Last response time: {}'.format( utils.decode_time(system_time).rstrip("0")))) return html.Div(ret_body) except IOError: print("Error reading file %s in sensors_app.py" % data_filename) return (html.Div("Error reading data file"))
html.Br(), html.Div([ html.Div(id='status'), html.Div(id='time'), ], className='row'), html.Div(id='lock'), html.Br(), # Realtime Status html.Div( [ pfig1, pfig2, html.Div([ daq.Tank(id='gen-tank', showCurrentValue=True, units='Gens', min=0) ], className='col-4'), dcc.Interval( id='interval-component', interval=2 * 1000, # in milliseconds n_intervals=0), ], className='row'), # Algo Hist html.Div([ create_card( '', dcc.Graph(id='algo_hist',
units="C", value=5, showCurrentValue=True, ) thm_4=daq.Thermometer( label="Tank-4", units="C", value=5, showCurrentValue=True, ) tank_1 = daq.Tank( id='my-daq-tank', min=0, max=10, label="TANK-1", showCurrentValue=True, units='gallons', value=5, style={'marginLeft': '50px','color':'white'} ) tank_2 = daq.Tank( id='my-daq-tank', min=0, max=10, value=5, label="TANK-2", showCurrentValue=True, units='gallons', style={'marginLeft': '50px','color':'white'}
min=0, max=40, showCurrentValue=True, value=27.859, size=200, units='1000km/h', color='#ffe102') ], n_clicks=0) elevation = html.Div(id='control-panel-elevation', children=[ daq.Tank(id='control-panel-elevation-component', label='Elevation', min=0, max=1000, value=650, units='kilometers', showCurrentValue=True, color='#303030') ], n_clicks=0) temperature = html.Div(id='control-panel-temperature', children=[ daq.Tank(id='control-panel-temperature-component', label='Temperature', min=0, max=500, value=290, units='Kelvin', showCurrentValue=True,