arduino-dsmr
arduino-dsmr copied to clipboard
T211 DSMR5 meter does not send a unit for unlinked gas meter, causing 'missing unit' errors
This issue was reported to esphome at https://github.com/esphome/issues/issues/3886. The T211 meter is used by Enexis on 3-phase service. When no gas meter is present, or when it is not linked yet by the service provider, the meter reports a gas reading without m3 unit. This causes the library to throw a 'missing unit' error, which should probably be handled more gracefully.
Example:
0-1:24.2.1(632525252525S)(00000.000)
^
Missing unit
The timestamp of the gas reading in this example line also seems to be a placeholder. Possibly this identifier (632525252525S
) can be used to detect a gas meter that is not properly linked yet, allowing an empty value without unit to be returned.
Example correct line:
0-1:24.2.1(xxxx25070000S)(14336.324*m3)
This is where the error originates: https://github.com/matthijskooijman/arduino-dsmr/blob/master/src/dsmr/parser.h#L219
The rest of the datagram is perfectly valid, so we most likely don't want to error the entire parse action, causing no data to be returned at all.
Suggestion: Change TimestampedFixedField to handle the 632525252525S
timestamp, and pass an empty unit to the FixedField
-OR-
As the value 0 is dimensionless, allow a missing unit for a 0 value