Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stops getting new information after couple of hours #31

Closed
Xitro01 opened this issue Jan 29, 2020 · 11 comments
Closed

Stops getting new information after couple of hours #31

Xitro01 opened this issue Jan 29, 2020 · 11 comments

Comments

@Xitro01
Copy link

Xitro01 commented Jan 29, 2020

Hello, thanks for this great plugin.
Yet, there seems to be an issue, with all of my sensors. I have the LYWSD02, mi flora and mijia round sensors.
The problem is that after a couple of hours it stops getting new information, a reboot temporarily fixes this. I have tried your latest release and even your 0.5.3 beta, but both have the same issue.

Here is my config:
sensor:

  • platform: mitemp_bt
    rounding: True
    decimals: 1
    period: 60
    log_spikes: False
    use_median: False
    active_scan: False
    hci_interface: 0

Knipsel

@Magalex2x14
Copy link
Collaborator

Hello! The reasons for this may be different.
Since version 0.5 has no external dependencies and does not work with files, some of the reasons can be discarded.
First of all, it is worth checking the system logs and the HA log for errors during the stop of data reception.
Personally, my reception can rarely stop due to errors in bluetooth operation that are recorded in syslog - I decided to reboot it with the bluetooth subsystem using the solution described here. It is curious that I note some pattern of occurrence of these errors - they appear when an active Samsung smartphone appears in the reception area (neighbor, the model has not yet figured out))))
In addition, it is worth checking whether you are using other components that work with the bluetooth subsystem - conflicts are possible.
Tell me what kind of hardware and operating system you have in order to clarify the degree of our freedom in finding the source of the problem.

@Xitro01
Copy link
Author

Xitro01 commented Jan 29, 2020

Thanks for your response, I will look into this, but that seems as a workaround.
Will try that for the time being when I have some time.

I didn't see anything in the HA logs when this problem occured.
I have a Raspberry Pi 3 with Raspbian and Hass.io (docker).

Hopefully you'll find a solution to this somehow.

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Jan 29, 2020

In addition to HA logs, it's worth seeing if there is anything in the system log (syslog).
I can also suggest trying to run btmon -w btmon.log to catch events on the HCI interface when the problem occurs (stop using CTRL+C).
btmon produces a lot of data, but it can help clarify the issue.

@Xitro01
Copy link
Author

Xitro01 commented Feb 3, 2020

Hi @Magalex2x14 so it stopped now 8 hours ago, the btmon -w is not giving me anything useful or does it have to work and then break down when I have this running?

The syslog shows me alot of spam when it is functioning:
Feb 3 14:31:59 pi kernel: [88888.092730] Bluetooth: hci0: Frame reassembly failed (-84)
and
Feb 3 14:32:01 pi kernel: [88889.633663] Bluetooth: hci0: SCO packet for unknown connection handle 38146
This comes back alot.

One of the last things in the log before the spamming stops is:
Feb 3 14:32:01 pi kernel: [88889.633740] Bluetooth: hci0: hardware error 0xc1

pi@pi ~ $ hcitool dev
Devices:

The bluetooth device seems to have crashed completely.
What could this be and how could this be solved, any ideas?

EDIT: Found a thread with exact same issues, which were firmware related. I just updated my firmware, so let's hope this solves the issues.
raspberrypi/firmware#1150

@Magalex2x14
Copy link
Collaborator

Let's hope this solves your problem. Please write about the result - if everything goes well, then this can be added to the FAQ.

@Xitro01
Copy link
Author

Xitro01 commented Mar 5, 2020

Issue is still there, the new firmwares didn't fix the problem.

I am using this fix for a couple of weeks now without encountering any issues anymore:

For a permanent change you've to change the read only HassOS fs https://unix.stackexchange.com/questions/8907/modifying-a-squashfs#8925

For a quicker but temporary solution:

make sure to have ssh access to HassOS (not with the plugin)
login
ps aux | grep hciattach and copy the running command
killall hciattach
run the copied command replacing the baud rate with 460800, prefixing nohup and postfixing with &:
nohup hciattach /dev/serial1 bcm43xx 460800 noflow - YOURMACADDRESS &
You might have to restart home assistant, make sure not to reboot the system otherwise everything get lost.

@Magalex2x14
Copy link
Collaborator

Thank you very much!

@Magalex2x14
Copy link
Collaborator

I close, but leave it pinned. Feel free to reopen if needed.

@Magalex2x14
Copy link
Collaborator

@Magalex2x14
Copy link
Collaborator

It seems like something was done in HassOS 3.13

@Magalex2x14 Magalex2x14 unpinned this issue Nov 21, 2020
@vini59fr
Copy link

vini59fr commented May 7, 2021

Hi there

I actually have a similar issue :(
HassOS + Pi4 + USB BT dongle (Trendnet TBW-106UB

2021-05-05 14_12_28-Aperçu - Home Assistant

I checked the bluetoothctl and it appears to be "power off" by itself. I can power it on, but it goes off after a couple of minutes/hours
2021-05-05 13_45_47-Terminal - Home Assistant

I really don't know where to find a solution :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants