Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
2c93c7ec47 | |||
e0b1c469d2 | |||
d646090802 | |||
c4fd8b2cfd | |||
37ce3d47ca |
27
src/run.py
27
src/run.py
@ -34,6 +34,15 @@ app.config.update({
|
||||
Session(app)
|
||||
oidc = OpenIDConnect(app)
|
||||
|
||||
@app.route('/token_debug', methods=['GET'])
|
||||
@oidc.require_login
|
||||
def token_debug():
|
||||
# Access Token vom Identity Provider abrufen
|
||||
access_token = oidc.get_access_token()
|
||||
return json.dumps({
|
||||
"access_token": access_token
|
||||
})
|
||||
|
||||
@app.route('/')
|
||||
@oidc.require_login
|
||||
def index():
|
||||
@ -45,7 +54,7 @@ def index():
|
||||
fig_1 = px.bar(df, x='month', y='value', color='year', barmode='group')
|
||||
fig_1.update_layout(
|
||||
title="Jahreswerte Exportierte Energie",
|
||||
xaxis_title="Monat",
|
||||
xaxis_title="",
|
||||
yaxis_title="",
|
||||
legend_title="Jahr",
|
||||
xaxis=dict(
|
||||
@ -55,21 +64,27 @@ def index():
|
||||
),
|
||||
yaxis=dict(ticksuffix=" kWh")
|
||||
)
|
||||
graph_html_1 = fig_1.to_html(full_html=False)
|
||||
graph_html_1 = fig_1.to_html(full_html=False, default_height='33%')
|
||||
|
||||
df = pd.read_sql("SELECT time_bucket('5 minutes', time) AS bucket, AVG(power) AS avg_power FROM pv_power_v WHERE time >= date_trunc('day', now()) - '1 day'::interval AND time < date_trunc('day', now()) GROUP BY bucket ORDER BY bucket", con=engine)
|
||||
fig_2 = px.line(df, x='bucket', y='avg_power')
|
||||
fig_2.update_layout(
|
||||
title="Export gestern"
|
||||
xaxis_title="",
|
||||
yaxis_title="",
|
||||
title="Export gestern",
|
||||
yaxis=dict(ticksuffix=" W")
|
||||
)
|
||||
graph_html_2 = fig_2.to_html(full_html=False)
|
||||
graph_html_2 = fig_2.to_html(full_html=False, default_height='33%')
|
||||
|
||||
df = pd.read_sql("SELECT time_bucket('5 minutes', time) AS bucket, AVG(power) AS avg_power FROM pv_power_v WHERE time >= date_trunc('day', now()) AND time < date_trunc('day', now()) + '1 day'::interval GROUP BY bucket ORDER BY bucket", con=engine)
|
||||
fig_3 = px.line(df, x='bucket', y='avg_power')
|
||||
fig_3.update_layout(
|
||||
title="Export gestern"
|
||||
xaxis_title="",
|
||||
yaxis_title="",
|
||||
title="Export heute",
|
||||
yaxis=dict(ticksuffix=" W")
|
||||
)
|
||||
graph_html_3 = fig_3.to_html(full_html=False)
|
||||
graph_html_3 = fig_3.to_html(full_html=False, default_height='33%')
|
||||
|
||||
return render_template_string(f"""
|
||||
<html>
|
||||
|
Reference in New Issue
Block a user