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
I would not rely on that plugin at all
That was before I added real support for meta data
It needs a major update.
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"
]
}
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
@Teppo Kurki you mean
@signalk/zones
and not Edit Zones, right?they are the same thing https://github.com/SignalK/signalk-zones/blob/master/index.js#L8
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
i made the mistake of not using the npm module name as the plugin name really early on...
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.
Read the plugin dev docs first
Here is good for me
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.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 testingill see if i can tweak it
Is it worth converting to typescript while I’m at it?
Go ahead, there is so little code that is not much work. I really prefer ts
@Teppo Kurki should this plugin use
"signalk-plugin-enabled-by-default": true
?yes please
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.
Cool! reviewed. Kip UI can include a link to the plugin configuration to help the user along.
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
You are right. Let’s stick to what is there. Will check the pr asap