Wireless M-Bus
api.wmbusSetup(...)
- Overview
- Arguments
- Return
- Example 1
- Example 2
Changes the configuration of W M-bus.
api.wmbusSetup has 2 structures.
- api.wmbusSetup(power, role, mode)
- api.wmbusSetup("property",value)
in case of api.wmbusSetup(power, role, mode):
- power (integer) - W M-bus power: -20 dBm, -10 dBm, 0 dBm, 2 dBm, 4 dBm
- role (string) - W M-bus role: master, slave, meter, concentrator, repeater
- mode (string) - W M-bus mode: S1, S2, T1, T2, T1_C, T2_C, R
in case of api.wmbusSetup("property",value):
- "property" (string):
- "ROLE" - W M-bus role: master, slave, meter, concentrator, repeater
- "MODE" - W M-bus mode: S1, S2, T1, T2, T1_C, T2_C, R
- "IGNORE_CRC" - true, false
- "DISABLE_MADDALENA_ARROW_SUPPORT" - true, false
- value - property value
- status (integer) - Positive or zero for success, negative for failure
--setup W M-bus interface to power of 10 dBm, role master/concentrator and T2 mode
api.wmbusSetup(10, "master", "T2")
--setup W M-bus interface T2 mode
api.wmbusSetup("MODE", "T2")
api.wmbusSetCField(c_field)
- Overview
- Arguments
- Return
- Example
Sets W M-bus C field.
- c_field (integer) - W M-bus C field (max value 255)
- status (integer) - Positive or zero for success, negative for failure
-- Set W M-bus C field as 128
api.wmbusSetCField(128)
api.wmbusSetHeader(manid, id, version, devtype)
- Overview
- Arguments
- Return
- Example
Sets W M-bus header.
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- status (integer) - Positive or zero for success, negative for failure
-- Set W M-bus header for specific device
print("--- W M-bus T1 Digital Thermometer ---")
api.wmbusSetup(10, "meter", "T1")
api.wmbusSetCField(17)
api.wmbusSetHeader(123, 123456, 2, 33)
api.wmbusSendFrame(ci, data)
- Overview
- Arguments
- Return
- Example
Sends frame through W M-bus.
- ci (integer) - CI field
- data (string) - Frame to be sent
- status (integer) - Positive or zero for success, negative for failure
-- Send W M-bus frame
api.wmbusSendFrame(212, "foobar")
api.wmbusReceiveFrame(timeout)
- Overview
- Arguments
- Return
- Example
Waits timeout milliseconds for data reception from W M-bus.
- timeout (integer) - The maximum time in milliseconds to wait for WMBUS device answer
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
-- Receive W M-bus data with 2000 ms timeout
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveFrame(2000)
print(status)
print(id)
print(payload)
api.wmbusReceiveSendFrame(ci, payload, timeout)
- Overview
- Arguments
- Return
- Example
Waits timeout milliseconds for data reception from W M-bus.
Only available for W M-bus in concentrator role.
- ci (integer) - CI field
- payload (string) - Payload to be send
- timeout (integer) - The maximum time in milliseconds to wait for RS485 device answer
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
x=string.char(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveSendFrame(200, x, 2000)
print(status)
print(id)
print(payload)
api.wmbusSendReceiveFrame(ci, payload, debugon)
- Overview
- Arguments
- Return
- Example
Send data and receive from W M-bus device
This function is only available for W M-bus in meter role.
- ci (integer) - CI field
- payload (string) - Payload to be send
- debugon (integer) - If 1, then debug prints of wmbus frame will be present in stdout
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
x=string.char(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveSendFrame(200, x)
print(status)
print(id)
print(payload)
api.wmbusFilter(operation, filter)
- Overview
- Arguments
- Return
Fubction and it's operations to set and filter received Wireless M-Bus frame.
This function is only available for W M-bus in meter role.
- operation (string) - use "purge", "populate", "show" or "fetch"
- filter (string) - W M-Bus filter
- status (integer) - integer value acording to operation
- WMBUSfilterLength (string) - length of W M-Bus filter