MBus library Back


require('mbus')

Include library before calling mbus functions


mbus.init(port, baud [, duplex])

Sets serial port and baud rate to use for all other mbus functions, must be called before any other mbus functions

Parameters:


mbus.scan([min [, max [, retries]]])

Scans given primary address range, returns table with found devices

Parameters:


mbus.getdata(addr [, frames])

Gets all data from the device with the given primary address. Returns table on success, nil plus error message on failure

Parameters:


mbus.writeaddr(old, new)

Sets new primary address. Returns true on success, nil plus error message on failure

Parameters:


mbus.writevif4(addr, vif, value)

Changes VIF to the given 4-byte integer value for the given primary address. Returns true on success, nil plus error message on failure

Parameters:


mbus.lasterror()

(Starting from v20170616) Returns a string containing the last error that occured during some mbus function calls