Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
093805a249
|
|||
|
cab9ed705e
|
|||
|
2faa19bc54
|
4
deployment/encrypt-secrets.sh
Executable file
4
deployment/encrypt-secrets.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
gpg --pinentry-mode=loopback --symmetric --cipher-algo AES256 --armor --output secrets.asc secrets.txt
|
||||||
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
-----BEGIN PGP MESSAGE-----
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
jA0ECQMC4tvOFCp2PT7/0sE+AcZmiGwroHYdWW/vJA1sCoMrM2oW8xUc1KndDGto
|
jA0ECQMIEgCXA7BZUZr+0sE3AR8vkK0sgmaFl+emB0SuMvYpVYmCjW1KPpGHBJ85
|
||||||
dFev2KcoZ4FRL9liCrJ7on773bZFCTDu2xiBNMeKF1p8drub1Ej5l61Oq15mLTYf
|
Yq8FOwa2eqTOEjunx8bnJqcQmARGc75+sZRZtlaedwyl0//OlUKELHd2hYlmJrJI
|
||||||
XjXknFiWWq4PTzhhy53zvDyIV5yIcGfjotpGC83/qH5CBWIcCw9PZHI5+uHRVRKL
|
HVa6GDPx+Kra/Z/dk6jjBEjFB0Qkii01TvVfcaNBf+AhQ5FqRO1C8OYVI55F31Ox
|
||||||
OpdTpekJ8ljPAGQ4F3vbOeBbG1PMoclx8r5SpKxLwQco2iaXd71dXHtPkEnLujd4
|
rFDAtG3Jh82OX322ldXEiYuuDyaiFh8JR9AGah1G8oASYh+3qdZCS839lt2ZTeve
|
||||||
ZRCthVNVfxrIIRcTJfgxewz2oJWYF9008nmtxpKzqfBtNpFIdBtnTTVvv2lfcVuS
|
QpIGpD+ZSyjAsXa6m7AJskrB3dwpHMPGBnZrbPFwcKVKxvqS+98K/QmTzqQfvZiu
|
||||||
S4eav9ljPPd/exZaT7fOGD/kuCdiiu6e0yGLzo2ykf0uBy7hG7ZJg8TH5e+LMBm9
|
0ZHYE57QiLcSKKonih2224KvnJkfzibYiHaxY8pWoYGDCSg5wM7PmeXBUg6Z7paP
|
||||||
Q1OFD+5LWeEsOEdSTlT5UbV5EaVEiawKWQn7rMZOyvBNiPwLaOlquHirWoll5eIm
|
xz78RiWSKyivZ7TGmlDb+UIE4qLL4tJiqbUJ/Q7HuQceLjMJaxTsbQWLMPxI+Ooh
|
||||||
OHgBVN0FiY/righpIoei/KP705FIg+hrpMUvc29PahiL8dgsxJycnKIo4t+2/nac
|
0rouXg6YjPacItBmdJJsW+tnvV4wMNrM5bLlQN7myoLg8WSZHOsGbDIcc6DL1GxN
|
||||||
H144hP/rqBeaobG05TkZIr+Cpt4rpwwfNWOHgmNFHVpxdmPfoeAmpT4nz760hTEN
|
6pEFpZsCO5fphJoZcTdwop/wKXhptQBm/M2FqRzQziDsofse8vRCUFCn2fY9oRWI
|
||||||
2ol4Qh8xL7n4GFiCpNg8tNZiZkPPa/aRUAFxgdq5beossvKukxCexQmlCFvxITSG
|
H4Kbf+xa78nfoYpRx+uH4pbWTRIZ/XJu7Oq438kNlFd2QdA8hJk2yvE0FNnsa7Xa
|
||||||
x9RwssFMnT+wqTuzBN8neBeEF1d9AtAFQKPtg3wkMUyJAlYkxiGS/2NJuYDVpmEQ
|
LnTwX+wmFPb/LyKLe94tffm5CEIcLgOrWIgTufp8/eBfjbj3fSui5PY=
|
||||||
=Wr4f
|
=nOkj
|
||||||
-----END PGP MESSAGE-----
|
-----END PGP MESSAGE-----
|
||||||
|
|||||||
@@ -16,21 +16,13 @@ from app import oidc
|
|||||||
@oidc.require_login
|
@oidc.require_login
|
||||||
def pvstats():
|
def pvstats():
|
||||||
try:
|
try:
|
||||||
stepX_time = time.time()
|
|
||||||
dbh = psycopg.connect()
|
dbh = psycopg.connect()
|
||||||
engine = sqlalchemy.create_engine("postgresql+psycopg://", creator=lambda: dbh)
|
engine = sqlalchemy.create_engine("postgresql+psycopg://", creator=lambda: dbh)
|
||||||
|
|
||||||
step0_time = time.time()
|
df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month ORDER BY year, month", con=engine)
|
||||||
df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month", con=engine)
|
|
||||||
step1_time = time.time()
|
|
||||||
duration1 = step1_time - step0_time
|
|
||||||
logger.info(f"{duration1=}")
|
|
||||||
fig_1 = px.bar(df, x='month', y='value', color='year', barmode='group')
|
fig_1 = px.bar(df, x='month', y='value', color='year', barmode='group')
|
||||||
step2_time = time.time()
|
|
||||||
duration2 = step2_time - step1_time
|
|
||||||
logger.info(f"{duration2=}")
|
|
||||||
fig_1.update_layout(
|
fig_1.update_layout(
|
||||||
title=f"Jahreswerte Exportierte Energie {duration1:.3f}, {duration2:.3f}",
|
title=f"Jahreswerte Exportierte Energie PV-Anlage",
|
||||||
xaxis_title="",
|
xaxis_title="",
|
||||||
yaxis_title="",
|
yaxis_title="",
|
||||||
legend_title="Jahr",
|
legend_title="Jahr",
|
||||||
@@ -43,18 +35,34 @@ def pvstats():
|
|||||||
)
|
)
|
||||||
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='30%')
|
||||||
|
|
||||||
|
df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM car_energy_by_month ORDER BY year, month", con=engine)
|
||||||
|
fig_2 = px.bar(df, x='month', y='value', color='year', barmode='group')
|
||||||
|
fig_2.update_layout(
|
||||||
|
title=f"Jahreswerte Verbrauch Elektroauto",
|
||||||
|
xaxis_title="",
|
||||||
|
yaxis_title="",
|
||||||
|
legend_title="Jahr",
|
||||||
|
xaxis=dict(
|
||||||
|
tickmode="array",
|
||||||
|
tickvals=list(range(1, 13)), # Monate 1–12
|
||||||
|
ticktext=["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
|
||||||
|
),
|
||||||
|
yaxis=dict(ticksuffix=" kWh")
|
||||||
|
)
|
||||||
|
graph_html_2 = fig_2.to_html(full_html=False, default_height='30%')
|
||||||
return render_template_string(f"""
|
return render_template_string(f"""
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Jahreswerte PV-Energie</title>
|
<title>Jahreswerte PV und Auto</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{graph_html_1}
|
{graph_html_1}
|
||||||
|
{graph_html_2}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""")
|
""")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Error when querying energy export values: {e}")
|
raise Exception(f"Error when querying energy values: {e}")
|
||||||
finally:
|
finally:
|
||||||
if dbh is not None:
|
if dbh is not None:
|
||||||
dbh.close()
|
dbh.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user