Just made the hardware adapter and a plugin.
As I didn't want to connect it directly to my Pi I tweaked the adaper to work with a standard USB to serial adapter and standard terminal software,
just so I could check it worked with Realterm and CuteCom before starting to crunching bits.
This of course made it unsuitable for the limbus library, but that is probably not a very good idea to use in a plugin anyway.
Anyway the first snatch i ran into is the lack of parameters for serial as I need "Even" parity bit, worked around it with:
Code: Select all
def onConnect(Connection, Status, Description):
global SerialConn
subprocess.call(["stty -F /dev/ttyUSB0 eol '\x16' eol2 '\xe5' min 0 time 10 -parodd parenb"],shell=True)
Which is that I can only read one byte at a time, seems "Connection" totally ignore any other settings made by 'stty'.
I can not use the "Line" protocol as that seems to be hard coded for Cr or Nl, neither which is used in the Meter-bus protocol.
Allthogh it doesn't seem to slow down either Domoticz or the Pi with 108 bytes read one by one it's not "neat".
Suggestions anyone?
As for the future of the plugin I'm planning on making it able to read any serial M-bus meter first frame with the standard VIF's.
Manufacturer extended values will have to be manually factored.
I'm thinking of letting the plugin autogenerate devices which in case of the EM340 is 11 on the first frame (one combined so actually 8).
It would be nice to know if anyone besides me are intrested in a M-Bus plugin so I know if i should stop at an example or make it a universal plugin.