Pebble.Companion.Battery

Phone battery helpers for companion apps.

init _ =
    ( model, Battery.current GotBattery )

subscriptions _ =
    Battery.onBattery GotBattery

Types

BatteryInfo

type alias BatteryInfo =
    { percent : Int
    , charging : Bool
    }

Current phone battery charge and charging state.

Commands

current

current : (Result String BatteryInfo -> msg) -> Cmd msg

Request the current phone battery status.

setup

setup : Cmd msg

Register the battery platform handler with the companion bridge.

Subscriptions

onBattery

onBattery : (Result String BatteryInfo -> msg) -> Sub msg

Receive pushed battery status updates from the companion bridge.

Registering this subscription also tells the bridge to send battery updates.