Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
6ba9352edc | |||
aaa23a9839 | |||
812989df47 | |||
452161ff03 |
@ -16,7 +16,7 @@ steps:
|
|||||||
scan_image:
|
scan_image:
|
||||||
image: aquasec/trivy
|
image: aquasec/trivy
|
||||||
commands:
|
commands:
|
||||||
- trivy image $FORGE_NAME/$CI_REPO:$CI_COMMIT_SHA --quiet --exit-code 1
|
- TRIVY_DISABLE_VEX_NOTICE=1 trivy image $FORGE_NAME/$CI_REPO:$CI_COMMIT_SHA --quiet --exit-code 1
|
||||||
when:
|
when:
|
||||||
- event: [push, tag]
|
- event: [push, tag]
|
||||||
deploy:
|
deploy:
|
||||||
|
18
src/run.py
18
src/run.py
@ -40,9 +40,10 @@ def index():
|
|||||||
try:
|
try:
|
||||||
dbh = psycopg.connect()
|
dbh = psycopg.connect()
|
||||||
engine = sqlalchemy.create_engine("postgresql+psycopg://", creator=lambda: dbh)
|
engine = sqlalchemy.create_engine("postgresql+psycopg://", creator=lambda: dbh)
|
||||||
|
|
||||||
df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month", con=engine)
|
df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month", con=engine)
|
||||||
fig = px.bar(df, x='month', y='value', color='year', barmode='group')
|
fig_1 = px.bar(df, x='month', y='value', color='year', barmode='group')
|
||||||
fig.update_layout(
|
fig_1.update_layout(
|
||||||
title="Jahreswerte Exportierte Energie",
|
title="Jahreswerte Exportierte Energie",
|
||||||
xaxis_title="Monat",
|
xaxis_title="Monat",
|
||||||
yaxis_title="",
|
yaxis_title="",
|
||||||
@ -54,7 +55,14 @@ def index():
|
|||||||
),
|
),
|
||||||
yaxis=dict(ticksuffix=" kWh")
|
yaxis=dict(ticksuffix=" kWh")
|
||||||
)
|
)
|
||||||
graph_html = fig.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)
|
||||||
|
fig_2 = px.line(df, x='bucket', y='avg_power')
|
||||||
|
fig_2.update_layout(
|
||||||
|
title="Export gestern"
|
||||||
|
)
|
||||||
|
graph_html_2 = fig_2.to_html(full_html=False)
|
||||||
|
|
||||||
return render_template_string(f"""
|
return render_template_string(f"""
|
||||||
<html>
|
<html>
|
||||||
@ -62,8 +70,8 @@ def index():
|
|||||||
<title>Jahreswerte PV-Energie</title>
|
<title>Jahreswerte PV-Energie</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{graph_html}
|
{graph_html_1}
|
||||||
{graph_html}
|
{graph_html_2}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""")
|
""")
|
||||||
|
Reference in New Issue
Block a user