Pebble App Plugins
The Pebble app runs plugins on the phone that serve data to watchfaces: the weather for the places in the Pebble app's own weather list, the events in the phone's calendars, stock quotes, what the phone is playing, and the phone's battery. A face built with a plugin define reads that data through the Pebble app rather than fetching it, and a face built without one carries none of the code. Plugins only answer while the wearer has them turned on in the Pebble app, under Settings, Plugins, so every part of this is written for a phone where they are off as well. Plugin Apps covers building a plugin of your own.
The phone code lives under src/ts/plugin-sources/, and the rest of the phone code reaches it only through index.ts. The shared parts are subscription.ts, which keeps one live subscription per kind, page.ts, which adds the plugin choice and its notes to the settings page, and standard.ts, which checks what a plugin says it serves. Each kind has a file that turns a plugin's update into what the watch takes, such as weather.ts, stocks.ts, and calendar.ts. The build side is the table of kinds in plugin-kinds.ts, the providers list in providers.ts, and the swap in build-pkjs.ts.
Turning It On
A face turns plugins on one kind of data at a time, in its appinfo's defines. For the weather, stocks, and the calendar it lists the weather, stocks, and calendar features in startPebbleApp as it would without plugins. Now playing and the phone's battery have no feature without plugins, so a face lists music from ts/music/feature and phone from ts/phone/feature for those two:
"defines": {
"PLUGIN_WEATHER": 1,
"PLUGIN_CALENDAR": 1
}
app.startPebbleApp({ clayConfig, features: [weather, calendar] });
| Define | What It Reads | Keys It Brings | Select Key | Permission |
|---|---|---|---|---|
PLUGIN_WEATHER |
weather/location |
WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, WEATHER_OK |
WEATHER_PROVIDER |
Location, which every weather face lists |
PLUGIN_STOCKS |
finance/stock |
STOCK_STRIP, STOCK_REQUEST |
STOCK_PROVIDER |
none |
PLUGIN_CALENDAR |
calendar/event |
CALENDAR_STRIP |
CALENDAR_SOURCE |
Calendar |
PLUGIN_MUSIC |
music/track |
MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, MUSIC_REQUEST, and MUSIC_ARTWORK with music.withArtwork |
none | ReadMusic |
PLUGIN_PHONE |
phone/phone_state |
PHONE_BATTERY, PHONE_REQUEST |
none | none |
Each define decides its own kind and nothing else. It puts that kind's plugin code in the phone bundle, adds that kind's choice and notes to the settings page, and adds its permission to the manifest, as What the Phone Lets It Reach covers. A face can take plugin weather and keep its calendar on the iCal link alone, with no calendar choice on its page and no Calendar prompt, by setting PLUGIN_WEATHER alone. A define set to 0 is off, the same as one left out. The defines also reach the watch C as -DPLUGIN_WEATHER=1 and so on. There the weather, stock, and calendar defines keep the wearer's choice on the watch, as Keeping the Choice through a Reset covers, and PLUGIN_WEATHER on a face with no unit key drops the unit letter, as Units from the Plugin covers.
The Watch Needs settings_init. With the weather, stock, or calendar define on and the select key declared, the watch keeps the wearer's choice in the framework's own settings schema, so a reset of the Pebble app brings it back. That only happens once settings_init has run. A face with settings of its own already calls it. A face with no settings of its own has to call settings_init(NULL) at launch, before appmessage_open, or it keeps nothing and a reset drops the wearer's pick. The outbox is sized from the settings reply when it opens, so a call after it leaves every settings reply empty, and a reinstall restores nothing. The build cannot tell whether a face calls it, so nothing warns. The choice only goes back to the phone in the settings reply, so the build adds SETTINGS_REQUEST and SETTINGS_FRESH to such a face's keys, even one with no settings of its own. Keeping a Plugin Source covers the rest, including key 249, which every face leaves free.
Each Define Needs Its Keys. The build stops on a define without the keys its kind needs, so the mistake shows at build time rather than as a lost save or a subscription with nowhere to send. The select key is the one the plugin choice saves under. The calendar's select is one the page adds, and Clay saves a setting to the watch under its key's number, so the face declares CALENDAR_SOURCE even though its own page has no such row. A new key needs a --clean build. Now playing and the phone's battery have no other source, so the build also stops on their keys without their define, since nothing on the phone would ever answer them.
The List beside the Define
The define puts the code in. The providers list in the appinfo, beside defines, says what the settings page offers for the kind:
"providers": {
"weather": ["plugin", "openmeteo"],
"calendar": ["plugin"]
}
With the define on, weather, stocks, and the calendar each run in one of three modes:
- No List. The source select offers every custom provider, and Preferred Source joins it when a plugin on the phone serves the kind.
- The Plugin and Custom Providers, such as
["plugin", "openmeteo"]. The select offers the listed custom providers, and Preferred Source joins it the same way. The first custom provider listed is the default, whereverpluginsits. - The Plugin Alone,
["plugin"]. The page has no select and none of the rows only a custom provider needs, and the feature always reads from the plugin, whatever is saved.
Now playing and the phone's battery only ever run the third way, so their list is ["plugin"] or left out.
What Each Mode Brings. Every mode brings the kind's keys from the table, which the build adds to the face's message keys after its own. The select key comes with no list or a mixed list, along with SETTINGS_REQUEST and SETTINGS_FRESH, and is refused beside a plugin only list, since a plugin only kind keeps no choice. A face moving a kind to ["plugin"] that lists WEATHER_PROVIDER, STOCK_PROVIDER, or CALENDAR_SOURCE itself takes it out of messageKeys and builds with --clean.
What the Build Refuses. The list and the define have to agree. plugin in a list needs the kind's define on, and a define on beside a list for its kind needs plugin in that list. What the Build Refuses lists the rest of the checks on the providers list, and Offering Fewer Providers covers what each list does to the page.
A Face That Shows Coordinates. A face started with weather.withCoords is offered the plugin choice in every mode. Its coordinate readouts take the latitude and longitude a plugin serves, and show no fix with a plugin that serves none, so the note saying where the weather comes from adds that the coordinates show only from a plugin that serves them. Fetching the Weather covers the reading.
What the Wearer Sees
With no list or a mixed list, the weather's Data Source select gains Pebble App: Preferred Source when a plugin on the phone serves the weather. Picking it reads the weather from the plugin the wearer prefers in the Pebble app. The page puts the select first in its section, under the heading and its lead line, and moves the Location Settings section up to sit right after it when that section only holds rows for a fetch, so picking the plugin never makes rows above the wearer's finger vanish. While it is picked, the rows only a fetch needs hide, such as the API key and the location rows, and a note under the select says the weather comes from the first location in the Pebble app's weather settings.
The stocks' Data Source select gains Preferred Source the same way when a plugin on the phone serves finance/stock. Picking it reads the quotes from the stock plugin the wearer prefers, which keeps its own list of tickers. The select goes first in its section, under the heading, and while it is picked the lead line, the API key, Paid Plan, and the tickers hide, and a note under the select says the watch shows the first four tickers the plugin sends.
The Pebble app has no stock plugin of its own, so a phone with plugins on and no stock plugin installed is the usual state. On that phone the select offers Pebble App: Preferred Source (No Stock Plugin), whether or not the wearer picked it before, so a wearer learns a plugin can feed the quotes. The note under it, or on a plugin only page the note in the stock card, says to get a stock plugin from the Pebble app store. The supported plugins panel lists Pebble's Stocks and Stocks + Crypto under Stocks, with their store listings. With plugins off, the option shows only for a saved plugin choice, as Plugins Off.
The calendar's page has no source select of its own, since without plugins it would hold one option. The calendar adds a Calendar Source select, with iCal Link and Preferred Source, under the leading heading and text rows of the section holding the iCal link. A phone with no plugin serving the events leaves it one option, so the select goes and the page shows the link as it would without the define.
A Choice Never Saved. A source choice the wearer has never saved starts on the plugin while a plugin on the phone serves the kind, for the weather, the stocks, and the calendar alike. The feature reads from the plugin and the page opens with Preferred Source picked, so a fresh install takes a plugin the phone already has. A plugin list the phone will not give does not count. Once the page is saved, the saved choice always stands. The Calendar Source select is on the page only while a plugin is on offer, so a saved iCal link with no source saved beside it counts as choosing iCal, and a calendar plugin turning up later leaves the wearer's feed alone. A choice never saved goes back to the face's default by itself once nothing serves the kind, such as after plugins go off. The phone hands over at once when the subscription reports the plugin gone, and otherwise at the next slow tick or watch ask. The phone reads its plugin list again when it follows the choice, when the page opens, and on a subscription error, rather than on every update, and a list it cannot read keeps the last answer. freshPlugin and readSourceChoice in driver.ts hold the rule, and a kind's page hook passes pluginByDefault to pluginSourcePage from the same call.
With a plugin only list, the page shows notes where the select or the iCal link would sit: where the data comes from, and while nothing on the phone serves the kind, how to turn plugins on. Now playing and the phone's battery always get their notes this way, as The Phone and Music Stores covers.
Warnings under the Choice. While the plugin is picked, the page reads what the plugin source saved last and adds a note for each thing that went wrong. A plugin that answered and does not send the readings the face needs gets one, as Preferred Source and the Standard Check covers. A wearer who has not allowed the permission gets one saying to allow it for this face in the Pebble app. A stock update with no tickers gets a calmer note saying the phone may have been offline, or the plugin may have no tickers set up in its own settings. A calendar update that held no events gets a calmer note saying the Pebble app may need permission to read the phone's calendars, or that those calendars may be switched off in its calendar settings.
With Plugins Off
A current Pebble app always has the plugin calls, and with plugins off Pebble.enumeratePlugins() lists nothing. That reads the same as a plugin the wearer removed, so the face treats the two alike.
- No Define. Nothing changes, since the face has no plugin code.
- No List or a Mixed List, Plugin Not Picked. The select offers only the custom providers, and the calendar has no select. The face fetches as it would without the define, a choice never saved included. The supported plugins panel opens on a line saying to turn plugins on.
- A Saved Plugin Choice. The option stays, as Pebble App: Preferred Source (Plugins Off), with a note saying to turn plugins on, so a save keeps the choice and the plugin answers again once they are back. The weather panel on the watch shows
No Plugin, and the stock strip showsNO PLUGINin its first slot. The calendar sends nothing, so the watch keeps the agenda it holds. - The Plugin Alone. The page shows the note saying to turn plugins on, or leaves it to the panel when the panel opens on the same line. The weather shows
No Plugin, the stock strip showsNO PLUGIN, and the calendar keeps what it holds.
A Pebble app from before plugins has no plugin calls at all, and the page reads it as a phone with plugins off. The one difference is a settings restore after a reset, which drops a saved plugin choice back to the page's default, since that phone can never answer it.
Each Kind
Weather. A weather plugin serves one place per location in the Pebble app's weather list, and the face shows the first. Its update becomes the same reading an Open-Meteo fetch gives, so the watch reads it through the keys it already has, with the pressure, the dew point, and the finer sky too from a plugin that serves them. The plugin keeps its reading fresh by itself, so a watch ask only resends the last update as of now. The watch shows No Location for an update with no places, No Wx Data for a first place with no temperature it can use, No Plugin when nothing on the phone serves the weather, and No Permission until the wearer allows Location. Fetching the Weather covers the reading.
Stocks. A stock plugin serves one instance per ticker, and the strip shows the first four in the plugin's order. Each becomes the same quote a provider round gives, so the watch reads it through the strip it already has, and no provider call or quota is spent. A ticker the plugin has no price for keeps its slot with the plugin's status word, or NO DATA. An update with no tickers clears the strip only when it is the first since the plugin was picked or since the phone ended it, since an offline phone answers with none, and a watch ask resends the last update sent to the watch. The Stock Store covers the reading.
The Calendar. A calendar plugin serves one instance per event in the phone's calendars. The subscription asks for 18 events with limit, where the Pebble app would give the next 10. Its events go through the same week the iCal reader keeps, so the agenda reads the same from either source. An update with no events sends an empty agenda, since that is how the watch hears every event was deleted. An error sends nothing, since the watch has no status line for the calendar. The Calendar Store covers the reading and the agenda hold after a reset.
Now Playing and the Phone's Battery. Both come only from plugins, so their stores on the watch clear when no plugin answers. The Phone and Music Stores covers both.
The Build Swap
The phone bundle only carries what the face's entry reaches through require, so the define has to cut the require graph rather than skip code at runtime. Every kind's code sits in its own file under plugin-sources/, and index.ts exports one name per kind, such as weatherPlugins, typed as possibly null. The features import that name and run exactly as they would without plugins when it is null.
After the phone code compiles, the build writes its own plugin-sources/index.js over the compiled one. A kind whose define is on is required from its own file, and a kind whose define is off is null:
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.weatherPlugins = require('./weather').weatherPlugins;
exports.stockPlugins = null;
exports.calendarPlugins = null;
exports.musicPlugins = null;
exports.phonePlugins = null;
With every kind off, the build also deletes the rest of the emitted plugin-sources/ files, so the emit tree shows plainly that the face built without plugins. The build log says which way it went, as with plugin weather, calendar or without plugins. A face's own code that requires a file in plugin-sources/ other than its index stops the build, since that require would reach a file the swap can leave out.
Turning a define on or off needs no --clean. The phone code compiles into an emptied emit tree on every build, and the define's C flag rebuilds the C side on its own. So does the default the build writes for the choice the watch keeps, which changes with the providers list. Its keys still need one when they are new.
Preferred Source and the Standard Check
The face never names a plugin. It subscribes to the kind, such as weather/location, and the Pebble app routes it to the plugin the wearer prefers for that kind, under Preferred Sources in the Pebble app. So one face works with the Pebble app's own plugins and with any store plugin that serves the same data.
The Pebble app only holds a plugin to its own manifest, so a weather plugin that names its reading temp rather than temperature still reaches the face, which then finds nothing it can use. So the settings page reads the manifest of the plugin that answered last and checks it declares what the face needs:
| Kind | What a Plugin Has to Declare |
|---|---|
| weather | temperature as a numericValue, and condition_code as a longText |
| stocks | ticker as a shortText or a longText, and price as a shortText, a longText, or a numericValue |
| calendar | name as a shortText or a longText, and starts_at as a timestamp |
| now playing | title as a shortText or a longText, and playing as a boolean |
| phone battery | battery_level as a numericValue |
A plugin that fails gets a note on the page naming it, saying it sends data this face cannot read, and pointing the wearer at Preferred Sources in the Pebble app, or at another source on the face's own select. Everything else a plugin sends is optional, and leaving it out only leaves that readout on its dashes.
The Supported Plugins Panel
A face built with any plugin define gets one more row at the foot of its settings page once one of its kinds offers a plugin: a closed panel titled Plugins This Face Supports. Opened, it lists under a heading for each kind the face has on the plugins known to serve it, and where to get them.
- The Pebble App's Own. Each built-in plugin reads Weather - Built Into the Pebble App, and Weather - Built Into the Pebble App, Off when the phone's plugin list leaves that one out, as it leaves every one out with plugins off. The music plugin is built in on Android only, and says so.
- Store Plugins. A store plugin links to its listing on the Pebble appstore, and carries the version tested with the face, the
verifiedVersionin the table, as in MET Norway Weather - v1.0.5. It reads MET Norway Weather - v1.0.5 - Installed when the phone lists it. The panel's intro says the version is one tested with the face, which may not be the plugin's newest. - Plugins the Table Does Not Know. A plugin on the phone serving the kind that the table does not know is listed by its own name, cut to 40 characters, or as Unnamed Plugin when it has none, and reads Pirate Weather - Installed, with no version.
- Plugins Off. When the phone lists no plugins at all, the panel opens on a line saying to turn plugins on in the Pebble app under Settings, Plugins, or to update the Pebble app.
The panel's headings are in directory.ts, and the plugins it knows are in known-plugins.json, which the table below is written from. A kind a plugin serves that the panel has no heading for, such as finance/crypto, is left off the panel.
The Face's Own Wording. The notes and the panel say "this face", so they read right on a watchface and a watchapp alike. A face that wants other words passes pluginTexts to startPebbleApp, with any of a kind's texts under its name in the providers list, and the panel's title and intro under panel. Each text it names takes the place of the framework's own for that kind, and a text left out keeps it:
startPebbleApp({
clayConfig,
features: [weather],
pluginTexts: {
weather: { permissionDenied: "My Face needs Location to read the Pebble app's weather. Allow it in the Pebble app." },
panel: { title: 'Plugins My Face Supports' },
},
});
A kind's texts are notStandard and notStandardNoSelect, which take the plugin's name, and permissionDenied, empty, source, noPlugin, and notInstalledLabel, as PluginSourceTexts in page.ts describes. A face that gives notStandard and no notStandardNoSelect gets its line on a page with no source select too. The weather's line on coordinates joins whichever source line wins, the face's own included. {panel} in a text stands for the panel's title as it reads, the face's own included, which is how the stock line for no plugin points the wearer at the panel. faceStart keeps the wording where every plugin source page reads it, so the phone, the build's own page load, and clay-preview all open the page in the face's words.
Supported Plugins
These are the plugins the panel knows, by the kinds they serve. What It Serves is what each serves for the kind, where the standard fields are the ones the Pebble app's own plugin of that kind serves. Fetching the Weather covers which of a weather plugin's fields a face reads.
| Kind | Plugin | Maker | What It Serves | Last Verified |
|---|---|---|---|---|
weather/location |
Weather | Pebble | The standard fields | Built In, 10 Nov 2026 |
weather/location |
MET Norway Weather | Pebble | The standard fields | 1.0.5, 12 Nov 2026 |
weather/location |
Weather+ | Eric McCormick | The standard fields, and hourly series of the dew point, the WMO weather code, and the UV | 1.0.0, 12 Nov 2026 |
weather/location |
Weather Enhanced | Null Syntax | The standard fields, with pressure, the dew point, the WMO weather code, hourly and daily series, and the coordinates for a request that names them | 1.0.0, 12 Nov 2026 |
calendar/event |
Calendar | Pebble | The standard fields | Built In, 10 Nov 2026 |
calendar/event |
Calendar Enhanced + iCal | Null Syntax | The standard fields, with the events of up to two iCal links merged into the agenda | 1.1.0, 12 Nov 2026 |
music/track |
Music (Android Only) | Pebble | The standard fields | Built In, 10 Nov 2026 |
phone/phone_state |
Phone | Pebble | The standard fields | Built In, 10 Nov 2026 |
finance/stock |
Stocks | Pebble | Pebble's five stock fields, from Yahoo with no key | 1.0.4, 13 Nov 2026 |
finance/stock |
Stocks + Crypto | Null Syntax | Pebble's five stock fields, and the currency, the quote time, the source, and the market state | 1.0.1, 12 Nov 2026 |
finance/crypto |
Stocks + Crypto | Null Syntax | Crypto pairs | 1.0.1, 12 Nov 2026 |
The list is copied by hand from the Pebble appstore, so it ages as plugins are published. Each entry in known-plugins.json records the version it was last checked against in verifiedVersion, Built In for one built into the Pebble app, and the date in verifiedOn. Update both whenever an entry is checked again against a new version of the plugin. After a change to the file, npm --prefix docs run plugin-table writes the table again, and a docs spec fails while the table and the file differ.
Links. A plain link on a Clay page would load inside the settings web view and lose the wearer's unsaved settings. The Pebble app gives a settings page Pebble.openUrl while plugins are on, which asks before opening the link in the phone's browser. So a store plugin's name is a link only when the page has Pebble.openUrl, and is plain text with the listing's address under it otherwise.
The panel is drawn with <details>, so the web view opens and closes it with no script. Every name in it is escaped before it reaches the page, so a plugin's name can never become markup or code.
Marks on the Page
The settings page is built on the phone from the face's own config, and the builder cannot see the defines. So the builder marks its rows on every face, and only a face built with a plugin define acts on the marks. Clay ignores fields it does not know, so on any other face the marks do nothing.
| Mark | Goes On | What a Face with the Define Does with It |
|---|---|---|
pluginSource: { category, item } |
the select a plugin choice joins | adds Preferred Source to it |
pluginSourceHides: '<select key>' |
a row that means nothing while the plugin is picked | hides it while the plugin is picked, and takes it off the page in plugin only mode |
pluginSourceLead: '<select key>' |
a line that leads into the select | keeps it showing with the select, and takes it away with the select |
pluginSourceRows: '<kind>' |
a row the face wants a kind's notes under, by the kind's name in the providers list, such as 'music' or 'stocks' |
puts the notes for a kind with no select straight after it, rather than at the foot of the page |
buildConfig marks its own rows: WEATHER_PROVIDER and STOCK_PROVIDER carry pluginSource, the weather lead line carries pluginSourceLead, and the weather's API key and unit rows, the Location Settings heading and its three rows, the stocks' lead line, API key, Paid Plan, and tickers, the iCal lead line, and the iCal link carry pluginSourceHides. A face that builds its own weather, stock, or calendar section marks its own rows the same way. A select that carries no mark is still found by its message key when it has options, so a weather select from a family core gets Preferred Source with nothing added. A row that already has a visibleWhen keeps it, and the hide joins it as one more condition that has to hold.
A Section with Every Row Hidden. Clay draws a section as a card it cannot hide, so a section whose rows all hide would leave an empty card behind. The page marks such a section hideWhenEmpty, and the framework's show and hide then hides the card while every row in it is hidden. A face can put hideWhenEmpty on a section of its own for the same reason, as long as a row inside it has a message key.
When There Is No Choice. When a plugin choice has nothing to join, such as a weather select the face left out or a calendar select left with one option, the page takes the marks naming that select off every row, and the lead line marked for it goes with the select. A section the two leave holding only headings goes too, so no card stands empty under its heading. A visibleWhen naming the select is settled against the one option left, so a row whose condition holds shows and a row whose condition fails stays hidden. Without that, a condition on a missing control would hide its row for good.
The page Hook
The features add all of this through page, a hook any feature can supply, as Features lists. Each time the wearer opens the settings, after configOpened, the app passes the page through each feature's page hook in turn and opens the result:
- It Starts from the Face's Page. Each open starts again from the face's own page, which the defaults and the settings restore also read, so a hook keeps nothing from one open to the next.
- It Gets Its Own Copy. Each hook gets its own copy of the page so far and hands back the page to open. It can change that copy in place.
- One Hook Cannot Break the Page. A hook that throws, or hands back something that is not a page, is skipped and logged, and the page the hooks before it made goes on.
- Components Ride Along. A feature lists the Clay components its rows are drawn with as
components, and the app registers each one only for a page that holds its rows. A face without the define never carries their code. - The Show and Hide Comes First. The page's custom function is put together again on every open. The framework's show and hide for
visibleWhenrows runs first, then the plugin sources a builder's warnings read on a page with the plugin kinds row, and the face's owncustomClayafter them, so a face's function can still change a row the plugin page showed or hid.
A face with no feature that supplies a page hook, and no API key row, opens exactly the page Clay built from its config. A page with a key row gets the key for each provider, as A Key for Each Provider covers.
Which Kinds the Phone Serves
Each kind's page hook records where its plugins stand as the page opens, so a face's own Clay components can act on it, such as a layout builder warning that a placed panel needs a plugin the phone lacks. The framework only provides the states. What a face does with them is its own.
The states sit in a pluginKinds row, a hidden input with the class pf-plugin-kinds, which the page hooks put first on the page. It does not carry the hidden store's pf-hidden-store class, so a face that finds its own hidden store with a plain lookup never lands on it. Clay builds rows in the order they are declared, so a component anywhere on the page finds it already built. The store has no message key, so Clay never saves it and it never reaches the watch. Its value is JSON mapping each kind the face reads from a plugin, by its name in the providers list, to one of three states, the PluginKindState in page.ts:
| State | What the Phone Lists |
|---|---|
off |
no plugins at all, which is plugins off in the Pebble app, or a Pebble app from before plugins |
missing |
plugins, and none of them serves the kind |
served |
a plugin serving the kind, or a list the phone will not give, since the phone may still route to a plugin it does not list |
The kinds are weather, stocks, calendar, music, and phone. A kind the face does not read from a plugin, such as one built without its define, is left out, and a page with no plugin kinds has no store. So is a kind whose select drops to one option, or is missing from the page, while the face is on a source of its own, since nothing on the page reads the plugin for it then. A page that leaves out every kind that way keeps the store, holding none. A component reads it in its initialize:
var store = document.querySelector('.pf-plugin-kinds');
var kinds = store && store.value ? JSON.parse(store.value) : {};
if (kinds.music === 'off' || kinds.music === 'missing') {
// warn on the now playing panel
}
PLUGIN_KINDS_CLASS, PLUGIN_KINDS_TYPE, and pluginKindState are exported from page.ts for code on the phone side.
A drag and drop builder can take the warnings ready made. The builder piece ts/shared/plugin-warnings reads the row, takes the kind each panel reads from the face, and names each placed panel that cannot fill, as Warning about Panels That Need a Plugin covers.
The Quick Retry
A plugin subscription lasts as long as the phone code's session, so the feature starts it afresh on every ready. While the plugin is picked and nothing is live, such as with plugins off or no plugin installed, the feature tries again every 2 minutes, so a plugin the wearer has just installed or turned on shows up within minutes. Reading the phone's plugin list is a local call, so a retry costs nothing on the network.
The quick retry runs 15 times, about 30 minutes, and then leaves it to the slow refresh every 30 minutes or so. Starting the subscription, opening the settings page, and a save while the plugin is picked each give it the full 15 again. A retry is only spent while nothing is live, so a subscription that ends hours later, as when the wearer turns plugins off, still has its retries then and catches plugins coming back on.
Every kind waiting on a retry shares one 2 minute timer, so a face with weather and the calendar from plugins wakes the phone code once on each beat rather than once for each kind. Each kind keeps its own 15 retries, and the timer stops once no kind has any left. A kind that starts waiting while the timer already runs takes its first retry on the timer's next beat, which can come sooner than 2 minutes. A subscription with no quick retry, such as the one to the Pebble app's units, stays off the timer.
Units from the Plugin
While the plugin is picked, the weather shows in the plugin's own units, so the wearer sets them in one place for every face. Each reading carries them as the face's WEATHER_TEMPERATURE_UNIT and WEATHER_WIND_UNIT, and the watch takes them as its unit settings. The face's own unit rows carry pluginSourceHides, so they hide while the plugin is picked, and the units saved on the phone wait there for a switch back to a fetch. A save or a restore while the plugin is picked sends the plugin's last units in their place, through the weather's settingsOut hook, so the watch never shows the face's units for a moment. A fetched reading on a face built with PLUGIN_WEATHER carries the face's own units the same way, so the watch goes back to them whenever a fetch takes over, such as when plugins go off with no save. The built-in weather sends °C and mph whatever the wearer picked, so the units the wearer picked in the Pebble app are used in their place, read from the Pebble app's preferences/units, which needs no permission. fixedUnits in src/known-plugins.json marks a plugin that sends fixed units this way.
A face with no WEATHER_TEMPERATURE_UNIT key has no unit setting of its own. Its plugin weather comes in the plugin's unit, and a fetch in the unit picked in the Pebble app, or Celsius until the Pebble app has given one. The watch has no unit to convert to, so readout_weather_temp writes the number with no letter, as Readouts covers. Fetching the Weather covers when the units are read and what a change sends.
Keeping the Choice through a Reset
When the Pebble app is reinstalled, or its saved settings for the face are cleared, the phone fills its settings back in from what the watch sends, as The Life of a Setting shows. The watch only sends what it keeps. So on a face that offers the plugin choice, the framework keeps it on the watch in a schema of its own, with a default the build writes from the providers list, as Keeping a Plugin Source covers. The face adds nothing to its own settings for it.
The features' seeded hooks then check what came back. A plugin choice comes back on any phone with the plugin calls, plugins off included, and comes out on a Pebble app from before plugins. A weather provider that needs an API key comes out when the phone holds no key, since the key never reaches the watch, and the face reads the choice as never saved rather than showing No API Key. That is a plugin serving the weather, or else the default provider. A restored choice that is the face's default comes out too, the calendar's iCal included, since the watch keeps the default for a choice nobody ever made. The choice then reads as never saved, so a plugin on the phone takes it, as on a fresh install. A wearer who saved the default on purpose while a plugin was on offer moves onto the plugin after a reset.
A Face with No Settings Page
A face with no settings of its own passes an empty page, and takes its weather from the plugin alone:
"defines": { "PLUGIN_WEATHER": 1 },
"providers": { "weather": ["plugin"] }
app.startPebbleApp({ clayConfig: [], features: [weather] });
The define and the weather feature bring the four weather keys, so it lists no message keys of its own. Its page holds only the weather's notes and the supported plugins panel. It has no unit setting, so it shows the weather in the plugin's unit, and keeps nothing on the watch for a reset, since it has no choice to keep.