ble_monitor: The sensor stops updating after some time and requires a restart of the server
Hi,
I have been using this custom component for the past week as the official one stopped reporting data after a couple of hours after each restart.
The custom component works really well for me but usually, after running HA for 2-3 days the sensor stops updating as well. I am running HA in a docker container on my Raspberry Pi 3.
If I connect to my docker container and run hcitool lescan --duplicates and a hcidump --raw I can still see some data in my terminal.
For now, my only temporary solution is to restart my docker container to get the sensor to update itself again. Is there anything else I could do, or any command I could run to make the sensor work again without restarting?
Ben
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 35
Commits related to this issue
- Revert back to a TemporaryFile instead of bugged(#12) SpooledTemporaryFile — committed to custom-components/ble_monitor by Magalex2x14 5 years ago
Hi!
I was running on the beta 3 with the change of code recommended here: https://github.com/custom-components/sensor.mitemp_bt/issues/12#issuecomment-564207869 and it worked for several days without any issue.
I now moved to the beta 4 and got the following error after about 2 hours. The component then stops updating and I need to restart HA.
It’s running for 24 hours now, without any errors or stopping sensor. Seems to be solved for me.
What does your esphome config has to do with this component? Which component is not working? Esphome or mitemp_bt?
@camfrout @Ernst79 OK, guys… Perhaps I found the reason for our troubles… Used by component SpooledTemporaryFile contains a bug, because of which there is a chance of damage the dump… By the solution I see a rollback to a simple TemporaryFile, but this can increase the number of file system write operations (which may be important for devices like raspberryPI with SD cards. This can be bypassed by mounting /tmp as tmpfs, i.e. /tmp will be located in memory on OS level, which is useful in any case, as it seems to me). Unfortunately, I have not yet found another good way to redirect dump output, since the PIPE buffer is limited in size, and even my minute dump doesn’t fit there - that is, you need to receive the dump in batches, and this is multi-threading and the probability of blocking code execution, and my recent experiments with multithreading were unsuccessful (my knowledge is still scarce). Summarizing: I will soon push a new beta with a rollback to the TemporaryFile, and we will see if this helps.