signalk-server
signalk-server copied to clipboard
Meta data written to a path with no current data value is ignored
I have a plugin which initialises paths with meta values. If I write a value to a path which hasn't yet been initialised with a data value then neither the path to the key nor the associated meta value are created.
I think this is a problem since it seems reasonable to want to initialise meta data early, perhaps before real data values have begun to appear.
For example: if I write "electrical.switches.bank.usb0.1.state.meta" before writing "electrical.switches.bank.usb0.1.state.value" then the meta key is not created (nor is the "usb0.1" path component).
Yeah, currently you won't see the meta data in the full tree.
But as soon as some data comes in for the path, the meta should be there?
Ah I see. You say "currently" - does that mean that this behaviour may change in the future?
P
On Wed, 10 Feb 2021, 12:34 Scott Bender, [email protected] wrote:
Yeah, currently you won't see the meta data in the full tree.
But as soon as some data comes in for path, the meta should be there?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SignalK/signalk-server/issues/1264#issuecomment-776646789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2BPMI2QY6ADR4RJQ7H6LDS6JVODANCNFSM4XHPBRZQ .
Yeah , it's possible to make this work. Just not sure that it's needed.
If you need an instance of why here is a very weak one.
I have a driver for Devantech relay modules that connect over USB/UTP. Unlike N2K relay banks these devices only report their status when they receive a state change request.
I have a switch monitor app that builds a nice display deriving its layout from the presence of switch channels in Signal K.
I write meta information for use by the display to the relay switch paths when my server boots and detects the connected relay banks, but the display doesn't actually see this meta data until a relay is operated. It looks clunky. Of course, I can write a dummy initialisation value to the relay switch path and so make the meta data come live. There may be other instances where having meta there before a value appears is useful. I'll think about it.
How are you getting the meta?
It should actually work if you make an http call to directly get the meta.
@tkurki what do you think? This is a pretty simple change to fullsignalk.js
Websocket.
On Wed, 10 Feb 2021, 15:10 Scott Bender, [email protected] wrote:
How are you getting the meta?
It should actually work if you make an http call to directly get the meta.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SignalK/signalk-server/issues/1264#issuecomment-776730664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2BPMKWAUIGE4RPXRKSSFDS6KHVPANCNFSM4XHPBRZQ .
Hmm. Ok. That's a different issue than what I was thinking...