diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-31 09:49:50 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-31 09:49:50 +0200 |
| commit | 135115b27ad415865458f20965b0e14253eba0ec (patch) | |
| tree | 1503f933c342f134d6b4db8808dcf0ebcbc09a84 /tasmota-proxy.service | |
| download | tasmota-dash-135115b27ad415865458f20965b0e14253eba0ec.tar.gz tasmota-dash-135115b27ad415865458f20965b0e14253eba0ec.zip | |
Proxy Tasmota energy JSON into Homepage's customapi widget, which can
render JSON but cannot do arithmetic. Applies the tariff, sums across
plugs, and records the per-day history the plugs do not keep.
Plugs are fetched in parallel; sequential polling would stack five
timeouts into a 25s hang. An offline plug is reported rather than
counted as zero, so a dead sensor cannot read as "consumed nothing".
Tasmota exposes only Today/Yesterday/Total, so each poll writes
yesterday's finished kWh into SQLite keyed (day, plug), making repeat
polls and restarts idempotent.
Display strings are preformatted server-side: Homepage's locale
formatting renders 1593 W as an ambiguous "1,593", and its widget has
no columns, so pairing kWh with its cost in one value is what keeps
the cards compact.
Diffstat (limited to 'tasmota-proxy.service')
| -rw-r--r-- | tasmota-proxy.service | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tasmota-proxy.service b/tasmota-proxy.service new file mode 100644 index 0000000..1776c42 --- /dev/null +++ b/tasmota-proxy.service @@ -0,0 +1,23 @@ +[Unit] +Description=Tasmota energy proxy for Homepage +After=network-online.target +Wants=network-online.target + +[Service] +ExecStart=/usr/bin/python3 /opt/tasmota-proxy/tasmota_proxy.py +Environment=TASMOTA_PLUGS=ac=172.16.34.176,washer=172.16.34.127,dishwasher=172.16.34.149,pc=172.16.34.118,spare=172.16.34.186 +Environment=PORT=8099 +Environment=RATE_MARGINAL=0.17598 +Environment=RATE_ALLIN=0.2754 +Environment=HISTORY_DB=/var/lib/tasmota-proxy/history.db +Restart=always +RestartSec=5 +DynamicUser=yes +StateDirectory=tasmota-proxy +NoNewPrivileges=yes +PrivateTmp=yes +ProtectSystem=strict +ProtectHome=yes + +[Install] +WantedBy=multi-user.target |
