Skip to content

feat: add conversion formulas to active preset and bulk metadata endpoint #2436

Open
motamman wants to merge 1 commit intoSignalK:masterfrom
motamman:user-preferences-tweaks
Open

feat: add conversion formulas to active preset and bulk metadata endpoint #2436
motamman wants to merge 1 commit intoSignalK:masterfrom
motamman:user-preferences-tweaks

Conversation

@motamman
Copy link
Contributor

Description:

Summary

  • Enhance GET /signalk/v1/unitpreferences/active to include formula, inverseFormula, and symbol
    from unit definitions for each category
  • Add GET /signalk/v1/api/vessels//meta endpoint that returns all metadata for a vessel as a
    flat path-keyed map with displayUnits resolved
  • Inject displayUnits into meta objects throughout the vessel tree for GET
    /signalk/v1/api/vessels/self responses

Motivation

REST clients (like Freeboard-SK) previously had no single endpoint to get all paths with resolved
display unit preferences and conversion formulas. displayUnits was only available per-path or
via WebSocket sendMeta=all. These changes close that gap.

@tkurki tkurki added the feature label Mar 12, 2026
@tkurki tkurki requested a review from panaaj March 12, 2026 17:01
@panaaj
Copy link
Member

panaaj commented Mar 15, 2026

I think the additional details are useful in the active endpoint.

In the use case where I want to display wind speed values in m/s when other speed values are in knots, how is this made available via the api?

It appears that only the preset values are available.

@motamman
Copy link
Contributor Author

motamman commented Mar 15, 2026

I think the additional details are useful in the active endpoint.

In the use case where I want to display wind speed values in m/s when other speed values are in knots, how is this made available via the api?

It appears that only the preset values are available.

You mean an endpoint for all possible base-unit conversions? something like /signalk/v1/unitpreferences/definitions/?SI=K, which returns all possible conversions and formulas?

We already have this /signalk/v1/unitpreferences/definitions (all base units and all conversions)

BTW, there is an option to select the base units as the display units in the metadata editor, overriding the preset setting.

@panaaj
Copy link
Member

panaaj commented Mar 15, 2026

I don't mean the calculation formula, but how does the client know that windspeed is a different target unit to that defined by the speed category by using the API?

@motamman
Copy link
Contributor Author

Forgive me, I am not sure I get why that might be useful.

@panaaj
Copy link
Member

panaaj commented Mar 16, 2026

If windspeed is a sub category of speed, how do I see that config using the REST API.

It's useful for clients that collect data from slow changing sources and then convert & display values on demand, as opposed to the "as received" like data browser or KIP.

@tkurki
Copy link
Member

tkurki commented Mar 16, 2026

Sorry Adrian but I don't quite understand what you're after here, as the core categories don't have wind speed, just speed.

So are we missing support for a use case: "I want wind speeds in m/s but other speeds in knots"? Or more specific one "I want x.y.z in some other unit than anyhing else".

@panaaj
Copy link
Member

panaaj commented Mar 16, 2026

The docs contain the example of having windspeed in different units to the speed category (without specifying how to do this, I assume this is via Meta values in the data browser).
So I was wanting to know how when this configuration is made where does it become visible using the API (assuming I would see it in the active response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants