@rhizomatics/signalk-einklabel-plugin 1.3.0-beta12 → 1.3.0-beta13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,93 @@
1
+ # Tide Clock
2
+
3
+ ![Tide Clock](../assets/screenshots/example_tidal_clock.png)
4
+
5
+ Template available as 416x240-BWRY for 3.7" ESLs and a simpler template, sized 250x128, also BWRY, for the cheapest 2.13" labels.
6
+
7
+ This mini tide clock is a 2.9" Gicisky device, less than £10 inc delivery in summer 2026.
8
+
9
+ ![2.9" Tide Clock](../assets/images/mini_tidal_clock.png)
10
+
11
+ ## Pre-requisites
12
+
13
+ A _tides_ provider plugin for the Resources API installed and enabled, currently one of:
14
+
15
+ - [signalk-tides](https://github.com/openwatersio/signalk-tides) - uses [neaps](https://github.com/openwatersio/neaps) library for international off-line coverage
16
+ - [signalk-mareas-ihm](https://github.com/Aitonos/signalk-mareas-ihm) - interfaces with official Spanish IHM tidal predictions, or falls back to Open Meteo and _signalk-tides_
17
+
18
+ For versions with the moon phases:
19
+
20
+ - [signalk-derived-data](https://github.com/SignalK/signalk-derived-data) - unlike other plugins, this publishes lunar and solar facts as SignalK paths
21
+
22
+ The moon phase is optional - without it, the moon icon is simply left blank and the rest of the tide clock still shows.
23
+
24
+ The [tides](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/tides/) templates can be customized to run with any tide provider, a specific one, or switch to other APIs or SignalK data paths.
25
+
26
+ - In the template it uses a SVG description like `source=resources,resource=tides,provider=tides,path=extremes[0].time,format=local_time` to get the first tide time, ensures it's the preferred `signalk-tides` provider and makes it a simple local time rather than a UTC date-time.
27
+
28
+ To show the lunar phase, the `environment.moon.phaseName` path is required, which can be easily achieved by installing and configuring the `derived-data` plugin.
29
+
30
+ > [!TIP]
31
+ > If testing this without a boat, you'll need another plugin to provide `navigation.position` and `navigation.datetime` to make the moon and tide calcuations work. [signalk-datetime](https://github.com/tmcolby/signalk-datetime) can be configured for the datetime, and [signalk-sailboat-simulator](https://github.com/macjl/signalk-sailboat-simulator) for the postion; other ways may work too.
32
+
33
+ ## Template Reference
34
+
35
+ The `tides` template family picks the best size for each label automatically - see [Template Families](../templates.md#template-families-multiple-panel-sizescolours).
36
+
37
+ <!-- BEGIN GENERATED: template-reference tides -->
38
+ <!-- Generated from the bundled templates by `npm run docs:templates` - do not edit by hand. -->
39
+
40
+ **Template:** `tides`
41
+
42
+ | File | Size (px) | Aspect ratio | Colours | Fits these labels exactly |
43
+ | ------------------------------------------------------------------------------------------------------------------------------ | --------- | ------------ | ------------------------- | ------------------------------------------------------------------------ |
44
+ | [`tides/416x240-BWRY.svg`](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/tides/416x240-BWRY.svg) | 416 × 240 | 1.73 : 1 | black, white, red, yellow | Zhsunyco 3.7" BWRY |
45
+ | [`tides/296x128-BWRY.svg`](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/tides/296x128-BWRY.svg) | 296 × 128 | 2.31 : 1 | black, white, red, yellow | Zhsunyco 2.9" BWRY, Gicisky 2.9" BW, Gicisky 2.9" BWR, Gicisky 2.9" BWRY |
46
+ | [`tides/250x128-BWRY.svg`](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/tides/250x128-BWRY.svg) | 250 × 128 | 1.95 : 1 | black, white, red, yellow | Zhsunyco 2.13" BWRY, Gicisky 2.1" BWR |
47
+
48
+ **Data used**
49
+
50
+ | Source | Path | Options | Used in |
51
+ | ----------------------------------- | ---------------------------- | ------------------------------------- | -------------------------- |
52
+ | `tides` resource (provider `tides`) | `extremes[n].label` | - | all |
53
+ | `tides` resource (provider `tides`) | `extremes[n].level` | category `depth` | all |
54
+ | `tides` resource (provider `tides`) | `extremes[n].time` | format `local_time`, format `day_mon` | all |
55
+ | `tides` resource (provider `tides`) | `station.datums.HAT` | category `depth`, round 1 | 416x240-BWRY |
56
+ | `tides` resource (provider `tides`) | `station.datums.LAT` | category `depth`, round 1 | 416x240-BWRY |
57
+ | `tides` resource (provider `tides`) | `station.name` | - | all |
58
+ | `tides` resource (provider `tides`) | `station.source.name` | - | 416x240-BWRY, 296x128-BWRY |
59
+ | Plugin | `local_zone` | - | 416x240-BWRY, 296x128-BWRY |
60
+ | Plugin | `plugin_version` | - | 416x240-BWRY |
61
+ | Plugin | `repainted` | format `local_datetime_short` | all |
62
+ | Signal K path | `environment.moon.phaseName` | image from `lunar_phases` | 416x240-BWRY |
63
+
64
+ <!-- END GENERATED -->
65
+
66
+ The original single-file version is also still available as `tide.svg`:
67
+
68
+ <!-- BEGIN GENERATED: template-reference tide.svg -->
69
+ <!-- Generated from the bundled templates by `npm run docs:templates` - do not edit by hand. -->
70
+
71
+ **Template:** `tide.svg`
72
+
73
+ | File | Size (px) | Aspect ratio | Colours | Fits these labels exactly |
74
+ | -------------------------------------------------------------------------------------------------- | --------- | ------------ | ------- | ------------------------- |
75
+ | [`tide.svg`](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/tide.svg) | 416 × 240 | 1.73 : 1 | - | Zhsunyco 3.7" BWRY |
76
+
77
+ **Data used**
78
+
79
+ | Source | Path | Options |
80
+ | ----------------------------------- | ---------------------------- | ------------------------------------- |
81
+ | `tides` resource (provider `tides`) | `extremes[n].label` | - |
82
+ | `tides` resource (provider `tides`) | `extremes[n].level` | category `depth` |
83
+ | `tides` resource (provider `tides`) | `extremes[n].time` | format `local_time`, format `day_mon` |
84
+ | `tides` resource (provider `tides`) | `station.datums.HAT` | category `depth`, round 1 |
85
+ | `tides` resource (provider `tides`) | `station.datums.LAT` | category `depth`, round 1 |
86
+ | `tides` resource (provider `tides`) | `station.name` | - |
87
+ | `tides` resource (provider `tides`) | `station.source.name` | - |
88
+ | Plugin | `local_zone` | - |
89
+ | Plugin | `plugin_version` | - |
90
+ | Plugin | `repainted` | format `local_datetime_short` |
91
+ | Signal K path | `environment.moon.phaseName` | image from `lunar_phases` |
92
+
93
+ <!-- END GENERATED -->
@@ -0,0 +1,37 @@
1
+ # Watch Schedule
2
+
3
+ ![Watch Schedule](../assets/screenshots/example_watch_schedule.png)
4
+
5
+ Template available as 416x240-BWRY for 3.7" ESLs.
6
+
7
+ ## Pre-requisites
8
+
9
+ - Source of `watch.current` and `watch.next` values
10
+ - `signalk-watch-schedule` plugin
11
+
12
+ ## Template Reference
13
+
14
+ <!-- BEGIN GENERATED: template-reference watch -->
15
+ <!-- Generated from the bundled templates by `npm run docs:templates` - do not edit by hand. -->
16
+
17
+ **Template:** `watch`
18
+
19
+ | File | Size (px) | Aspect ratio | Colours | Fits these labels exactly |
20
+ | ------------------------------------------------------------------------------------------------------------------------------ | --------- | ------------ | ------------------------- | ------------------------- |
21
+ | [`watch/416x240-BWRY.svg`](https://github.com/rhizomatics/signalk-einklabel-plugin/blob/main/templates/watch/416x240-BWRY.svg) | 416 × 240 | 1.73 : 1 | black, white, red, yellow | Zhsunyco 3.7" BWRY |
22
+
23
+ **Data used**
24
+
25
+ | Source | Path | Options |
26
+ | ------------- | ------------------------- | ----------------------------- |
27
+ | Plugin | `plugin_version` | - |
28
+ | Plugin | `repainted` | format `local_datetime_short` |
29
+ | Signal K path | `watch.current.endTime` | format `local_time` |
30
+ | Signal K path | `watch.current.startTime` | format `local_time` |
31
+ | Signal K path | `watch.current.teamName` | - |
32
+ | Signal K path | `watch.next.endTime` | format `local_time` |
33
+ | Signal K path | `watch.next.startTime` | format `local_time` |
34
+ | Signal K path | `watch.next.teamName` | - |
35
+ | Signal K path | `watch.system.name` | - |
36
+
37
+ <!-- END GENERATED -->
@@ -0,0 +1,33 @@
1
+ # Extending
2
+
3
+ ## Architecture
4
+
5
+ The primary things managed and provided by the plugin are:
6
+
7
+ - ESL Vendor
8
+ - Sub-package per vendor
9
+ - ESL Device
10
+ - Metadata in the vendor package, using a `pid` or sometimes `pid` combined with `hwid` in the BLE results to pinpoint a model
11
+ - SVG Template
12
+ - SignalK API base URL
13
+ - Used for automatic unit conversion on `signalk`-sourced numeric values and for resolving an explicit `category=` binding - neither has an in-process equivalent, both go via this server's own REST API
14
+ - Optional: left blank, the plugin probes the probable values in likelihood order at startup - `http://localhost:3000`, `http://localhost`, `https://localhost`. Set it explicitly to skip probing
15
+ - Either way, errors clearly if nothing responds (wrong port) or the probe is rejected (anonymous read access not enabled) - these endpoints must allow anonymous read access, since the plugin has no login flow
16
+
17
+ ## Hardware
18
+
19
+ Additional vendors and devices can be added by a separate npm package that implements the `VendorDriver` interface and registers itself - there's no scanning of installed packages, registration is always an explicit call by the extension's own code.
20
+
21
+ - `import esl from '@rhizomatics/signalk-einklabel-plugin'; esl.registerVendorDriver(myDriver)`
22
+ - In the SignalK runtime, call this from the extension's own plugin `start()`. In the CLI, load the extension with `esl-cli --require <module> <command>`.
23
+ - Declare this package as a regular npm `dependency` in the extension package - **not** a `peerDependency`, per SignalK's own guidance that npm's peer-dependency resolution interacts poorly with the server's plugin install layout - and declare the SignalK-level relationship via `"signalk": { "requires": ["@rhizomatics/signalk-einklabel-plugin"] }` in the extension's own `package.json` instead, so the App Store can install/report it.
24
+
25
+ ## Template Providers
26
+
27
+ An alternative way to produce a device's content, alongside hand-authored SVG templates, can be added the same way - `esl.registerTemplateProvider({ suffix, listTemplates, render })`, from a separate package's own plugin `start()` (or `esl-cli --require <module>`). This is what [`@rhizomatics/signalk-einklabel-genai-plugin`](templates.md#genai-rendering) is: `listTemplates()` returns the entries it currently offers (already including its own `suffix`, e.g. `"forecast (GenAI)"`) for the "Template" dropdown, and `render(request)` - given the same signalk/resources/label context any SVG template's bindings get - returns a `Bitmap`, exactly as `SvgRenderer.render()` would. Rejecting from `render()` routes the repaint through this plugin's own generic fallback-warning template, the same as a broken hand-authored template failing to render.
28
+
29
+ `esl.SvgRenderer`, `esl.buildLabel`, `esl.findBindingsInText`, and `esl.substituteBindingsInText` are also exported for a `TemplateProvider` extension to reuse - e.g. to resolve its own `{...}`-style placeholders against the request's context, or to rasterize whatever SVG it produces into the `Bitmap` its `render()` must return.
30
+
31
+ ## CLI Commands
32
+
33
+ `esl-cli` can also be extended with new subcommands by a `-r/--require`'d package, which is how [`@rhizomatics/signalk-einklabel-genai-plugin`](templates.md#genai-rendering) adds its own `prompt`/`generate` commands for testing prompts without a device. See [Command Line Interface](cli.md) for the built-in commands.
package/docs/faq.md ADDED
@@ -0,0 +1,40 @@
1
+ # Frequently Asked Questions
2
+
3
+ ## I can't see my device as a choice on the drop-down list after scan
4
+
5
+ SignalK plugins lack the ability to self-update after something like a scan, so first time round you may have to close the config and reload it to see this. Subsequently the plugin will remember all scanned devices, and only drop previously seen ones if it goes 24 hours without a positive scan or with failed paint attempts.
6
+
7
+ Easiest way to solve this is to choose 'All Discovered Devices' in the device configuration, and it will paint any compatible devices it finds on future scans.
8
+
9
+ ## Sometimes values are missing on the display
10
+
11
+ If the plugin repaints a display at server startup, then the plugin that provides the data may not have started ( or in the case of `derived-data` the plugin that the plugin depends on! ) and unlike Home Assistant, there's no good way of sequencing the start of plugins.
12
+
13
+ Use the _settle_ time, to impose a minimum wait between the eInk Label plugin being initialized, and it attempting to paint any displays, and increase this value if it's still missing data.
14
+
15
+ ## Times are showing incorrectly
16
+
17
+ If times are in the wrong timezone, or don't have daylight savings applied correctly,
18
+ then check that the server itself (at the Linux level, not SignalK, which doesn't know) is configured for your timezone, assuming of course that you're a coastal sailor. Use `raspi-config` on a Raspberry Pi, or `timedatectl` on a Linux server.
19
+
20
+ If you're a global cruiser, then use something like [signalk-set-gps-timezone](https://github.com/hoeken/signalk-set-gps-timezone) to set the value in the operating system.
21
+
22
+ ## The ESL signal is too weak from my SignalK server
23
+
24
+ See [Weak Signal](bluetooth.md#weak-signal).
25
+
26
+ ## Can't edit the text contents of SVG template in VSCode
27
+
28
+ If you have an SVG viewer extension, this will show the image rather than allowing editing of text. To solve, right click on the file in VSCode _Explorer_ view and choose to edit with _Text Editor_.
29
+
30
+ ## Description is set in InkScape but doesn't render
31
+
32
+ Check if the text boxes are normal text or flowed text, and correct to normal text.
33
+
34
+ ## My label just shows "CONTENT UNAVAILABLE"
35
+
36
+ That's the bundled fallback warning, not necessarily an error in this plugin - it means the most recent repaint failed, whatever produced the content (a broken hand-authored template, or a `TemplateProvider` extension like [`@rhizomatics/signalk-einklabel-genai-plugin`](templates.md#genai-rendering) - e.g. its LLM call failing on no network/API access, an invalid API key, or a response that wasn't a renderable SVG, after using up its configured retries). Check the SignalK server logs (debug logging on for this plugin) for the specific error, and if it's a GenAI device, check that plugin's own provider/API key/model settings. This plugin deliberately never leaves old content on screen when a repaint fails - it retries automatically at the next scheduled interval.
37
+
38
+ ## Bluetooth problems
39
+
40
+ Choosing an adapter, adapters that stop responding, and Bluetooth starting after SignalK are covered on the [Bluetooth](bluetooth.md) page.
@@ -0,0 +1,111 @@
1
+ # Getting Started
2
+
3
+ ## Pre-requisites
4
+
5
+ Unlike some eInk projects, this plugin doesn't require any physical modification to the labels, or loading any new firmware. It can send an image to a supported shelf label fresh out of the box.
6
+
7
+ Most of requirements below are to make SignalK work with Bluetooth Low Energy, which is good thing to have anyway, since vendors like Victron, Switchbot, Ruuvi and others have BLE enabled hardware that's useful to have on a boat.
8
+
9
+ This plugin can reach BLE hardware two ways - pick whichever fits your setup:
10
+
11
+ - **Direct BlueZ access** (default) - the plugin talks to BlueZ over D-Bus itself. Requirements 1-3 below apply.
12
+ - **SignalK BLE Manager API** (opt-in) - SignalK server >= 2.32.0 ships a [BLE Provider/Consumer API](https://github.com/SignalK/signalk-server/issues/2411) (admin UI: "BLE Manager") that arbitrates adapter access across every BLE-consuming plugin instead of each one grabbing `hci0` for itself, and can source BLE over a remote gateway instead of local hardware at all. Enable the "Use the SignalK BLE Manager API" setting in this plugin's config once it's available (it only appears once the running server has it) - requirements 1-3 below then become the SignalK server's problem, under its own Bluetooth admin settings, not this plugin's.
13
+
14
+ 1. A SignalK server, **running Linux** (direct BlueZ mode only - BLE Manager mode with a remote gateway provider has no such requirement)
15
+
16
+ - MacOS and Windows aren't supported by the [BLE interface layer](https://www.npmjs.com/package/@naugehyde/node-ble) in direct BlueZ mode, however they can be used for template development and
17
+ debugging (everything except `scan` and `paint`)
18
+
19
+ 2. A Bluetooth adapter, that can handle BLE (Bluetooth Low Energy) - direct BlueZ mode only; in BLE Manager mode this is whatever the server's own Bluetooth settings provide.
20
+
21
+ - Bluetooth adapters for Linux can be tricky - see [Choosing a Bluetooth Adapter](bluetooth.md#choosing-a-bluetooth-adapter) for advice
22
+
23
+ 3. `bluez` package installed in Linux - direct BlueZ mode only
24
+
25
+ - No need to do this if you have a Raspberry Pi with recent Raspian version, since bluez comes built in.
26
+ - If you're not running a Raspberry Pi, then ensure that the `dbus` package is installed
27
+
28
+ 4. One or more supported Electronic Shelf Labels
29
+
30
+ - The labels used for testing this are the [Zhsunyco 3.7" BWRY](https://www.aliexpress.com/item/1005010050104435.html) and a [Gicisky 2.9" BWRY](https://www.aliexpress.com/item/1005012933325056.html) - see [Supported Labels](#supported-labels)
31
+
32
+ 5. Correct time zone set on server if local time is to be shown on display
33
+
34
+ - See [Times are showing incorrectly](faq.md#times-are-showing-incorrectly)
35
+ - If not set, everything will work, but you may see the wrong zone or not have daylight savings applied
36
+
37
+ Once you have all of that, it may be worth also installing [signalk-victron-ble](https://github.com/stefanor/signalk-victron-ble), [signalk-ruuvitag-plugin](https://github.com/vokkim/signalk-ruuvitag-plugin) or [bt-sensors-plugin](https://github.com/naugehyde/bt-sensors-plugin-sk) to pull in data from other sensors and equipment.
38
+
39
+ ## Installation
40
+
41
+ Look for **eInk Label Displays** in the **SignalK AppStore** on your
42
+ server ( under _Apps & Plugins_ on the latest version).
43
+
44
+ ### Using Outside of SignalK
45
+
46
+ The plugin can also be installed as a stand-alone module, which can be useful for designing templates away from the boat, and makes available the `esl-cli` command line tool for scanning devices and debugging templates - see [Command Line Interface](cli.md).
47
+
48
+ ```bash
49
+ npm install @rhizomatics/signalk-einklabel-plugin
50
+ ```
51
+
52
+ ## Configuration
53
+
54
+ Use the standard configuration option in the SignalK menu for the plugin.
55
+
56
+ ![Plugin Configuration](assets/screenshots/plugin_config.png)
57
+
58
+ ## Setting up a Label
59
+
60
+ Enable the plugin, and use the large **+** sign to add a label, which opens up these fields.
61
+
62
+ ![Label Config](assets/screenshots/label_config.png)
63
+
64
+ - _Friendly Name_ - Give the label any name (word or phrase) you like, for example 'Tide Clock'
65
+ - _Device_ - Unless you have multiple labels, don't bother with pre-scanning or selecting a specific device, instead pick **"All discovered devices"** and it will paint any compatible labels it finds. If you want to pick a specific device, you'll need to wait for a device scan to complete.
66
+ - _Template_ - Choose a built-in template (see [Examples](examples/README.md)), one you've added to the local templates directory, or - if a companion plugin like [`@rhizomatics/signalk-einklabel-genai-plugin`](templates.md#genai-rendering) is installed - one of its own contributed entries (shown with a suffix, e.g. "forecast (GenAI)")
67
+ - _Location/description_ - Optional free-text notes on where this label is physically mounted/viewed from, e.g. "chart table, viewed from ~1m in poor light" - available to any template as `source=label,path=description` (see [Label Details](templates.md#label-details))
68
+ - _Repaint Trigger_- Do you want this to repaint every few hours (at a chosen minutes past hour), or when a SignalK path changes?
69
+ - If it's a SignalK path, enter it next, for example `environment.tide.state`
70
+ - If it's time based, enter how many hours between repaints, for example 00:00/08:00/16:00 for an 8h schedule, and if you want a specific number of minutes after the hour.
71
+
72
+ The rest are grouped under _Advanced settings_, and can usually be ignored.
73
+
74
+ - _If the render doesn't match the panel size_ - see [Reframing](templates.md#reframing)
75
+ - _Compress upload_, _Mirror_ and _Wire format_ - see [Other Image Options](templates.md#other-image-options)
76
+ - _Force Repaint_ - Next time the label is due to be painted, update even if the data or template hasn't changed (this flag will automatically be cleared after this.)
77
+ - _BLE AES key_ - Only needed if the default key doesn't work and you have a better alternative, otherwise ignore
78
+ - _Paint connect timeout_ and _Paint retries_ for this device - leave blank to use the plugin-wide settings, or set them for a label that's slower to respond or further away than the others
79
+
80
+ Configs saved by earlier versions are moved into this layout automatically when the plugin starts.
81
+
82
+ When the plugin starts, it will automatically re-paint the label if it's new, or the last timed slot was missed and the data has changed.
83
+
84
+ ### Scanning for Devices
85
+
86
+ Since these are ultra-low power devices, they don't respond instantly to either identify themselves or accept a new image. By default, both scanning and painting have time-outs to wait for a response, which can be altered in the plugin configuration or CLI argument.
87
+
88
+ One other quirk is that some devices respond with a different name at different times, for example the generic `WOESL` sometimes and model specific `WL17500C74` other times. However, the MAC address, e.g. `66:66:17:50:0D:2B` is constant, and this is what's tracked by the plugin.
89
+
90
+ The plugin can optionally re-scan whenever it starts up (off by default), although this isn't essential once a label has been configured. Devices found by any scan are remembered across restarts - see [Troubleshooting](faq.md#i-cant-see-my-device-as-a-choice-on-the-drop-down-list-after-scan).
91
+
92
+ ## Supported Labels
93
+
94
+ ### Zhsunyco
95
+
96
+ Also known as 'Suny' and 'WOLink'.
97
+
98
+ - [BLE ESLs](https://www.zhsunyco.com/digital-display-solution-for-small-retail-business/ble-esl-solution/)
99
+ - The range of labels available on retail sites like AliExpress may be larger than on their corporate site
100
+ - In mid 2026, a 4 colour (BWRY) 3.7" label retailed for about $35, with quantity discounts for bulk sets
101
+ - Cheapest units are 2 colour 1.54", and they go up to 7.5"
102
+
103
+ Python code for a variety of their labels at https://github.com/roxburghm/zhsunyco-esl and https://github.com/NickWaterton/Wolink
104
+
105
+ ### Gicisky
106
+
107
+ Known by other names, e.g. 'Picksmart', and with white label brands
108
+
109
+ - BLE ESLs
110
+ - Official store is on [AliExpress](https://www.aliexpress.com/store/911771479/pages/all-items.html?productGroupId=40000001654819&spm=a2g0o.store_pc_home.pcShopHead_6000727597996.1_1)
111
+ - Cheapest labels under £10 GBP / $13 USD
@@ -0,0 +1,142 @@
1
+ # Templates
2
+
3
+ Templates are simply SVG files, to which expressions can be added to use SignalK data, with options to make it easier to read, like rounding or simplifying dates and times. The template can have sample data in the placeholder, so is easy to layout and visualize.
4
+
5
+ The bundled templates, with the sizes and data each one uses, are listed under [Examples](examples/README.md).
6
+
7
+ ## Template Families (multiple panel sizes/colours)
8
+
9
+ A "Template" selection can either be one specific `.svg` file, or a _directory_ holding several versions of the same template for different panel sizes/colour-sets, e.g. `templates/tides/416x240-BWRY.svg` and `templates/tides/250x128-BWRY.svg` both implement the tide clock, just at different sizes.
10
+
11
+ Each template is named `<width>x<height>-<colours>.svg`, where `<colours>` is one letter per supported colour: `B`(lack)/`W`(hite)/`R`(ed)/`Y`(ellow) - e.g. `BWRY` for a 4-colour panel, `BWR` for a 3-colour one.
12
+
13
+ Selecting the directory (e.g. `tides`) instead of one file lets one `DeviceConfig` entry - especially a `device: "All discovered devices"` entry covering several different physical panels - automatically pick the best-fitting file for each device's actual size/colours, trying in order:
14
+
15
+ 1. An exact width/height/colour-set match.
16
+ 2. Failing that, width/height alone (any colour-set).
17
+ 3. Failing that too, the nearest width, tie-broken by whichever file's own height/width ratio is closest to the device's.
18
+
19
+ ## Reframing
20
+
21
+ There's some wiggle room with the `reframe` options to use a template that's a bit too small, or too large, for the label, although best results come from a template that's precisely matching the pixel height and width of the label. Next best is template that has the same aspect ratio, so it can be cleanly scaled. `crop` is the 2nd least worst, though if its only a handful of pixels its often not worth worring about a separate template and `crop` is just fine. `scale` is likely to look worst, since it will force an image in regardless of aspect ratio.
22
+
23
+ ## Other Image Options
24
+
25
+ Each label has a few more settings for how the image is sent, under _Advanced settings_. The CLI `paint` command has matching options (see [Command Line Interface](cli.md)), so you can try them on a label before changing the plugin config.
26
+
27
+ - _Compress upload_ - on by default. Sends much less data over Bluetooth, so painting is quicker, uses less of the label's battery and is less likely to time out. Works for Zhsunyco labels and Gicisky 7.5"/10.2" labels, and is ignored for others. Turn it off if a label stops updating.
28
+ - _Wire format (Gicisky, experimental)_ - `auto` by default. `chunked` sends a Gicisky 4.2" BWR label compressed, the same way as the 7.5"/10.2". The vendor's own app has been seen doing this, but it hasn't been tested on current firmware. Set it back to `auto` if the label stops updating.
29
+ - _Mirror_ - `none` by default. `horizontal` or `vertical` fixes a label model whose image comes out mirrored. `both` rotates the image 180°, for a label that has to be mounted upside down.
30
+
31
+ ## Template Source Specification
32
+
33
+ In the `description` of the SVG text box, use a comma separated set of key value pairs to define the data source and formatting.
34
+
35
+ ### SignalK Paths
36
+
37
+ For example, `path=environment.forecast.description` uses the default data source (the `self` vessel context) and the named SignalK path. A bare path with no key/value pairs at all, e.g. just `environment.forecast.description`, is shorthand for the same thing. Overriding the default context can be done with `path=environment.forecast.description,context=vessels.urn:mrn:imo:mmsi:232345678` - the `context` value must match a real SignalK context exactly as it appears in the Data Browser.
38
+
39
+ ### SignalK REST APIs
40
+
41
+ The source can be overridden to use the SignalK server's Resources API instead. Change `source` to `resources` and specify which resource with `resource`. If there are multiple providers for the same resource, and they're not equally useful, then either set a default provider in SignalK, or use the `provider` tag to set the name.
42
+
43
+ For example, `source=resources,resource=tides,provider=tides,path=station.name` picks the `tides` resource and pulls the `station.name` path out of the JSON response - this works for any resource type (`tides`, `waypoints`, `routes`, ...), and needs nothing configured: the plugin reaches the Resources API directly. Where a resource is specified, it will be fetched once for that render, and subsequent fields sourced from the same resource use that cached response. `provider` is optional, the default provider will be used if not specified.
44
+
45
+ ### Plugin Derived Data
46
+
47
+ `source=einklabel` reads data injected by the plugin itself, rather than from SignalK. Available paths:
48
+
49
+ - `path=repainted` - the timestamp of the current repaint - for example `source=einklabel,path=repainted,format=local_datetime_short` to show when the label was last updated.
50
+ - `path=local_zone` - a short zone name (e.g. `BST`) for the same timezone used for `local_time`/`day_mon`/`local_datetime_short` (see above) - a fallback for `environment.time.timezoneRegion,format=utc_offset` on installs that never publish that path, since it needs no SignalK metadata of its own. Falls back to a plain UTC offset like `GMT+1` where the host's locale has no real abbreviation for the zone.
51
+ - `path=plugin_version` - expose the version of the eInk Label plugin itself.
52
+
53
+ ### Label Details
54
+
55
+ `source=label` reads facts about the label being painted, so one template can adapt to different labels. Available paths:
56
+
57
+ - `path=description` - the label's _Location/description_ setting, e.g. `source=label,path=description`
58
+ - `path=manufacturer` - the label's maker, e.g. `Zhsunyco`
59
+ - `path=label` - the model's panel size, e.g. `3.7"`
60
+ - `path=width` and `path=height` - the panel size in pixels
61
+ - `path=colours` - the colours the panel can show, e.g. `black (#000000)`; add `format=csv` for a plain comma-separated list
62
+ - `path=fonts` - the font families that are always available: `serif`, `sans-serif` and `monospace`
63
+ - `path=position` - the vessel's position, rounded to about 1km
64
+
65
+ These also work in the fallback warning shown when a template fails to render. Changing a label's description repaints it.
66
+
67
+ ### Customizing Output
68
+
69
+ A `format` can be specified to make the value easier to understand. The supported formats are:
70
+
71
+ - `local_time` - reduce a time stamp to just the time (H:M:S), omitting the date, and applying daylight savings if appropriate
72
+ - `day_mon` - reduce a time stamp to day and month, e.g. `27 Jun`, applying daylight savings if appropriate
73
+ - `local_datetime_short` - format a time stamp as day, abbreviated month, 2-digit year and 24h time, e.g. `21 Jun 26 18:05`, applying daylight savings if appropriate
74
+ - `utc_offset` - Show a timezone in `UTC+01:00` style format
75
+ - `position` - Format a `{ latitude, longitude }` value as decimal degrees with hemisphere letters, e.g. `56.6250°N 6.0700°W`
76
+ - `raw` - Don't apply automatic SignalK unit conversion and symbol display (see below)
77
+
78
+ SignalK's unit preferences are used to automatically convert a `signalk`-sourced numeric value to its preferred display unit, and append a unit symbol like `kt` or `m`, unless `format=raw` is specified to switch that off. However, when using plugin or API data there may be no path metadata to convert from (for example `signalk-tides` publishes tide data to the Resources API, and `level` is a raw metre value with no SignalK path of its own) - in these cases an explicit `category` can be given instead, and the unit preferences will be applied the same way, for example `category=depth` for the tides level figure.
79
+
80
+ Note that for dates and times, the server timezone must be set correctly, for example `Europe/London` rather than the default `Etc/UTC` - see [Times are showing incorrectly](faq.md#times-are-showing-incorrectly).
81
+
82
+ #### Common categories
83
+
84
+ - `depth` - Use the SignalK preferred depth unit, make the conversion if needed, and tack on the unit name as a suffix
85
+ - `speed` - Use the SignalK preferred speed unit, make the conversion if needed, and tack on the unit name as a suffix
86
+ - `temperature` - Use the SignalK preferred temperature unit, make the conversion if needed, and tack on the unit name as a suffix
87
+
88
+ Additionally, `round=n` can be used to round to limited decimal places.
89
+
90
+ `default=<value>` substitutes `<value>` whenever the resolved value is missing (e.g. an unpublished path), instead of falling through to an empty string - useful anywhere a blank would be misread as a real answer. `default=` with nothing after the `=` still counts as set, deliberately defaulting to an empty string rather than leaving the fallback behaviour unchanged.
91
+
92
+ These can all be combined as in `source=resources,resource=tides,provider=tides,path=extremes[2].level,category=depth,round=2`
93
+
94
+ ## Non-Textual Fields (Images)
95
+
96
+ The same `<desc>` mechanism works on an `<image>` element instead of a `<text>` element, for a value that's better shown as a picture than as text - a moon phase icon, a wind direction arrow, a weather condition glyph, and so on. Rather than substituting text, the resolved value picks one of a directory of `.svg` files to embed, by an extra required `assets=` key naming that directory - an `.assets/<name>` sub-directory looked up in your configured `templates` directory first, and the bundled `templates` directory otherwise. For example, the tide clock's moon phase icon uses:
97
+
98
+ ```
99
+ path=environment.moon.phaseName,assets=lunar_phases
100
+ ```
101
+
102
+ which resolves against `templates/.assets/lunar_phases/` (bundled, or your own configured `templates` directory's `.assets/lunar_phases/` if you have one). The resolved value (e.g. `"Waning Gibbous"`, as published by the [derived-data](https://www.npmjs.com/package/signalk-derived-data) plugin) is normalized to match a filename - lower-cased, punctuation and spaces collapsed to underscores - so `"Waning Gibbous"` picks `waning_gibbous.svg` out of that directory. If the underlying path has no value at all (e.g. the `derived-data` plugin isn't installed), or the value doesn't normalize to any file in the directory, the `<image>` element is omitted from that render - no broken image, no placeholder, nothing shown - and a line is logged to the console so a missing/unmatched value isn't silently invisible.
103
+
104
+ If you don't like the bundled moon phase icons, save your own `<value>.svg` files in the `.assets/lunar_phases` sub-directory of your configured `templates` directory - the whole directory is used in place of the bundled one, so add all 8 phases you want to keep, not just the ones you're changing. These moon phases can be re-used in any other label.
105
+
106
+ This is a general mechanism, not specific to moon phases - any `source`/`context`/`path`/`format` combination valid for a `<text>` binding works here too (a `source=resources` value, an explicit `category=`, etc.), the only difference is the required `assets=` directory and the "no match -> no image" behaviour instead of substituted text. To add your own, put a directory of `<value>.svg` files under an `.assets/<name>` sub-directory of your `templates` directory, add an `<image>` element in your SVG editor at the size/position you want, and give it a `<desc>` the same way you would a text field - overriding just the template, just its assets, or both together, all work independently.
107
+
108
+ ## Fonts
109
+
110
+ Three font types are loaded by default, use the generic font family, or exact font name, in the SVG editor and choose size and weight (bold, semi-bold etc). Some labels will make a decent attempt to gray scale. Use the simple pure red, yellow, white, black to match the label's limited colour choice (some labels only offer black and white, or black/white/red). If a font can't be matched it will default to (sans-serif) Roboto.
111
+
112
+ - `serif` - `Roboto Serif`
113
+ - `sans-serif` - `Roboto`
114
+ - `monospace` - `Roboto Mono`
115
+
116
+ ## Designing Templates
117
+
118
+ Templates can be added to the configurable directory. [Inkscape](https://inkscape.org) free, open source, and recommended for editing templates, or your own favourite editor, or by hand in a text editor for hard core (or just tidying up the template side).
119
+
120
+ ![Example Field Definition](assets/screenshots/inkscape_desc.png)
121
+
122
+ The object ID and label aren't used by the plugin, only the description is used to define fields. You can also add in ordinary text fields without field definitions, as labels, logos, help text etc.
123
+
124
+ Placeholder text isn't necessary, and is ignored by the plugin, but makes it much easier to visualize the result.
125
+
126
+ Inkscape adds its own metadata to images, which can be stripped off by exporting a simple SVG, although can be left in place with no harm; main reason to simplify the SVG is manual changes in a text editor.
127
+
128
+ Due to a limitation in the `resvg-wasm` library used to turn SVGs into images, the `font-family` is limited to `serif`,`sans-serif`,`monospace` or the exact name of one of the installed fonts - `Roboto` (sans serif), `Roboto Serif` or `Roboto Mono`.
129
+
130
+ Inkscape has its own fonts, which won't match what's available in the SignalK plugin, so for more precise design, install [Roboto from Google](https://fonts.google.com/specimen/Roboto) via the web page, `brew` on MacOS or similar.
131
+
132
+ To try a template out without a label, or even without a SignalK server, use the CLI's `render` and `fields` commands - see [Debugging Templates](cli.md#debugging-templates).
133
+
134
+ ## GenAI Rendering
135
+
136
+ As an alternative to hand-designed SVG templates, a device's content can be generated by an LLM instead - this is provided entirely by a separate companion plugin, [`@rhizomatics/signalk-einklabel-genai-plugin`](https://github.com/rhizomatics/signalk-einklabel-genai-plugin), not by this core plugin. The base plugin (BLE painting, SVG templates) has nothing to do with any LLM SDK or API key, so installing it never pulls in GenAI dependencies unless you also explicitly install and enable the companion plugin - the split is deliberate, for anyone on a small/constrained install or who'd simply rather not have any GenAI code in their install at all.
137
+
138
+ Once the companion plugin is installed and enabled, its own config screen handles provider/model/API-key selection (OpenAI, Anthropic, Google, xAI, DeepSeek, Moonshot AI, Ollama, or any other OpenAI-compatible endpoint), and its prompts show up as ordinary entries in this plugin's "Template" dropdown, suffixed (e.g. "forecast (GenAI)") - pick one exactly like you'd pick a `.svg` file. Under the hood it's a `TemplateProvider` (see [Template Providers](extending.md#template-providers)) - the same extension mechanism a new vendor's hardware driver uses - so from this plugin's point of view it's just another way `templateName` gets resolved to an image.
139
+
140
+ If the LLM call fails (network/API error, exhausted retries) or its response isn't renderable, this core plugin pushes its own bundled warning template instead of leaving the previous, possibly now-wrong, content on screen - so a stale weather prompt never quietly shows yesterday's forecast through today's storm. This is a generic safety net, not GenAI-specific: the exact same fallback covers a broken hand-authored template failing to render at all. The next scheduled repaint retries automatically. Since each repaint may call a (usually paid) LLM API, a GenAI-backed device should use Repaint Trigger `interval`, not `subscription`.
141
+
142
+ See the companion plugin's own README for installing it, writing prompts, and its `esl-cli prompt`/`generate` commands for testing prompts without a device.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhizomatics/signalk-einklabel-plugin",
3
- "version": "1.3.0-beta12",
3
+ "version": "1.3.0-beta13",
4
4
  "description": "Display SignalK data on eInk Electronic Shelf Labels, includes working examples for tide clock and watch schedule.",
5
5
  "keywords": [
6
6
  "ble",
@@ -49,6 +49,8 @@
49
49
  "build": "tsc",
50
50
  "watch": "tsc --watch",
51
51
  "cli": "ts-node src/cli/index.ts",
52
+ "docs:dev": "npm --prefix site run dev",
53
+ "docs:templates": "ts-node src/docs/templateReference.ts && oxfmt docs/examples",
52
54
  "test": "node scripts/run-tests.js",
53
55
  "coverage": "node scripts/run-tests.js --coverage",
54
56
  "prepublishOnly": "npm run build",
@@ -95,7 +97,8 @@
95
97
  "recommends": [
96
98
  "@rhizomatics/signalk-einklabel-genai-plugin",
97
99
  "signalk-watch-schedule",
98
- "signalk-tides"
100
+ "signalk-tides",
101
+ "signalk-derived-data"
99
102
  ]
100
103
  }
101
104
  }