Compare commits

...

2 Commits

Author SHA1 Message Date
d646090802 token debug
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-01-28 21:49:27 +01:00
c4fd8b2cfd fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-01-28 14:51:56 +01:00

View File

@ -34,6 +34,13 @@ app.config.update({
Session(app) Session(app)
oidc = OpenIDConnect(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 jsonify({"access_token": access_token})
@app.route('/') @app.route('/')
@oidc.require_login @oidc.require_login
def index(): def index():
@ -55,7 +62,7 @@ def index():
), ),
yaxis=dict(ticksuffix=" kWh") yaxis=dict(ticksuffix=" kWh")
) )
graph_html_1 = fig_1.to_html(full_html=False, default_height='30%') 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) 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 = px.line(df, x='bucket', y='avg_power')
@ -65,7 +72,7 @@ def index():
title="Export gestern", title="Export gestern",
yaxis=dict(ticksuffix=" W") yaxis=dict(ticksuffix=" W")
) )
graph_html_2 = fig_2.to_html(full_html=False, default_height='30%') 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) 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 = px.line(df, x='bucket', y='avg_power')
@ -75,7 +82,7 @@ def index():
title="Export heute", title="Export heute",
yaxis=dict(ticksuffix=" W") yaxis=dict(ticksuffix=" W")
) )
graph_html_3 = fig_3.to_html(full_html=False, default_height='30%') graph_html_3 = fig_3.to_html(full_html=False, default_height='33%')
return render_template_string(f""" return render_template_string(f"""
<html> <html>