Prerequisites¶
sbam requires these prerequisites to function correctly.
Allow Battery Charging from the Public Grid¶
Check if your inverter permits battery charging from the public grid:
- Open the web interface of the inverter
- Select Device Configuration → Components
- Expand the battery section
- Enable "Allow Battery Charging from the Public Grid"
Enable Modbus and Solar API¶
Modbus¶
Remote control of the Fronius inverter's charge requires enabling the "Slave as Modbus TCP" function.
- Open the web interface of the inverter
- Select the Communication section
- Open the Modbus menu
- Activate Slave (Secondary inverter) Modbus TCP
- TCP port: 502
- Model Type:
int + SF(default) orfloat. Withfloat, setsunspec_typetofloatorauto.
Solar API¶
sbam uses the local Fronius API to retrieve battery data:
- Open the web interface of the inverter
- Select the Communication section
- Open the Solar API menu
- Enable Solar API Communication
Solcast Forecasting Service¶
sbam uses Solcast for weather forecasts and solar production estimates. The free tier allows up to 10 API calls per day.
After adding your installation, you will obtain a forecast link:
https://api.solcast.com.au/rooftop_sites/your-site/forecasts?format=json
Copy it — you will need it for the url configuration option.
API Key¶
- Click on your name at the top right on the Solcast site
- Select Your API Key
- Generate the API key and copy it — you will need it for the
apikeyconfiguration option
Cost Optimizer Prerequisites¶
These are needed only for scheduler_mode: optimize (Cost-optimized Dispatch).
Home Assistant entities¶
| Entity | Example | Requirements |
|---|---|---|
Spot price sensor (optimizer.price_entity) |
sensor.nordpool_kwh_dk2_dkk_3_10_025 |
From the Nordpool integration, configured with VAT in your currency. Unit per kWh (or per MWh). Needs the raw_today/raw_tomorrow or today/tomorrow attributes; hourly and 15-minute prices both work. |
Household load power sensor (optimizer.consumption_entity) |
sensor.solarnet_power_load_consumed |
Instantaneous power of the whole house in W or kW, recorded by the HA recorder. |
EV charger power sensor (optimizer.ev_entity, optional) |
sensor.tesla_wall_connector_total_power |
Power in W or kW. Its energy is subtracted from the household load, so EV charging does not distort the profile. |
The recorder must keep at least optimizer.history_days days of history (default 10). Home Assistant's default purge_keep_days is 10, which matches. Sensors must be lower-case sensor.<object_id> entity IDs.
Home Assistant API access¶
sbam reads states and history from the Home Assistant REST API (GET only).
- HA add-on: nothing to configure. The add-on requests
homeassistant_apiaccess and uses the Supervisor token automatically. - Docker / standalone binary: create a long-lived access token in Home Assistant under Profile → Security → Long-lived access tokens, ideally for a dedicated non-admin user. Set
optimizer.ha_url(e.g.http://homeassistant.local:8123) and pass the token as theHA_TOKENenvironment variable. Usehttpswhen Home Assistant is not on your local network.
Solcast¶
The optimizer always reads the PV forecast through the forecast cache. Make sure Solcast requests succeed; when the forecast is missing or older than max(cache_time, 24 h), PV is counted as 0 Wh and the plan becomes pessimistic.