Implementation of iM871-A driver

Generic driver class for WM-Bus USB-dongle IM871A

Platform

Python 3.5.10 on Linux

Synopsis

This module implements a class for communication with IM871A module.

Authors

Steffen Breinbjerg, Thomas Serup

Date

21 October 2020

Version history

  • Ver 1.0: Set up driver.

  • Ver 1.1: Implemented seperate ‘open pipe’ handler. Added pipe path as 2.nd argument.

  • Ver 1.2: Implemented CRC-16 check.

  • Ver 1.3: Logging exceptions to syslog instead of printing to console.

  • Ver 1.4: No longer takes USB port as argument. Function for handling port is located in ‘utils/Search_for_dongle’.

class driver.DriverClass.IM871A(program_path, logOnDestruct=True)[source]

Implementation of a driver class for IM871A USB-dongle. Takes 1 argument1: - The path to where to put the pipe, e.g. the program directory.

close()[source]

Close the connection to IM871A, and the pipe.

open()bool[source]

Opens the port if port has been closed. It opens with the path given when instantiating the class. Also open the pipe.

open_pipe()bool[source]

Open up the pipe. Blocks until pipe is opened at the other end.

ping()bool[source]

Ping the WM-Bus module to check if it’s alive.

read_data()bool[source]

Read single dataframe from meters sending with the specified link mode. Send data into ‘named pipe’ (USBx_pipe). Removes the WM-Bus frame before sending data to pipe.

reset_module()bool[source]

Reset the WM-Bus module. The reset will be performed after approx. 500ms.

setup_linkmode(mode: str)bool[source]

Setup link mode for communication with meter. Takes the link mode as argument. If no Link Mode is set, default is ‘S2’