SolarCost bridge para capturar Totales de Solar Assistant y publicarlos por HTTP.
Project description
SolarCost Bridge
Bridge en Python para:
- autenticarse contra SolarAssistant,
- conectarse al websocket de Phoenix LiveView de la solapa
Totales, - mantener un estado actualizado y persistido,
- publicar ese estado por HTTP para que otra aplicacion lo consulte.
Estructura
src/sa_totals_bridge: codigo fuenterequirements.txt: dependenciasdata/: base SQLite local generada en ejecucion
Instalacion
sudo apt update
sudo apt install -y python3-full python3-venv
sudo mkdir -p /opt/solarcost/bridge
sudo chown -R "$USER":"$USER" /opt/solarcost/bridge
cd /opt/solarcost/bridge
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install solarcost-bridge
sudo "$(command -v sa_bridge)" init
El comando recomendado es sa_bridge. Los comandos anteriores sa-bridge y sa-totals-bridge siguen funcionando por compatibilidad.
Si prefieres mantener el comando anterior, tambien funciona:
sudo "$(command -v sa-totals-bridge)" init
Si Solar Assistant corre en la misma maquina que el bridge, el asistente propone por defecto http://127.0.0.1.
Desinstalacion
pip uninstall solo elimina el paquete instalado dentro del entorno virtual. No borra automaticamente:
- el archivo
solarcost-bridge.env, - la base SQLite,
- el directorio de trabajo,
- los unit files de
systemd, - ni los servicios habilitados.
Eso es intencional para no perder configuracion o datos sin querer.
Si quieres una desinstalacion conservando configuracion:
source .venv/bin/activate
python -m pip uninstall solarcost-bridge
O con el asistente interactivo:
sa_bridge uninstall
Si quieres tocar un servicio system, usa:
sudo "$(command -v sa_bridge)" uninstall
Si quieres una desinstalacion limpia completa:
sudo systemctl stop solarcost-bridge.service
sudo systemctl disable solarcost-bridge.service
sudo rm -f /etc/systemd/system/solarcost-bridge.service
sudo systemctl daemon-reload
rm -f /ruta/a/solarcost-bridge.env
rm -f /ruta/a/data/solar_assistant_totals.sqlite3
rm -rf /ruta/al/directorio/de/trabajo
Uso diario
Para ver logs del servicio:
sudo journalctl -u solarcost-bridge.service -f
Para reiniciarlo:
sudo systemctl restart solarcost-bridge.service
Si prefieres ejecutarlo manualmente:
cd /opt/solarcost/bridge
source .venv/bin/activate
sa_bridge run
La API queda por defecto en http://127.0.0.1:8765.
Actualizacion
cd /opt/solarcost/bridge
source .venv/bin/activate
python -m pip install --upgrade solarcost-bridge
sudo systemctl restart solarcost-bridge.service
- El collector hace una busqueda hacia atras con
prev-dailyyprev-monthly, y luego vuelve al periodo actual connext-dailyynext-monthly. - Por defecto intenta traer
12periodos diarios anteriores y5periodos mensuales anteriores. - Swagger UI esta en
/docsy carga assets desde CDN.
Build y publicacion
Build local:
python -m pip install --upgrade build
python -m build
El repo incluye workflows de GitHub Actions para:
- CI en
pushypull_request, - publicacion manual a TestPyPI con
workflow_dispatch, - publicacion a PyPI al crear un tag
v*.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solarcost_bridge-0.1.2.tar.gz.
File metadata
- Download URL: solarcost_bridge-0.1.2.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82f3791d72e8e3b82e0e01a0d646a19455eb7e332b7ff4abd4ed5e7bc77a6646
|
|
| MD5 |
2c15a3016906cb7fa32e6246d342a818
|
|
| BLAKE2b-256 |
3f7f0a568d2255dbf13c8aba7e8edef3f7d09c6552e25767b1083635d09e54af
|
Provenance
The following attestation bundles were made for solarcost_bridge-0.1.2.tar.gz:
Publisher:
publish.yml on gteijeiro/solarcost-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solarcost_bridge-0.1.2.tar.gz -
Subject digest:
82f3791d72e8e3b82e0e01a0d646a19455eb7e332b7ff4abd4ed5e7bc77a6646 - Sigstore transparency entry: 1320934391
- Sigstore integration time:
-
Permalink:
gteijeiro/solarcost-bridge@93226580b0567448839b8cf09353315a48974a21 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/gteijeiro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@93226580b0567448839b8cf09353315a48974a21 -
Trigger Event:
push
-
Statement type:
File details
Details for the file solarcost_bridge-0.1.2-py3-none-any.whl.
File metadata
- Download URL: solarcost_bridge-0.1.2-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a1f1c4ec4b7c28ce382486cea20b5294ed455e49669272e631fe044c0c20b3d
|
|
| MD5 |
14ead9515c6ea891b0461b8d6c6b90d4
|
|
| BLAKE2b-256 |
33204d7c9924a5378ebc622926e8cd73ff8a5089c1053dab22c75fd05945d300
|
Provenance
The following attestation bundles were made for solarcost_bridge-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on gteijeiro/solarcost-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solarcost_bridge-0.1.2-py3-none-any.whl -
Subject digest:
0a1f1c4ec4b7c28ce382486cea20b5294ed455e49669272e631fe044c0c20b3d - Sigstore transparency entry: 1320934470
- Sigstore integration time:
-
Permalink:
gteijeiro/solarcost-bridge@93226580b0567448839b8cf09353315a48974a21 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/gteijeiro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@93226580b0567448839b8cf09353315a48974a21 -
Trigger Event:
push
-
Statement type: