// Copyright (C) 2020-2022 Fredrik Öhrström (gpl-3.0-or-later)
driver {
name = lansendw
meter_type = DoorWindowDetector
default_fields = name,id,status,timestamp
detect {
mvt = LAS,07,1d
}
fields {
field {
name = status
quantity = Text
info = 'The state (OPEN/CLOSED) for the door/window.'
match {
measurement_type = Instantaneous
vif_range = DigitalInput
}
lookup {
name = INPUT_FLAGS
map_type = IndexToString
mask_bits = 0xffff
map {
name = CLOSED
value = 0x11
test = Set
}
map {
name = OPEN
value = 0x55
test = Set
}
}
}
field {
name = error_flags
quantity = Text
info = 'Error flags.'
attributes = STATUS,INCLUDE_TPL_STATUS
match {
measurement_type = Instantaneous
vif_range = ErrorFlags
}
lookup {
name = ERROR_FLAGS
map_type = BitToString
mask_bits = 0xffff
default_message = OK
}
}
field {
name = a
quantity = Dimensionless
info = 'How many times the door/window has been opened or closed.'
match {
measurement_type = Instantaneous
vif_range = Dimensionless
}
}
field {
name = b
quantity = Dimensionless
info = 'The current number of counted pulses from counter b.'
match {
measurement_type = Instantaneous
vif_range = Dimensionless
subunit_nr = 1
}
}
}
tests {
test {
args = 'Dooro lansendw 00010205 NOKEY'
telegram = 2e44333005020100071d7ab54800002f2f02fd1b110002fd971d01000efd3a2200000000008e40fd3a000000000000
json = '{"_":"telegram","media":"reserved","meter":"lansendw","name":"Dooro","id":"00010205","status":"CLOSED","a_counter":22,"b_counter":0,"error_flags":"ERROR_FLAGS_1 PERMANENT_ERROR UNKNOWN_40","timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Dooro;00010205;CLOSED;1111-11-11 11:11.11'
}
test {
args = 'Dooro lansendw 00010205 NOKEY'
telegram = 2e44333005020100071d7ab66800002f2f02fd1b550002fd971d01000efd3a2300000000008e40fd3a000000000000
json = '{"_":"telegram","media":"reserved","meter":"lansendw","name":"Dooro","id":"00010205","status":"OPEN","a_counter":23,"b_counter":0,"error_flags":"ERROR_FLAGS_1 PERMANENT_ERROR UNKNOWN_60","timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Dooro;00010205;OPEN;1111-11-11 11:11.11'
}
}
}