SignalK / signalk-server

An implementation of a Signal K central server for boats.
http://signalk.org
Apache License 2.0
307 stars 152 forks source link

Zones get lost #1749

Closed VladimirKalachikhin closed 3 months ago

VladimirKalachikhin commented 3 months ago

2.8.2 The zones get lost on server restart if I set zones from my app, Zones are preserved if it's set via Data Browser -> Meta Data interface.

sbender9 commented 3 months ago

How are you setting with your app?

VladimirKalachikhin commented 3 months ago

I didn't understand your question.

sbender9 commented 3 months ago

You said "if I set zones from my app", what do you mean?

VladimirKalachikhin commented 3 months ago

Something like this:

app.handleMessage(plugin.id, {
    context: "vessels.self",
    updates: [
        {
            source: { label: "e-inkDashboard" },
            timestamp: "2024-06-07T20:54:36.342Z",
            meta: [
                {
                    path: "navigation.courseOverGroundTrue",
                    value: {
                        alarmMethod: [ "sound", "visual" ],
                        zones : [
                          {
                            lower: 0,
                            upper: 5.3930673886624785,
                            state: "alarm",
                            message: "c0257677-6141-4606-9ee5-df7462968df2"
                          },
                          {
                            lower: 5.742133239061344,
                            upper: 6.283185307179586,
                            state: "alarm",
                            message: "c0257677-6141-4606-9ee5-df7462968df2"
                          },
                          {
                            lower: 5.3930673886624785,
                            upper: 5.742133239061344,
                            state: "normal",
                            message: "c0257677-6141-4606-9ee5-df7462968df2"
                          }
                        ]
                    }
                }
            ]
        }
    ]
});
sbender9 commented 3 months ago

You need to use a PUT request.

You are using a delta, that would never get persisted.

sbender9 commented 3 months ago

Oh. You are in a plugin? We don't have an easy way to send a put from a plugin.

You can describe more about what you are doing. I'm struggling to see why you would do this from a plugin.

VladimirKalachikhin commented 3 months ago

Do you care? The Data Model shows no difference between the zones set by me and those set via Data Browser -> Meta Data interface.

sbender9 commented 3 months ago

The difference is that meta data sent via deltas are not persisted.

You must use PUT requests, which is what the Data Browser uses.

VladimirKalachikhin commented 3 months ago

Seriously?

sbender9 commented 3 months ago

Yes

sbender9 commented 3 months ago

If you would like help with this. You might want to start treating people with respect.