matthijskooijman / arduino-dsmr

Arduino library for interfacing with Dutch smart meters implementing DSMR
133 stars 110 forks source link

T211 DSMR5 meter does not send a unit for unlinked gas meter, causing 'missing unit' errors #50

Open jeffreykog opened 1 year ago

jeffreykog commented 1 year ago

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

SamuraiCoder commented 7 months ago

Just had my meter replaced and got exactly the same error. I was able to make the rest work by commenting in the yaml about the gas but I am wondering when I will be able to read the gas since its was interests me more to monitor.

Also, EnergieDirect / Enexis need to activate the remote reading I guess cause still I am not reading anything on their website.