State

The combined battery state of the system.

It might differ from the individual battery condition on bikes with multiple batteries.

const onBatteryStateChange = (value: BatteryCondition, timestamp?: Date) => {
    console.log(value, timestamp);
};

COBI.batteryController.state.read(onBatteryStateChange); // Instantly get the current value
COBI.batteryController.state.subscribe(onBatteryStateChange);
COBI.batteryController.state.unsubscribe(onBatteryStateChange);
Example Response
{
    "batteryLevel": 0.0,
    "state": "CHARGING"
}

Last updated