Ruuvicollector stops collecting data

I have installed ruuvicollector to Raspberry Pi 3+ and it works fine. It collects data, it is written to Influx and you can see all three tags data in grafana about 14 hours at a time.
Then the data collecting stops, but grafana and influx plays well. You can see the collected data, but you must reboot the device to get it collecting fresh data again.
Any ideas?

I use a system script with automatic restart, https://blog.ruuvi.com/rpi-gateway-6e4a5b676510 under ā€œFinishing touchesā€

hcitool or something hangs in my Raspi. I have this in rootā€™s crontab:

58 * * * * killall hcitool; hciconfig hci0 reset && hciconfig hci0 up

But Iā€™m using ruuvitag_sensor python library.

Having similar issues with homeassistant & raspberry pi 3+. Either HW or hcitool.

Logs show escalation of issues, rebooting every night makes things work almost all the time except some occasions when things just stop working after random time since reboot.

raspberrypi kernel: [110134.572778] Bluetooth: hci0: Frame reassembly failed

raspberrypi kernel: [110885.311899] Bluetooth: hci0: command 0x1003 tx timeout

raspberrypi hass[487]: Canā€™t init device hci0: Connection timed out (110)

raspberrypi hass[487]: Could not open device: No such device

raspberrypi hass[487]: 2019-10-20 13:20:20 WARNING (MainThread) [homeassistant.components.sensor] Updating ruuvi_hass sensor took longer than the scheduled update interval 0:00:30

I have a similar issue regarding the collection of data. To avoid it, Iā€™ve set the Pi to reboot every night at 00.00, but sometimes data collection never resumes. If I ssh into the Pi and run ā€˜hcitool lescanā€™, it starts working immediately.

Is there anything that could be done about this?

EDIT: had this happen again. Now it only gets one set of readings after hcitool lescan and doesnā€™t seem to continue scanning.

I couldnā€™t get the thing working by rebooting in software. After powering the whole thing off with the power switch, I get fresh data. Very irritating :rage:

This is a new issue, Iā€™ve heard of it only in installations done after the summer. It might be SW or HW related, all information on models of Pi, OS and HCItools is useful to track down the breaking change.

Mine is an RPi 3B+, your latest image is installed. I just checked and HCItools is the latest version available. I save data on my Windows PC so the RPi is only collecting and sending it over the network.

Got my homeassistant setup stable for at least 24 hours finally. Currently I am testing how long until hcitool stops working.

The solution was to add 10 seconds per each ruuvitag to the scanning delay. Default value was 10 secs and with my 5 tags I increased it to 60 secs and all errors stopped immediately.

Functioning homeassistant custom componen files and better readme with additional config options in case someone needs them: https://github.com/peltsippi/ruuvi-hass

I also tested running this with crontab instead of a daily reboot, and Ruuvicollector stopped working after the command line was executed. A reboot made it work again, but as mentioned earlier, sometimes collection doesnā€™t begin even then. Usually the problem occurs within one week or so.

Been battling with this problem for a long time in both Raspberry Pi and regular Linux server PC. Hereā€™s what Iā€™ve tried:

sudo echo 1 > /sys/bus/usb/devices/3-4/power/autosuspend
sudo echo "on" > /sys/bus/usb/devices/3-4/power/level
sudo echo -1 > /sys/bus/usb/devices/3-4/power/autosuspend_delay_ms

and having this in rootā€™s bash script crontab:

#!/bin/bash
systemctl restart bluetooth
hciconfig hci0 down
hciconfig hci0 up
systemctl restart ruuvicollector

None of these and other work, after a couple of days Bluetooth just stops working and hciconfig hci0 up says:

Can't init device hci0: Connection timed out (110)

Any help? Iā€™m this close to buy Ruuvi Gatewayā€¦

Which Rpi? What version?

name -a 

cat /proc/cpuinfo

cat /proc/device-tree/model

 sudo btmon -S|head -n 40

See btmon docs for sample output.

I use PC and Fedora 32 server.

[08:41:32] rolle ~ $ uname -a
Linux peikko 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[08:41:34] rolle ~ $ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 800.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 6998.11
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 800.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 6998.11
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 800.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 6998.11
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 2200.294
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 6998.11
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

[08:41:37] rolle ~ $ cat /proc/device-tree/model
cat: /proc/device-tree/model: Tiedostoa tai hakemistoa ei ole
[08:41:42] rolle ~ $ sudo btmon -S|head -n 40
Bluetooth monitor ver 5.55
= Note: Linux version 5.11.22-100.fc32.x86_64 (x86_64)                 0.067674
= Note: Bluetooth subsystem version 2.22                               0.067676
= New Index: 5C:F3:70:A5:26:A4 (Primary,USB,hci0)               [hci0] 0.067677
= Open Index: 5C:F3:70:A5:26:A4                                 [hci0] 0.067678
= Index Info: 5C:F3:70:A5:26:A4 (Broadcom Corporation)          [hci0] 0.067678
@ RAW Open: hcidump (privileged) version 2.22          {0x0003} [hci0] 0.067679
@ RAW Open: hcitool (privileged) version 2.22          {0x0002} [hci0] 0.067679
@ MGMT Open: bluetoothd (privileged) version 1.19             {0x0001} 0.067680
> HCI Event: LE Meta Event (0x3e) plen 30                    #1 [hci0] 0.072866
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 43:A2:31:8A:2E:F9 (Resolvable)
        Data length: 18
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        TX power: 8 dBm
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 2d1e74f2b240
        RSSI: -70 dBm (0xba)
> HCI Event: LE Meta Event (0x3e) plen 40                    #2 [hci0] 0.092870
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
        Address type: Random (0x01)
        Address: 06:50:DD:3A:3A:7B (Non-Resolvable)
        Data length: 28
        16-bit Service UUIDs (complete): 1 entry
          Apple, Inc. (0xfd6f)
        Service Data (UUID 0xfd6f): ca33bcfa0b58b94fb2c06832b9e3a87faeca2ad4
        RSSI: -90 dBm (0xa6)
> HCI Event: LE Meta Event (0x3e) plen 29                    #3 [hci0] 0.102873
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)

Please issue
sudo btmon -S|head -n 40
when in stops working.

It worked fine for 4 days but stopped working now.

@dgerman The command just hangs forever.

$ systemctl restart bluetooth
$ hciconfig hci0 down
$ hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

$ sudo btmon -S|head -n 40
^C
$ sudo btmon -S
Bluetooth monitor ver 5.55
= Note: Linux version 5.11.22-100.fc32.x86_64 (x86_64)                           0.147708
= Note: Bluetooth subsystem version 2.22                                         0.147711
= New Index: 5C:F3:70:A5:26:A4 (Primary,USB,hci0)                         [hci0] 0.147712
@ RAW Open: hcidump (privileged) version 2.22                    {0x0002} [hci0] 0.147713
@ MGMT Open: bluetoothd (privileged) version 1.19                       {0x0001} 0.147713
^C

Nothing in this situation helps except physically removing the dongle and plugging it back in.

Wish I could be more helpful. Sounds like the dongle is intermittent.
Which dongle is it?
Do you have a different dongle to try?

Decided to stop using physical server and purchased Ruuvi Gateway instead. Problem ā€œsolvedā€.