Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
988f24994b | |||
b8dd70e5ae |
10
src/run.py
10
src/run.py
@ -57,13 +57,20 @@ def index():
|
|||||||
)
|
)
|
||||||
graph_html_1 = fig_1.to_html(full_html=False)
|
graph_html_1 = fig_1.to_html(full_html=False)
|
||||||
|
|
||||||
df = pd.read_sql("SELECT time_bucket('5 minutes', time) AS bucket, AVG(power) AS avg_power FROM pv_power_v WHERE time 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')
|
||||||
fig_2.update_layout(
|
fig_2.update_layout(
|
||||||
title="Export gestern"
|
title="Export gestern"
|
||||||
)
|
)
|
||||||
graph_html_2 = fig_2.to_html(full_html=False)
|
graph_html_2 = fig_2.to_html(full_html=False)
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
graph_html_3 = fig_3.to_html(full_html=False)
|
||||||
|
|
||||||
return render_template_string(f"""
|
return render_template_string(f"""
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -72,6 +79,7 @@ def index():
|
|||||||
<body>
|
<body>
|
||||||
{graph_html_1}
|
{graph_html_1}
|
||||||
{graph_html_2}
|
{graph_html_2}
|
||||||
|
{graph_html_3}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""")
|
""")
|
||||||
|
Reference in New Issue
Block a user