MCPcopy Index your code
hub / github.com/atbore-phx/sbam

github.com/atbore-phx/sbam @v2.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.0 ↗ · + Follow
725 symbols 2,844 edges 56 files 118 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

codecov

sbam - Smart Battery Advanced Manager.

Charge Fronius battery using SolCast weather forecast.

[!CAUTION] This project is an unofficial, community-maintained implementation and is not sponsored, endorsed, or supported by Fronius. Use it at your own risk. The software and accompanying documentation are provided "AS IS", without any warranty, express or implied. Neither the author nor any contributor accepts liability for damages, losses, or other consequences resulting from the use of this project or its dependencies.

[!IMPORTANT] Keep your GEN24 inverter firmware up to date. This integration is tested only on recent firmware versions and may not work correctly on older releases. We strongly recommend updating your inverter to the latest official firmware before using sbam. Always review Fronius release notes and back up your inverter settings before updating. Firmware versions prior to 1.34.6-1 are known to limit battery charging and are not supported.

Introduction

After installing a Fronius Gen24 plus Solar system including a BYD battery, I wanted during months of low solar production to charge the battery at night when electricity costs are generally lower, in order to use the stored energy during the day.

Fronius through the local web interface reachable from the inverter's LAN IP provides the Battery Management utility -> Time-dependent battery control.

Indeed, it is possible to charge at night, but the process is static. Many times, I found the battery to be either too charged or too discharged the next day. I wanted something more advanced, dynamic, and adaptive that takes into account:

  • weather forecasts
  • daily electricity consumption related to my home
  • the current battery charge
  • the minimum reserve of the battery not to go below
  • the time range when the energy operator offers cheaper electricity to force the charge.

NOTE: In Solar.web, the energy balance does not display grid charge information to prevent customers from perceiving a higher consumption than actual. This is done to simplify the Solar.web view. (Source: Official Fronius support)

Here sbam is all this and much more :)

Documentation

sbam is available as a Home Assistant app (add-on) or standalone application that can be used via CLI. \ Full documentation, prerequisites, installation screenshots, configuration references, MQTT guide, CLI reference, and changelog are available at this link: Documentation

Contributions

sbam is an open-source, community-driven project so contributions are welcome from everyone. \ You can file issues to report bugs or request features, improve documentation, add tests, or submit pull requests with proposed changes. \ For larger features please open an issue first to discuss scope; small fixes and documentation updates can be submitted directly as PRs. \ When submitting code, include tests where applicable and keep changes focused so reviews are easy. See the contributor guide for workflow details.

Support :heart:

If you don't code but want to support the project, you can sponsor the project on GitHub Sponsors:

Sponsor on GitHub

Extension points exported contracts — how you extend this code

Client (Interface)
(no doc) [6 implementers]
pkg/mqtt/client.go
MessageHandler (FuncType)
(no doc)
pkg/mqtt/client.go

Core symbols most depended-on inside this repo

Run
called by 93
pkg/cmd/schedule_runner.go
String
called by 33
pkg/fronius/classify.go
ValidateWindows
called by 31
pkg/power/window.go
now
called by 31
pkg/cmd/schedule_runner.go
appendDiscoveryEntity
called by 26
pkg/mqtt/discovery.go
NewRunner
called by 25
pkg/cmd/schedule_runner.go
handleIntent
called by 24
pkg/cmd/schedule_runner.go
checkScheduleschedule
called by 22
pkg/cmd/schedule.go

Shape

Function 540
Method 123
Struct 53
Interface 5
TypeAlias 3
FuncType 1

Languages

Go100%

Modules by API surface

pkg/mqtt/mqtt_test.go100 symbols
pkg/cmd/schedule_runner_test.go80 symbols
pkg/power/window_test.go57 symbols
pkg/cmd/schedule_test.go55 symbols
pkg/cmd/schedule_runner.go35 symbols
pkg/fronius/fronius_test.go34 symbols
pkg/power/power_test.go29 symbols
pkg/mqtt/commands_test.go22 symbols
pkg/cmd/schedule.go22 symbols
pkg/mqtt/client.go17 symbols
pkg/power/window.go16 symbols
pkg/power/horizon_test.go15 symbols

For agents

$ claude mcp add sbam \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page