// Copyright (C) 2025 Fredrik Öhrström (gpl-3.0-or-later)
driver {
name = zenner0b
meter_type = WaterMeter
default_fields = name,id,status,total_m3,target_m3,timestamp
detect {
mvt = ZRI,0B,16
}
fields {
field {
name = mfct_specific_data
quantity = Text
attributes = HIDE
match_entire_payload = true
info = 'Decode manufacturer data after DIF 0x0F.'
ixml = "decode = -'0F', status, target, total, -byte?.
status = byte, byte, byte, byte, @DV_STATUS.
target = byte, byte, byte, byte, @DV_TARGET.
total = byte, byte, byte, byte, @DV_TOTAL.
-hex = ['A'-'F'; '0'-'9'].
-byte = hex, hex.
DV_STATUS>dvk = +'04FF0B'.
DV_TARGET>dvk = +'04FF0C'.
DV_TOTAL>dvk = +'04FF0D'."
}
field {
name = status
quantity = Text
attributes = STATUS
info = 'Meter status flags (bytes 0-3 from manufacturer data).'
default_message = OK
match {
difvifkey = 04FF0B
}
lookup {
name = STATUS
map_type = IndexToString
mask_bits = 0xffffffff
map {
name = OK
info = OK
value = 0x00000
test = Set
}
}
}
field {
name = target_raw
quantity = Dimensionless
attributes = HIDE
info = 'Raw current month water consumption in units of 1/256000 m3.'
vif_scaling = None
display_unit = counter
match {
difvifkey = 04FF0C
}
}
field {
name = target
quantity = Volume
info = 'The current month water consumption.'
calculate = 'target_raw_counter / 256000counter * 1m3'
}
field {
name = total_raw
quantity = Dimensionless
attributes = HIDE
info = 'Raw total water consumption in units of 1/256000 m3.'
vif_scaling = None
display_unit = counter
match {
difvifkey = 04FF0D
}
}
field {
name = total
quantity = Volume
info = 'The total water consumption recorded by this meter.'
calculate = 'total_raw_counter / 256000counter * 1m3'
}
}
tests {
test {
args = 'TestWater zenner0b 50087367 NOKEY'
telegram = 1E44496A677308500B167AD80010252F2F0F0000000080BF1B0000A6420000
json = '{"_":"telegram","id":"50087367","media":"cold water","meter":"zenner0b","name":"TestWater","status":"OK","target_m3":7.1035,"timestamp":"1111-11-11T11:11:11Z","total_m3":17.062}'
fields = 'TestWater;50087367;OK;17.062;7.1035;1111-11-11 11:11.11'
}
test {
args = 'StatusWater zenner0b 50087367 NOKEY'
telegram = 1E44496A677308500B167AD80010252F2F0F80BF1B0080BF1B0000A6420000
json = '{"_":"telegram","id":"50087367","media":"cold water","meter":"zenner0b","name":"StatusWater","status":"STATUS_1BBF80","target_m3":7.1035,"timestamp":"1111-11-11T11:11:11Z","total_m3":17.062}'
fields = 'StatusWater;50087367;STATUS_1BBF80;17.062;7.1035;1111-11-11 11:11.11'
}
}
}