keptenkurk / BS440

Python code to talk to Medisana BS440 bluetooth enabled bathroom scale
MIT License
50 stars 34 forks source link

Service stops randomly at some point with "Error getting handles" "Continue Comms: False" #109

Open Boldfor opened 1 year ago

Boldfor commented 1 year ago

Setting:

BS440 set up according to this procedure: https://community.openhab.org/t/use-case-connecting-a-bathroom-body-fat-scale-e-g-medisana-bs440-via-bluetooth-mqtt-to-openhab-step-by-step-instruction/143296/1

Problem description: Everything runs smooth, except that the script (if run as a service) stops working randomly at some point in time. The last thing I see via journalctl -l -f -u bs440:

Jan 31 12:51:03 raspberrypi sudo[29421]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jan 31 12:51:03 raspberrypi sudo[29421]: pam_unix(sudo:session): session closed for user root
Jan 31 14:51:05 raspberrypi sudo[5545]:     root : PWD=/home/pi/BS440-HA-AD ; USER=root ; COMMAND=/usr/bin/systemctl restart bluetooth
Jan 31 14:51:05 raspberrypi sudo[5545]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jan 31 14:51:11 raspberrypi sudo[5545]: pam_unix(sudo:session): session closed for user root
Jan 31 14:51:11 raspberrypi sudo[5568]:     root : PWD=/home/pi/BS440-HA-AD ; USER=root ; COMMAND=/usr/bin/hciconfig hci0 reset
Jan 31 14:51:11 raspberrypi sudo[5568]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jan 31 14:51:11 raspberrypi sudo[5568]: pam_unix(sudo:session): session closed for user root
Jan 31 16:50:46 raspberrypi python[2150]: 2023-01-31 16:50:46,512 WARNING  <module> Error getting handles
Jan 31 16:50:46 raspberrypi python[2150]: 2023-01-31 16:50:46,517 INFO     <module> Continue Comms: False

Other than that, if the scale transmits data, nothing gets logged anymore. The only thing that helps is stopping the script via systemctl stop bs440 and manually starting it again either via python BS440.py or as a service via systemctl start bs440`.

Even though Restart=always is defined in the service file, the service does not seem to come up again. My current thought: The service is not stopped (otherwise it would restart) but somehow stops functioning?

What's also odd (looking at the log above: The service always stops working (probably with the last entry) some hours after having started, and while no action has been going on on the scale itself.

Anyone having a clue?

Edit: My problem seems to be identical to the one reported here: https://github.com/keptenkurk/BS440/issues/95