EmonHub MBUS watchdog automatic restart

I’ve added a simple watchdog automatic serial port restart to the MBUS interfacer if no valid response is received after 10 attempts. This seems to have fixed a data dropout issue for someone I have been helping with this. This update is now available in the latest version of EmonHub v2.6.6 (commit auto restart serial if no data in 10 reads · openenergymonitor/emonhub@4a9b26b · GitHub).

It seems that the serial port software gets stuck perhaps after receiving corrupted data.

I am also wondering if I should call the following after every request, which might avoid the issue in the first place?


I will test adding this in.

I’m sure you’ve figured this out, but could the corrupt serial data be related to the kernel console issue we discussed :


It would seem very weird for serial to behave in such a way it needs flushed after each transaction. The 10 attempt reconnect is a good idea, and won’t hurt. I would log the connection reattempts at INFO or ERROR level though to bring attention to the fact something is wrong

Just my 2p, having recently got the m-bus all working with a supercal5