-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mbus devices #141
Mbus devices #141
Conversation
At least the BE and the NL DSMR devices use MBUS. Therefor we make the MBUS obis reference generic, and convert the V5 telegram to use MBUS values. Also remove BELGIUM_MAX_POWER_PER_PHASE as this was a duplicate. Finally set self.maxDiff = None to have a full test output on some tests.
BELGIUM_MAX_POWER_PER_PHASE = r'^\d-\d:17\.0\.0.+?\r\n' # Applicable when power limitation is active | ||
BELGIUM_MAX_CURRENT_PER_PHASE = r'^\d-\d:31\.4\.0.+?\r\n' # Applicable when current limitation is active | ||
|
||
# Multiple 'slaves' can be linked to the main device. | ||
# Mostly MBUS1 = GAS METER with values on 24.2.3 | ||
# While WATER METER reports it's values on 24.2.1 | ||
# The GAS METER also reports its valve state on 24.4.0 | ||
# Dev type for gas = 7 and water = 8 | ||
BELGIUM_MBUS1_DEVICE_TYPE = r'^\d-1:24\.1\.0.+?\r\n' | ||
BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER = r'^\d-1:96\.1\.1.+?\r\n' | ||
BELGIUM_MBUS1_VALVE_POSITION = r'^\d-1:24\.4\.0.+?\r\n' | ||
BELGIUM_MBUS1_METER_READING1 = r'^\d-1:24\.2\.1.+?\r\n' | ||
BELGIUM_MBUS1_METER_READING2 = r'^\d-1:24\.2\.3.+?\r\n' | ||
|
||
BELGIUM_MBUS2_DEVICE_TYPE = r'^\d-2:24\.1\.0.+?\r\n' | ||
BELGIUM_MBUS2_EQUIPMENT_IDENTIFIER = r'^\d-2:96\.1\.1.+?\r\n' | ||
BELGIUM_MBUS2_VALVE_POSITION = r'^\d-2:24\.4\.0.+?\r\n' | ||
BELGIUM_MBUS2_METER_READING1 = r'^\d-2:24\.2\.1.+?\r\n' | ||
BELGIUM_MBUS2_METER_READING2 = r'^\d-2:24\.2\.3.+?\r\n' | ||
|
||
BELGIUM_MBUS3_DEVICE_TYPE = r'^\d-3:24\.1\.0.+?\r\n' | ||
BELGIUM_MBUS3_EQUIPMENT_IDENTIFIER = r'^\d-3:96\.1\.1.+?\r\n' | ||
BELGIUM_MBUS3_VALVE_POSITION = r'^\d-3:24\.4\.0.+?\r\n' | ||
BELGIUM_MBUS3_METER_READING1 = r'^\d-3:24\.2\.1.+?\r\n' | ||
BELGIUM_MBUS3_METER_READING2 = r'^\d-3:24\.2\.3.+?\r\n' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these might be breaking for anyone using these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. But backwards compatibility is not really an issue. You always depend on a specific version.
You neither can have multiple of the same regexes in the same parser, as only the first will match afaik.
MBUS1_DEVICE_TYPE = r'^\d-1:24\.1\.0.+?\r\n' | ||
MBUS1_EQUIPMENT_IDENTIFIER = r'^\d-1:96\.1\.0.+?\r\n' | ||
MBUS1_EQUIPMENT_IDENTIFIER_ALT = r'^\d-1:96\.1\.1.+?\r\n' | ||
MBUS1_VALVE_POSITION = r'^\d-1:24\.4\.0.+?\r\n' | ||
MBUS1_METER_READING = r'^\d-1:24\.2\.1.+?\r\n' | ||
MBUS1_METER_READING_ALT = r'^\d-1:24\.2\.3.+?\r\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be these can be generic matching all devices:
MBUS1_DEVICE_TYPE = r'^\d-1:24\.1\.0.+?\r\n' | |
MBUS1_EQUIPMENT_IDENTIFIER = r'^\d-1:96\.1\.0.+?\r\n' | |
MBUS1_EQUIPMENT_IDENTIFIER_ALT = r'^\d-1:96\.1\.1.+?\r\n' | |
MBUS1_VALVE_POSITION = r'^\d-1:24\.4\.0.+?\r\n' | |
MBUS1_METER_READING = r'^\d-1:24\.2\.1.+?\r\n' | |
MBUS1_METER_READING_ALT = r'^\d-1:24\.2\.3.+?\r\n' | |
MBUS_DEVICE_TYPE = r'^\d-\d:24\.1\.0.+?\r\n' | |
MBUS_EQUIPMENT_IDENTIFIER = r'^\d-\d:96\.1\.0.+?\r\n' | |
MBUS_EQUIPMENT_IDENTIFIER_ALT = r'^\d-\d:96\.1\.1.+?\r\n' | |
MBUS_VALVE_POSITION = r'^\d-\d:24\.4\.0.+?\r\n' | |
MBUS_METER_READING = r'^\d-\d:24\.2\.1.+?\r\n' | |
MBUS_METER_READING_ALT = r'^\d-\d:24\.2\.3.+?\r\n' |
The exiting references are generic too. The regex will simple give more matches if there are more devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik there can only be a specific regex per value you want to parse. Otherwise it will only match the first one.
{ | ||
'obis_reference': obis.DEVICE_TYPE, | ||
'value_parser': CosemParser(ValueParser(int)), | ||
'value_name': 'DEVICE_TYPE' | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be keep de generic one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will cause same issue as above and is to generic as it will match an mbus device type.
Superseded by #142 |
Open for comments :)