Pebble App Framework: Phone API
    Preparing search index...

    Function batteryFromUpdate

    • Turns one phone plugin update into the battery level the watch shows.

      The level is rounded to a whole percent and kept from 0 to 100, so a plugin sending a fraction or a number past either end still reads as a battery. An update with no instance, or one with no number for the battery, reads as no reading.

      Parameters

      • envelope: SourceEnvelope | null | undefined

        The update, which may be missing or carry anything.

      Returns number

      The level from 0 to 100, or -1 for none.