itemir / signalk-notifications

Notifications Manager for Signal K
Apache License 2.0
0 stars 0 forks source link

No notifications are listed #3

Open nadrog opened 11 months ago

nadrog commented 11 months ago

I see the following two notifications in the Data Browse (they were created by @signalk/zones), but I don't see anything in Notification Manager.

notifications.environment.inside.humidity:

{
  "state": "alert",
  "message": "Humidity: humid (50% - 70%)",
  "method": [],
  "timestamp": "2023-12-29T16:31:01.607Z"
}

notifications.environment.inside.pressure:

{
  "state": "normal",
  "message": "Pressure is normal (96kPa - 104kPa)",
  "method": [],
  "timestamp": "2023-12-29T16:31:01.610Z"
}

SignalK: 2.4.1 signalk-notifications: 1.1.1 @signalk/zones: 1.1.0 node: v18.18.2 npm: 9.8.1

nadrog commented 9 months ago

OK, I fixed it on my installation by checking whether position is null and using coordinates 0,0 instead. The error is here: index.js:147.

The following code works but is of course far from elegant:

if ( position === null || position.latitude === null || position.longitude === null ){
  lat = 0;
  lon = 0;
} else {
  lat = position.latitude;
  lon = position.longitude;
}
updateDatabase(ts, lat, lon, path, value.state, value.message);