Solarbank 2

class SolixBLE.Solarbank2(ble_device: BLEDevice)

SolarBank 2 Power Station.

Use this class to connect and monitor a Solarbank 2 power station. This model is also known as the A17C1.

Note

It should be possible to add more sensors. I think devices with lots of telemetry values split them up into multiple messages but I have not played around with this yet. That and I am being a bit conservative with these initial implementations, if you want more sensors and are willing to help with testing feel free to raise a GitHub issue.

__init__(ble_device: BLEDevice) None

Initialise device object. Does not connect automatically.

add_callback(function: Callable[[], None]) None

Register a callback to be run on state updates.

Triggers include changes to pretty much anything, including, battery percentage, output power, solar, connection status, etc.

Parameters:

function – Function to run on state changes.

async connect(max_attempts: int = 3, run_callbacks: bool = True) bool

Connect to device.

This will connect to the device, determine if it is supported and subscribe to status updates, returning True if successful.

Parameters:
  • max_attempts – Maximum number of attempts to try to connect (default=3).

  • run_callbacks – Execute registered callbacks on successful connection (default=True).

async disconnect() None

Disconnect from device and reset internal state.

Disconnects from device, resets internal state, including connection attempts, cancels the automatic reconnection task and will not execute state changes callbacks.

remove_callback(function: Callable[[], None]) None

Remove a registered state change callback.

Parameters:

function – Function to remove from callbacks.

Raises:

ValueError – If callback does not exist.

property ac_power_out: float

AC Power Out.

Returns:

Total AC power out or default float value.

property ac_power_out_sockets: float

AC Power Out to sockets.

Returns:

AC power out or default float value.

property address: str

MAC address of device.

Returns:

The Bluetooth MAC address of the device.

property available: bool

Connected to device and data is available.

Returns:

True/False if the device is connected and sending telemetry.

property battery_charge_power: float

Battery charging power.

Returns:

Total battery power in or default float value.

property battery_discharge_power: float

Battery discharging power.

Returns:

Total battery power out or default float value.

property battery_heating: bool | None

Whether the battery is currently heating.

Returns:

True if heating, False if not heating.

property battery_percentage: int

Battery Percentage.

Returns:

Percentage charge of battery or default int value.

property battery_percentage_aggregate: int

Battery Percentage average across all batteries.

Returns:

Percentage charge of battery or default int value.

property charged_energy: float

Total accumulated energy that passed through the battery in kWh

Returns:

The amount of energy or default float value.

property connected: bool

Connected to device.

This does not mean that an encrypted connection has been established or that any data values have been populated, use the available property to determine that.

Returns:

True/False if connected to device.

property consumed_energy: float

Consumed energy by house.

Returns:

Total energy consumed by house or default float value.

property error_code: int

Device error code.

Returns:

Error code or default int value.

property grid_export_energy: float

Grid export energy.

Returns:

Total energy exported to grid or default float value.

property grid_import_energy: float

Grid import energy.

Returns:

Total energy imported from grid or default float value.

property grid_status: GridStatus

Grid connection status.

Returns:

Grid status.

property grid_to_home_power: float

Grid to home power.

Returns:

Power from grid to home or default float value.

property home_load_preset: int

Home load preset in watts.

Returns:

Home load preset in watts or default int value.

property house_demand: float

House demand power.

Returns:

Power used by house or default float value.

property input_cutoff_data: SBPowerCutoff

Input cutoff threshold in %.

Returns:

Input cutoff battery SOC threshold.

property last_update: datetime | None

Timestamp of last telemetry data update from device.

Returns:

Timestamp of last update or None.

property light_mode: LightMode

Light mode. Normal or Mood.

Returns:

Light mode.

property light_on: bool | None

Whether the light is switched on. Original value is inverted because it is called “light_off_switch”

Returns:

True if light is on, False if off.

property lowpower_input_data: int

Low power input data.

Returns:

Low power input data or default int value.

property max_load: MaxLoadSB2

Maximum output power in watts.

Maximum legal value depends on country of operation.

Returns:

Maximum load as a MaxLoadSB2 enum value.

property name: str

Bluetooth name of the device.

Returns:

The name of the device or default string value.

property negotiated: bool

Has an encrypted session been successfully negotiated.

This does not mean that any data values have been populated, use the available property to determine that.

Returns:

True/False if session has been negotiated and connected.

property output_cutoff_data: SBPowerCutoff

Output cutoff threshold in %.

Minimum battery SOC to maintain.

Returns:

Output cutoff battery SOC threshold.

property output_energy: float

Output energy in kWh.

Returns:

Total energy output or default float value.

property power_out: float

Total Power Out.

Returns:

Total power out or default float value.

property pv_to_grid_power: float

PV to grid power.

Returns:

Power from PV to grid or default float value.

property pv_yield: float

Solar energy generated in kWh.

Returns:

Total solar energy generated or default float value.

property serial_number: str

Device serial number.

Returns:

Device serial number or default str value.

property software_version: str

Main software version.

Returns:

Firmware version or default str value.

property software_version_controller: str

Software version of the controller.

Returns:

Firmware version or default str value.

property software_version_expansion: str

Software version of any expansion batteries.

If there is no expansion battery then it will be “0”.

Returns:

Firmware version or default str value.

property solar_power_in: float

Total Solar Power In.

Returns:

Total solar power in or default float value.

property solar_pv_1_power_in: float

Solar Power In for port 1.

Returns:

Solar power in or default float value.

property solar_pv_2_power_in: float

Solar Power In for port 2.

Returns:

Solar power in or default float value.

property solar_pv_3_power_in: float

Solar Power In for port 3.

Returns:

Solar power in or default float value.

property solar_pv_4_power_in: float

Solar Power In for port 4.

Returns:

Solar power in or default float value.

property temperature: int

Temperature of the unit (C).

Returns:

Temperature of the unit in degrees C.

property temperature_unit: TemperatureUnit

Temperature unit setting.

Returns:

Temperature unit (Celsius or Fahrenheit).

property usage_mode: SBUsageMode

Usage mode.

Returns:

Usage mode as a SBUsageMode enum value.