SmartBoatInnovations / ha-smart2000usb

Home Assistant Smart Boat 2000 USB Integration
Other
2 stars 2 forks source link

Unrealistic temperatures #2

Open slundell opened 4 months ago

slundell commented 4 months ago

The temperatures read from PGN 130312 are sometimes unrealistic. These temperatures seems to be fixed around -272.3C and +380.8C. I do not know the source of the errors. Maybe they are wrongly reported by the NMEA2000 device. Maybe the issue is in the conversion calculation in this addon? How do I debug this issue?

SmartBoatInnovations commented 4 months ago

Soes rhe rest of your N2K report ok? What is the device? This PGN reports in Kelvin and the integration performs an additional conversion to C. Is the Kelvin temperatures wrong as well?

slundell commented 4 months ago

It seems to me that there are problems parsing the hex output. There is a ":" in there. Maybe the hex string is cut in the wrong place but is parsable.

There are these extreme values in data from other devices as well. I get these errors in the log.

Logger: custom_components.smart2000usb.sensor Källa: custom_components/smart2000usb/sensor.py:436 integration: Smart Boat 2000 USB (dokumentation) Inträffade först: 18:48:50 (11 händelser) Senast loggade: 20:39:05

Error processing state value : 0219FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0019FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0119FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0209F8:01:. Error: invalid literal for int() with base 16: '' Error processing state value : 031DEF:FF:. Error: invalid literal for int() with base 16: ''

slundell commented 4 months ago

I have looked through most of my data and noticed this error in almost all numbers. The only one not showing this is PGN 127257: roll. The ones below all have extreme values like 1300 knots of speed for instance :)

PGN: measurements with intermittent errors 127257: pitch and yaw, all units. Not roll 130312: Actual temperature, all units 129025: both lat and long 128267: Depth and offset 129026: Both COG and SOG 129029: Altitude, lat, long number of SVs

slundell commented 4 months ago

Snippet of the debug log. I do seem to have a few read errors on my network, which might be the root cause. It would be better if smart2000usb ignored malformed packets. In this instance the last part (after the ':' is empty)

