Pebble.Companion.Environment

Sun, moon, and tide environment helpers for companion apps.

init _ =
    ( model, Environment.current GotEnvironment )

Types

SunInfo

type alias SunInfo =
    { sunriseMin : Int
    , sunsetMin : Int
    , polarDay : Bool
    }

Sunrise, sunset, and polar-day information.

MoonInfo

type alias MoonInfo =
    { moonriseMin : Maybe Int
    , moonsetMin : Maybe Int
    , phaseE6 : Int
    }

Moonrise, moonset, and phase information.

TideInfo

type alias TideInfo =
    { nextMin : Int
    , levelCm : Int
    , rising : Bool
    }

Next tide timing, level, and direction.

EnvironmentInfo

type alias EnvironmentInfo =
    { sun : Maybe SunInfo
    , moon : Maybe MoonInfo
    , tide : Maybe TideInfo
    }

Combined sun, moon, and tide environment snapshot.

Commands

current

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

Request the current environment snapshot.

setup

setup : Cmd msg

Register this platform handler with the companion bridge.

Subscriptions

onEnvironment

onEnvironment : (Result String EnvironmentInfo -> msg) -> Sub msg

Receive pushed environment updates from the companion bridge.

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