irjudson - Q: What plugin (or not?) provides we...
Q: What plugin (or not?) provides weather under /meteo endpoint for freeboard?
45 Replies
Freeboard-SK is itself a plugin and provides the endpoints.
This is an experimental feature which has informed the PR for a weather API https://github.com/SignalK/signalk-server/pull/1733
What is your intention?
I will be looking to deprecate the built-in weather plugin in Freeboard-SK in favour of the weather API
my intention π - is to see weather on the dashboard - right now it's throwing an error, but I can't see why (no shade, probably dumb user error)
Assuming you have configured the plugin settings...
To fetch data there needs to be a vessel position, you can confirm operation by turning on debugging.
Once the data has been fetched it will be available via the endpoints.
You can confirm by viewing it in Freeboard-SK
I have, and in the databrowser the vessel position is navigation.location? or something else?
and apologies, I think you helped me with this before and I didn't remember what you told me
meanwhile, my AIS is working amazing seeing about 70nm which gets me to canada from my very inland eastern puget sound location
navigation.position
I will try to remember that
thanks @AdrianP
I have 4 navigation.position (now that I fixed my wifi)
but they are all the same value π
I think I know what's burping
I think my network burps are breaking outgoing api calls
which are probably kind of important
Having the same problem. kind of...
Plugin claims there is no position, and goes to sleep after three tries as expected...
Sep 27 08:18:53 2024-09-27T06:18:53.405Z @signalk/freeboard-sk Weather: RETRY = 1 after no vessel position detected!
Sep 27 08:18:53 2024-09-27T06:18:53.406Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 27 08:18:57 GET /admin/fonts/fa-solid-900.1551f4f60c37af51121f106501f69b80.woff2 304 6.460 ms - -
Sep 27 08:18:58 2024-09-27T06:18:58.407Z @signalk/freeboard-sk Weather: RETRY = 2 after no vessel position detected!
Sep 27 08:18:58 2024-09-27T06:18:58.407Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 27 08:19:00 GET /skServer/logfiles/ 200 8.699 ms - 793
Sep 27 08:19:00 GET /skServer/debugKeys 200 2.069 ms - -
Sep 27 08:19:03 2024-09-27T06:19:03.408Z @signalk/freeboard-sk Weather: RETRY = 3 after no vessel position detected!
Sep 27 08:19:03 2024-09-27T06:19:03.409Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 27 08:19:03 2024-09-27T06:19:03.410Z @signalk/freeboard-sk *** Weather: Maximum number of retries to detect vessel position!... sleeping.
But my SignalK has a value for navigation.position (or rather two), could it be that the code needs to handle several values and respect the prio set?
I have two instances running on two boxes, both have a fake position from Node-Red since I have no GPS where these boxes are located.
See screenshot.
This also indicates the existance of navigation.position?
On more research the openweather API is not really behaving as expected...
*Which does not take the position thing out of the picture...
*
I signed up for the basic plan that should enable the version 3 onecall API, trying things in the browser that call returns 401...
Call:
https://api.openweathermap.org/data/3.0/onecall?lat=56.05&lon=12.70&exclude=minutely,hourly,daily&appid=a7af8f0742e4b26209cab0b9e2e77548
Response:
{"cod":401, "message": "Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here https://openweathermap.org/price. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see https://openweathermap.org/faq#error401 for more info."}
I guess I have misread the plans and need to hand my credit card to OpenWeather to get the OneCall 3.0 version.
But the intro mail from OpenWeather has a link that indicates a version 2.5 and that one returns data as expected, would 2.5 be an option for Freeboard?
Call:
https://api.openweathermap.org/data/2.5/weather?lat=56.05&lon=12.70&exclude=hourly,daily&units=metric&appid=<API-Key>
Response:
{
"coord": {
"lon": 12.7,
"lat": 56.05
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"base": "stations",
"main": {
"temp": 13.4,
"feels_like": 13.17,
"temp_min": 12.6,
"temp_max": 14.23,
"pressure": 987,
"humidity": 91,
"sea_level": 987,
"grnd_level": 985
},
"visibility": 10000,
"wind": {
"speed": 10.1,
"deg": 224,
"gust": 15.11
},
"rain": {
"1h": 0.37
},
"clouds": {
"all": 99
},
"dt": 1727420628,
"sys": {
"type": 2,
"id": 2008736,
"country": "SE",
"sunrise": 1727413483,
"sunset": 1727456124
},
"timezone": 7200,
"id": 2706767,
"name": "Helsingborg",
"cod": 200
}
Version 2.5 API support was removed due to the depreciation by Open weather.
I am looking to replace open weather with OpenMeteo as it is free.
OK thanks , I understand π
What I do not understand is their communication :), it seems like 2.5 is supported for current weather..
https://openweathermap.org/current
When I look at my account and click details about my subscription they take me to the OneCall page, but it seems I have the free subscription and not the OneCall.
When I click subscribe the demand a credit card.....
Would 2.5 be almost like 2.0?, and if 2.5 is not going away anytime soon, making that available again as 2.5 be an option?
Regardless of the API issues/confusion, why does SignalK/Freeboard claim that there is not position?
As shown above my instance absolutely has a value in selg.navigation.position, but the log still states no position available....
Or is that also due to the 401 error on the API?
Took a look at openmeteo, seems like a brlilliant way forward so do not waste any significant time in the old stuff π
Thanks!!
So if you turn on debug for Freeboard-SK plugin, what position is reported in the log?
No position according to FreeBoard, which is confusing...
Since the server for sure has a position....
Might be a sequencing issue since I get my position for self.navigation.position from Node-Red....
What happens if there is only one source for position?
Can you stop one source?
It looks like node-red is starting after Freeboard-SK.
As a test, disable Freeboard-SK..., start the server so that node-red provides a position, then enable Freeboard-SK
Log:
Only one position
By mistake a had version 2on the api, now changed that but same result.
That shouldn't matter as it won't call the API if no position data is available.
Whatever is being returned when the navigation.position path is queried is not seen as valid position data.
OK, seems strange when the rest of Freeboard is OK with that position, and the boat is displayed correctly on the screen by Freboard.
Any ideas where I have taken a wrong turn?
Also am i correct when I assume that freeboard will use self.navigation.position on initialize to populate an internal freeboard path that is used towards the weather API?
Yes self.navigation.position is correct.
Just for my amusement can you try using the SKSim plugin to simulate the vessel position.
Install from appstore, launch and press Start
Well.... the message in the log indicates that the value from
app.getSelfPath('navigation.position')
is "falsy"... evaluates as no value.
Have you tried restarting the rpi device? There have been instances where the 5 sec wait between the 3 retries does not occur, the time stamps are the give away. Rebooting the device generally fixes it.
One would expect if a position is going to be available it will appear within 15 secsYes the machine has been restarted, even if it is not an RPI π it is a laptop running Ubuntu....
The response from the API when running in browser....h.dronten.dahlarna.se:3443/signalk/v1/api/
relevant part of response below:
},
"navigation": {
"position": {
"meta": {
"description": "The position of the vessel in 2 or 3 dimensions (WGS84 datum)",
"properties": {
"longitude": {
"type": "number",
"description": "Longitude",
"units": "deg",
"example": 4.98765245
},
"latitude": {
"type": "number",
"description": "Latitude",
"units": "deg",
"example": 52.0987654
},
"altitude": {
"type": "number",
"description": "Altitude",
"units": "m"
}
}
},
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"$source": "NR",
"timestamp": "2024-09-30T06:44:21.528Z",
"values": {
"Hemulen.hemulen.dahlarna.se:3000": {
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"timestamp": "2024-09-30T06:44:06.809Z"
},
"NR": {
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"timestamp": "2024-09-30T06:44:21.528Z"
}
}
},
With debug on... you should see the retries for vessel position occur 5 secs apart.... do the timestamps reflect this?
Yes the do!
Sep 30 11:19:08 2024-09-30T09:19:08.998Z @signalk/freeboard-sk Weather: RETRY = 1 after no vessel position detected!
Sep 30 11:19:08 2024-09-30T09:19:08.999Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 30 11:19:14 2024-09-30T09:19:14.000Z @signalk/freeboard-sk Weather: RETRY = 2 after no vessel position detected!
Sep 30 11:19:14 2024-09-30T09:19:14.000Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 30 11:19:19 2024-09-30T09:19:19.000Z @signalk/freeboard-sk Weather: RETRY = 3 after no vessel position detected!
Sep 30 11:19:19 2024-09-30T09:19:19.001Z @signalk/freeboard-sk Weather: No vessel position detected!
Sep 30 11:19:19 2024-09-30T09:19:19.001Z @signalk/freeboard-sk Weather: Maximum number of retries to detect vessel position!... sleeping.
Found it, I think....
Since I have another instance of SIgnalK running on my boat I stopped using the MMSI on my stationary instaces...
If there is no MMSI FreeboardSK will not be able to get the position since it is not stored under the path self but rather under vessel "undefined".
Maybe that is a general "bug" that self is not populated unless an MMSI is set?
Adding an MMSI to the server and Freeboard does get the position and is polling for weather, now the response is still not perfect but that is due to my API key....
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk Weather: settings: {"enable":true,"apiVersion":3,"apiKey":"3defab920f190782db5e0cb642ff9209","pollInterval":60,"service":"openweather"}
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk fetchInterval: 3600000
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk Vessel position: {"longitude":12.743178333333333,"latitude":55.99086333333333}.
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk Weather: Calling service API.....(attempt: 1)
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk Position: {"longitude":12.743178333333333,"latitude":55.99086333333333}
Sep 30 11:31:29 2024-09-30T09:31:29.520Z @signalk/freeboard-sk Weather: polling weather provider.
Sep 30 11:31:29 POST /skServer/plugins/freeboard-sk/config 200 3.850 ms - 45
Sep 30 11:31:29 GET /skServer/plugins 200 6.213 ms - -
Sep 30 11:31:29 2024-09-30T09:31:29.597Z @signalk/freeboard-sk Weather: data received....
Sep 30 11:31:29 2024-09-30T09:31:29.597Z @signalk/freeboard-sk ** METEO - emit deltas**
Sep 30 11:31:29 2024-09-30T09:31:29.597Z @signalk/freeboard-sk METEO *
Sep 30 11:31:29 2024-09-30T09:31:29.598Z @signalk/freeboard-sk METEO OBS *
Sep 30 11:31:31 GET /skServer/plugins 304 15.474 ms - -
Sep 30 11:31:34 GET /skServer/logfiles/ 304 5.273 ms - -
Sep 30 11:31:34 GET /skServer/debugKeys 200 1.497 ms - -
https://h.dronten.dahlarna.se:3443/signalk/v1/api/vessels/self/navigation/position/
With MMSI set.
{
"meta": {
"description": "The position of the vessel in 2 or 3 dimensions (WGS84 datum)",
"properties": {
"longitude": {
"type": "number",
"description": "Longitude",
"units": "deg",
"example": 4.98765245
},
"latitude": {
"type": "number",
"description": "Latitude",
"units": "deg",
"example": 52.0987654
},
"altitude": {
"type": "number",
"description": "Altitude",
"units": "m"
}
}
},
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"$source": "NR",
"timestamp": "2024-09-30T09:33:22.192Z",
"values": {
"NR": {
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"timestamp": "2024-09-30T09:33:22.192Z"
},
"Hemulen.AI": {
"value": {
"longitude": 12.743185,
"latitude": 55.9908633333333
},
"timestamp": "2024-09-30T09:32:03.814Z",
"sentence": "VDM"
}
},
"sentence": "VDM"
}
With no MMSI set it is found here:
https://h.dronten.dahlarna.se:3443/signalk/v1/api/vessels/undefined/navigation/position/
{
"meta": {
"description": "The position of the vessel in 2 or 3 dimensions (WGS84 datum)",
"properties": {
"longitude": {
"type": "number",
"description": "Longitude",
"units": "deg",
"example": 4.98765245
},
"latitude": {
"type": "number",
"description": "Latitude",
"units": "deg",
"example": 52.0987654
},
"altitude": {
"type": "number",
"description": "Altitude",
"units": "m"
}
}
},
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"$source": "Hemulen.hemulen.dahlarna.se:3000",
"timestamp": "2024-09-30T09:40:06.887Z"
}
The position might seem strange but my boats AIS is on and received with a position by my stationary instances AIS receiver --> that might be the boats current position.
This is the reason I removed MMSI from my config since the boat is "jumping" between my house and my mooring π
It's been an effort but it seems the root cause has been found
Let's hope so π
If you agree that self should be populated regardless of MMSI entry, maybe you will raise that ticket?
Or if you agree do you want me todo that?
Also sold my soul to openweather...
We in Sweden are somwhat strange, we like boatspeed in knots but windspeed in m/s, assuming you respect the units preference in Freeboard where there is only one speed unit and hence applied to both boat and wind speed, correct?
Would a windspeed unit be a big task?
If you could raise the issue as you can more accurately describe the scenario where it occurred
This is correct one speed unit.
We will see.
After even more digging my conclusion is slightly different....
FreeboardSK is not able to get the navigation position when setup is missing MMSI, it is still there but not retreived...
So I'm afraid FreeboardSK code needs a bit of digging.
Getting self.navigation position using https://h.dronten.dahlarna.se:3443/signalk/v1/api/vessels/self/navigation/position/
{
"meta": {
"description": "The position of the vessel in 2 or 3 dimensions (WGS84 datum)",
"properties": {
"longitude": {
"type": "number",
"description": "Longitude",
"units": "deg",
"example": 4.98765245
},
"latitude": {
"type": "number",
"description": "Latitude",
"units": "deg",
"example": 52.0987654
},
"altitude": {
"type": "number",
"description": "Altitude",
"units": "m"
}
}
},
"value": {
"altitude": 0,
"latitude": 56.04749,
"longitude": 12.7054
},
"$source": "NR",
"timestamp": "2024-10-01T05:55:29.515Z"
And debug log from the same:
Oct 01 07:55:33 2024-10-01T05:55:33.031Z @signalk/freeboard-sk Weather: RETRY = 1 after no vessel position detected!
Oct 01 07:55:33 2024-10-01T05:55:33.031Z @signalk/freeboard-sk Weather: No vessel position detected!
Oct 01 07:55:34 GET /@signalk/freeboard-sk/assets/img/weather_station.png 304 7.071 ms - -
Oct 01 07:55:38 2024-10-01T05:55:38.032Z @signalk/freeboard-sk Weather: RETRY = 2 after no vessel position detected!
Oct 01 07:55:38 2024-10-01T05:55:38.032Z @signalk/freeboard-sk Weather: No vessel position detected!
Oct 01 07:55:43 2024-10-01T05:55:43.033Z @signalk/freeboard-sk Weather: RETRY = 3 after no vessel position detected!
Oct 01 07:55:43 2024-10-01T05:55:43.033Z @signalk/freeboard-sk Weather: No vessel position detected!
Oct 01 07:55:43 2024-10-01T05:55:43.033Z @signalk/freeboard-sk Weather: Maximum number of retries to detect vessel position!... sleeping.
And when MMSI is configured...
Oct 01 08:01:33 2024-10-01T06:01:33.806Z @signalk/freeboard-sk Weather: RETRY = 1 after no vessel position detected!
Oct 01 08:01:33 2024-10-01T06:01:33.807Z @signalk/freeboard-sk Vessel position: {"altitude":0,"latitude":56.04749,"longitude":12.7054}.
Oct 01 08:01:33 2024-10-01T06:01:33.808Z @signalk/freeboard-sk Weather: Calling service API.....(attempt: 1)
Oct 01 08:01:33 2024-10-01T06:01:33.808Z @signalk/freeboard-sk Position: {"altitude":0,"latitude":56.04749,"longitude":12.7054}
Oct 01 08:01:33 2024-10-01T06:01:33.809Z @signalk/freeboard-sk Weather: polling weather provider.
Oct 01 08:01:33 2024-10-01T06:01:33.982Z @signalk/freeboard-sk Weather: data received....
Oct 01 08:01:33 2024-10-01T06:01:33.982Z @signalk/freeboard-sk METEO - emit deltas*
Oct 01 08:01:33 2024-10-01T06:01:33.983Z @signalk/freeboard-sk METEO *
Oct 01 08:01:33 2024-10-01T06:01:33.983Z @signalk/freeboard-sk METEO OBS *
Oct 01 08:01:33 2024-10-01T06:01:33.983Z @signalk/freeboard-sk SENDING METAS *
Oct 01 08:01:33 2024-10-01T06:01:33.984Z @signalk/freeboard-sk METEO - build metas *
Oct 01 08:01:33 2024-10-01T06:01:33.984Z @signalk/freeboard-sk METEO - building observation metas *
So when you say Freeboard-SK you are referring to the plugin right?
Does the Freeboard-SK app displays the vessel in the correct position?
About the units lowlow prio, I can devide knots by 2 pretty good π
Correct, the app displays the vessel self in the correct position.
Not that it matters, but that SIgnalK instance is available public on https://x.dronten.dahlarna.se:33443/
Right, so the issue is that calling
app.getSelfPath('navigation.position')
is not returning a value when no MMSI is entered.
The app gets the data from the delta streamYep that seems right even if I cannot (do not now how) make that call.
The plugin calls the interface function
OK
Will look at the server source code for clues.
@Teppo Kurki any clues as to why calling
app.getSelfPath('navigation.position')
might not be returning a value when no MMSI is entered?Is this freeboard plugin calling it? Is this reproducable?
From my none code perspective yes,
If trying to activate plugin with a weather config, it cannot get a position if MMSI is blank, when adding MMSI to config it works like a charm.
As described by the debug log snippets above.
Whereβs the plugin code? Canβt find it in freeboard-sk repo
https://github.com/SignalK/freeboard-sk/blob/master/helper%2Fweather%2Fweather-service.ts#L343
This particular issue I have not seen before, the code has been in production for 18 months or more.
Might relevant to know I populate navigation.position with Node-Red.
Something might be different compared to a GPS/AIS or similar "real boat equipment".
My boat is empty and the boat rpi is at home for the winter --> no easy way to check...
But also getting self.navigation position using https://h.dronten.dahlarna.se:3443/signalk/v1/api/vessels/self/navigation/position/
gives a correct result... confusing
Also tried to check with Node-Red, simple subscribe to delta on self.navigation.position, gives correct position (but of course I do not now how Node-Red is accessing the data)
Also at stated before you can access my SignalK using e.g. https://x.dronten.dahlarna.se:33443/signalk/v1/api/vessels/self/navigation/position/
For example to check if I messed something up....