Open jjpavlik opened 4 years ago
Changes on interface.py: https://github.com/jjpavlik/homemetrics/commit/07ffbf5a3c15a06bd088b1fb80e6ff65271125c4#diff-3805c2e71f1f86a297e85e232d7126ac https://github.com/jjpavlik/homemetrics/commit/dd5695a5caf322fee79ec69e67678c63d1960ffd#diff-3805c2e71f1f86a297e85e232d7126ac
Changes on device.py: https://github.com/jjpavlik/homemetrics/commit/6696f0ac25283a34ae349bb69a5b13eca9bd2dff
For some reason a few yesterday the communication between the Raspberry and the Pi had some delay that triggered the Write timeout on the serial interface.
May 02 08:01:14 raspberrypi collector.sh[5543]: Traceback (most recent call last): May 02 08:01:14 raspberrypi collector.sh[5543]: File "collector.py", line 239, in
May 02 08:01:14 raspberrypi collector.sh[5543]: main()
May 02 08:01:14 raspberrypi collector.sh[5543]: File "collector.py", line 197, in main
May 02 08:01:14 raspberrypi collector.sh[5543]: measure = dev.read_sensor(sensor)
May 02 08:01:14 raspberrypi collector.sh[5543]: File "/opt/homemetrics/device.py", line 84, in read_sensor
May 02 08:01:14 raspberrypi collector.sh[5543]: self._send_message(message)
May 02 08:01:14 raspberrypi collector.sh[5543]: File "/opt/homemetrics/device.py", line 281, in _send_message
May 02 08:01:14 raspberrypi collector.sh[5543]: self.comm.send_message(message)
May 02 08:01:14 raspberrypi collector.sh[5543]: File "/opt/homemetrics/interfaces.py", line 24, in send_message
May 02 08:01:14 raspberrypi collector.sh[5543]: return self.real_interface.write(message)
May 02 08:01:14 raspberrypi collector.sh[5543]: File "/opt/homemetrics/lib/python3.5/site-packages/serial/serialposix.py", line 579, in write
May 02 08:01:14 raspberrypi collector.sh[5543]: raise writeTimeoutError
May 02 08:01:14 raspberrypi collector.sh[5543]: serial.serialutil.SerialTimeoutException: Write timeout
I'm not sure what to make out of this, unfortunately I didn't print the message being sent. So, I think the following should be done:
There's a chance the Pi got stuck of some reason or maybe it just crashed and the write operation was called right when the Pi was being restarted. Anyhow, the exception should be caught for the program to keep running and some extra logging to see what happened.