SignalK / n2k-signalk

NMEA 2000 to Signal K transformer
Apache License 2.0
25 stars 29 forks source link

fix: pgn 130312 userDefined temperature source handling #239

Closed jncarter123 closed 2 years ago

jncarter123 commented 2 years ago

I'm not certain when this changed but the PGN field Source is now an int instead of string. We are trying to replace the sourc with the instance but that now throws an error "TypeError: n2k.fields.Source.replace is not a function".

This fix converts the Source int to string so that it can be replaced.

Example data

{"canId":368904234,"prio":5,"src":42,"dst":255,"pgn":130312,"time":"21:04:58.247","input":["21:04:58.247 R 15FD082A 7B 00 83 30 71 FF FF FF"],"fields":{"SID":123,"Instance":0,"Source":131,"Actual Temperature":289.76},"description":"Temperature","timestamp":"2022-04-08T21:04:58.402Z"}

tkurki commented 2 years ago

8114aec45704bd3fbf152d0a67405cfd3d30dc34 was about removing spaces from user defined source that had them, encountered in the wild (Slack, don't have the details anymore).