Test and fix parsing of gas unit.

This commit is contained in:
Johan Bloemberg 2016-11-07 20:08:28 +01:00
parent cf771776cd
commit fe5caa9126
No known key found for this signature in database
GPG Key ID: B1AE6948ED49BB55
2 changed files with 3 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class MBusObjectV2_2(DSMRObject):
@property
def unit(self):
return self.values[4]['unit']
return self.values[4]['value']
class CosemObject(DSMRObject):

View File

@ -35,4 +35,6 @@ def test_parse_v2_2():
result = parser.parse(TELEGRAM_V2_2)
assert float(result[CURRENT_ELECTRICITY_USAGE].value) == 1.01
assert result[CURRENT_ELECTRICITY_USAGE].unit == 'kW'
assert float(result[GAS_METER_READING].value) == 1.001
assert result[GAS_METER_READING].unit == 'm3'