David Godin - Zone Meta QuestionHow can I get ...

Zone Meta Question How can I get zones definitions, either as part of path meta or some other way? I want to get zone definitions to apply to gauges and using Edit Zones to create them.
18 Replies
Scott Bender
Scott Bender9mo ago
I would not rely on that plugin at all That was before I added real support for meta data It needs a major update.
David Godin
David GodinOP9mo ago
What’s the best approach to define and obtain meta. Mostly interested in zones for now Besides baseDelta manual edits that is. Maybe Edit Zones plugin could save to baseDelta, and as a bonus expose R/W to put or new api. I've used baseDelta.json for now. I get all the meta. Looks fine but the server does not appear the send notifications base on zones. Or I'm doing something wrong! this is what data browser shows: { "units": "m/s", "description": "Meta Apparent Wind Speed", "zones": [ { "state": "normal", "lower": 0, "upper": 5, "message": "Apparent Wind Speed in Normal" }, { "state": "nominal", "lower": 4, "upper": 5, "message": "Apparent Wind Speed in Alert" }, { "state": "alert", "lower": 5, "upper": 8, "message": "Apparent Wind Speed in Alert" }, { "state": "warn", "lower": 8, "upper": 12, "message": "Apparent Wind Speed in Warn" }, { "state": "alarm", "lower": 12, "upper": 15, "message": "Apparent Wind Speed in Alarm" }, { "state": "emergency", "lower": 15, "upper": 50, "message": "Apparent Wind Speed in Emergency" } ], "displayName": "Meta Display Name", "shortName": "Meta AWS", "longName": "Meta provided very, very, very long display name for no reason", "displayScale": { "type": "linear", "lower": 0, "upper": 30 }, "alertMethod": [ "sound", "visual" ], "warnMethod": [ "visual", "sound" ], "alarmMethod": [ "sound", "visual" ], "emergencyMethod": [ "visual", "sound" ] }
Teppo Kurki
Teppo Kurki9mo ago
Only zones plugin does notifications And on its own data The simplest way forward would to have the zones plugin to send meta deltas on startup. So convert plugin config to meta deltas. @David Godin wanna have a shot at that? Probably very little code required
David Godin
David GodinOP9mo ago
@Teppo Kurki you mean @signalk/zones and not Edit Zones, right?
Teppo Kurki
Teppo Kurki9mo ago
GitHub
signalk-zones/index.js at master · SignalK/signalk-zones
Signal K Node server plugin to handle zones: value ranges per Signal K key - SignalK/signalk-zones
Teppo Kurki
Teppo Kurki9mo ago
i made the mistake of not using the npm module name as the plugin name really early on...
David Godin
David GodinOP9mo ago
I’ll have some very basic questions for sure. Want a private chat or we continue here? I don’t see the UI part I’ll give it a try.
Teppo Kurki
Teppo Kurki9mo ago
Read the plugin dev docs first Here is good for me
David Godin
David GodinOP9mo ago
it's working! @Teppo Kurki looking at the specs, do you mind if I replace ‘normal’ state with ‘nominal’. Add some minimal debug and collapsing to the UI (if I can figure out how) Not too sure from the specs if normal and nominal should be defined or if only nominal is required. No normal state would make sens... see: Any part of the range which is not explicitly within a zone is considered to be normal (the default). As such, zones with a state of normal have no effect and their removal would result in no changes to either displays or alerts.
Teppo Kurki
Teppo Kurki9mo ago
The plugin sends updates only when the value is in a defined zone. With no normal zone defined exiting a non-normal zone will not trigger an update and the last non-normal notification will remain. With the current code, that is. This is from reading the code, not testing
David Godin
David GodinOP9mo ago
ill see if i can tweak it Is it worth converting to typescript while I’m at it?
Teppo Kurki
Teppo Kurki9mo ago
Go ahead, there is so little code that is not much work. I really prefer ts
David Godin
David GodinOP9mo ago
@Teppo Kurki should this plugin use "signalk-plugin-enabled-by-default": true?
Teppo Kurki
Teppo Kurki9mo ago
yes please
David Godin
David GodinOP9mo ago
Well I quite trying to convert to TS and stick to my original plan... I did my best. See what you think. It would be lovely if it was possible to release this not too far out, if it's clean obviously 😏 Would be appreciated as it's needed for the next KIP release that integrates with Zones. I'm removing KIP local notifications and Zones in favor of SK defined user will miss the integrated KIP Zone UI but hey.... it's what it is.
Teppo Kurki
Teppo Kurki9mo ago
Cool! reviewed. Kip UI can include a link to the plugin configuration to help the user along.
David Godin
David GodinOP9mo ago
Good point. I’ll recreate a screen that only shows server sent zones config with some explaining and a link. I also noticed you had a PR about exposing zones manipulations. That would be awesome! Too big a roadmap in KIP to rewrite some parts: better SK echo system integrate, less code, perf improvements, etc. Once one done with notifications and zones I’ll move to SK Objects value and targeted path subscriptions so I’ll need you guidance. @Teppo Kurki Have a look at my comment. If I got it right, we need to change the current plugin schema and move xxMethod out of zone.zones onto zone
Teppo Kurki
Teppo Kurki9mo ago
You are right. Let’s stick to what is there. Will check the pr asap

Did you find this page helpful?