2024-07-21 22:19:06.171 DEBUG (MainThread) [custom_components.smart2000usb.sensor] smart2000usb_data_key: USB0_smart2000usb_data
2024-07-21 22:19:06.171 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN 129540 is of type 'Fast'.
2024-07-21 22:19:06.171 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Ignoring frame 5 for PGN 129540 as it does not match current sequence.
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 01FA04, Frame ID: 19fa0400, CAN Data: 390ef200000016a5, Source ID: 00, Combined: 01FA04:00:390ef200000016a5
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] ---------------------------------------------------
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed PGN  : 129540 (Hex: 01FA04)
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed source ID  : 0 (Hex: 00)
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed data64  : 4111489591649769125 (Hex: 390ef200000016a5)
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] smart2000usb_data_key: USB0_smart2000usb_data
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN 129540 is of type 'Fast'.
2024-07-21 22:19:06.173 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Ignoring frame 5 for PGN 129540 as it does not match current sequence.
2024-07-21 22:19:06.175 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 01FA04, Frame ID: 19fa0400, CAN Data: fff50ff4401628a6, Source ID: 00, Combined: 01FA04:00:fff50ff4401628a6
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] ---------------------------------------------------
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed PGN  : 129540 (Hex: 01FA04)
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed source ID  : 0 (Hex: 00)
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed data64  : 18443665390687365286 (Hex: fff50ff4401628a6)
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] smart2000usb_data_key: USB0_smart2000usb_data
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN 129540 is of type 'Fast'.
2024-07-21 22:19:06.176 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Ignoring frame 5 for PGN 129540 as it does not match current sequence.
2024-07-21 22:19:06.178 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 0319FA, Frame ID: a719fa04, CAN Data: , Source ID: 04, Combined: 0319FA:04:
2024-07-21 22:19:06.178 ERROR (MainThread) [custom_components.smart2000usb.sensor] Error processing state value  : 0319FA:04:. Error: invalid literal for int() with base 16: ''
2024-07-21 22:19:06.181 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 01FA04, Frame ID: 19fa0400, CAN Data: ffffffef10593ba8, Source ID: 00, Combined: 01FA04:00:ffffffef10593ba8
2024-07-21 22:19:06.181 DEBUG (MainThread) [custom_components.smart2000usb.sensor] ---------------------------------------------------
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed PGN  : 129540 (Hex: 01FA04)
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed source ID  : 0 (Hex: 00)
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed data64  : 18446744000969391016 (Hex: ffffffef10593ba8)
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] smart2000usb_data_key: USB0_smart2000usb_data
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN 129540 is of type 'Fast'.
2024-07-21 22:19:06.182 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Ignoring frame 5 for PGN 129540 as it does not match current sequence.
2024-07-21 22:19:06.185 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 01FA04, Frame ID: 19fa0400, CAN Data: 84b3fc0eff18f2a9, Source ID: 00, Combined: 01FA04:00:84b3fc0eff18f2a9
2024-07-21 22:19:06.185 DEBUG (MainThread) [custom_components.smart2000usb.sensor] ---------------------------------------------------
2024-07-21 22:19:06.185 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed PGN  : 129540 (Hex: 01FA04)
2024-07-21 22:19:06.185 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed source ID  : 0 (Hex: 00)
2024-07-21 22:19:06.186 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed data64  : 9562263575177261737 (Hex: 84b3fc0eff18f2a9)
2024-07-21 22:19:06.186 DEBUG (MainThread) [custom_components.smart2000usb.sensor] smart2000usb_data_key: USB0_smart2000usb_data
2024-07-21 22:19:06.186 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN 129540 is of type 'Fast'.
2024-07-21 22:19:06.186 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Ignoring frame 5 for PGN 129540 as it does not match current sequence.
2024-07-21 22:19:06.187 DEBUG (MainThread) [custom_components.smart2000usb.sensor] PGN ID: 01FA04, Frame ID: 19fa0400, CAN Data: 16f20000000d0caa, Source ID: 00, Combined: 01FA04:00:16f20000000d0caa
2024-07-21 22:19:06.187 DEBUG (MainThread) [custom_components.smart2000usb.sensor] ---------------------------------------------------
2024-07-21 22:19:06.187 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed PGN  : 129540 (Hex: 01FA04)
2024-07-21 22:19:06.188 DEBUG (MainThread) [custom_components.smart2000usb.sensor] Reconstructed source ID  : 0 (Hex: 00)
SmartBoatInnovations commented 4 months ago

Ok..There is something weird going on because those pgns normally work. Can you set the log level to debug for the integration. Restart HA. Collect 15 mins of logs. Enail them to me at smart.boat.innovations@gmail.com

SmartBoatInnovations commented 4 months ago

With these error the processing for the pgn is aborted and the sensor is not updated. I do not think this is the cause of extreme values. In the 15 mins of log I could only find 1 of these anyway.

On Sun, 21 Jul 2024 at 19:47, Simon Lundell @.***> wrote:

It seems to me that there are problems parsing the hex output. There is a ":" in there. Maybe the hex string is cut in the wrong place but is parsable.

There are these extreme values in data from other devices as well. I get these errors in the log.

Logger: custom_components.smart2000usb.sensor Källa: custom_components/smart2000usb/sensor.py:436 integration: Smart Boat 2000 USB (dokumentation) Inträffade först: 18:48:50 (11 händelser) Senast loggade: 20:39:05

Error processing state value : 0219FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0019FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0119FA:04:. Error: invalid literal for int() with base 16: '' Error processing state value : 0209F8:01:. Error: invalid literal for int() with base 16: '' Error processing state value : 031DEF:FF:. Error: invalid literal for int() with base 16: ''

— Reply to this email directly, view it on GitHub https://github.com/SmartBoatInnovations/ha-smart2000usb/issues/2#issuecomment-2241739872, or unsubscribe https://github.com/notifications/unsubscribe-auth/BC34PQXHRUAHVHQCFOXPEITZNP63RAVCNFSM6AAAAABLGW2HJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRG4ZTSOBXGI . You are receiving this because you commented.Message ID: @.***>

SmartBoatInnovations commented 2 months ago

Updated code has resolved this issue.

SmartBoatInnovations commented 2 months ago

Closed