room-assistant: hcitool not working

Describe the bug Can’t get any reading from BTC: 10/25/2020, 11:18:10 AM - error - BluetoothClassicService: Command failed: hcitool -i hci0 cc "88:63:DF:8A:1B:DC" && hcitool -i hci0 rssi "88:63:DF:8A:1B:DC"

To reproduce Installed on latest HassOS 4.15, on a RPI 3B+

Relevant logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:23:18] INFO: Setting up Home Assistant configuration
[11:23:19] INFO: Starting room-assistant
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
10/25/2020, 11:23:26 AM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-classic, bluetooth-low-energy
10/25/2020, 11:23:29 AM - info - NestFactory: Starting Nest application...
10/25/2020, 11:23:29 AM - info - InstanceLoader: AppModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: ConfigModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: NestEmitterModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: IntegrationsModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: HttpModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: DiscoveryModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: ClusterModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: TerminusModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: ScheduleModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: EntitiesModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: BluetoothLowEnergyModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: HomeAssistantModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
10/25/2020, 11:23:29 AM - info - InstanceLoader: StatusModule dependencies initialized
10/25/2020, 11:23:30 AM - info - RoutesResolver: EntitiesController {/entities}:
10/25/2020, 11:23:30 AM - info - RouterExplorer: Mapped {/entities, GET} route
10/25/2020, 11:23:30 AM - info - RoutesResolver: StatusController {/status}:
10/25/2020, 11:23:30 AM - info - RouterExplorer: Mapped {/status, GET} route
10/25/2020, 11:23:30 AM - warn - BluetoothLowEnergyService: The whitelist and blacklist are empty, no sensors will be created! Please add some of the discovered IDs below to your configuration.
10/25/2020, 11:23:33 AM - info - HomeAssistantService: Successfully connected to MQTT broker at mqtt://192.168.1.22:1883
10/25/2020, 11:23:33 AM - info - ConfigService: Loading configuration from /usr/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/default.json, config/local.json
10/25/2020, 11:23:33 AM - info - ClusterService: Starting mDNS advertisements and discovery
10/25/2020, 11:23:33 AM - info - NestApplication: Nest application successfully started
10/25/2020, 11:23:39 AM - error - BluetoothClassicService: Command failed: hcitool -i hci0 cc "64:a2:f9:f1:b8:7b" && hcitool -i hci0 rssi "64:a2:f9:f1:b8:7b"
Invalid device: Network is down
10/25/2020, 11:23:45 AM - error - BluetoothClassicService: Command failed: hcitool -i hci0 cc "88:63:DF:8A:1B:DC" && hcitool -i hci0 rssi "88:63:DF:8A:1B:DC"
Invalid device: Network is down

Relevant configuration

  instanceName: Hassio
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.22:1883'
  mqttOptions:
    username: secret
    password: secret
bluetoothClassic:
  minRssi: -20
  addresses:
    - '64:a2:f9:f1:b8:7b'
    - '88:63:DF:8A:1B:DC'

Expected behavior Get reading of the BTC RSSI

Environment

  • room-assistant version: 2.10.1
  • installation type: HassOS
  • hardware: RPI 3B+
  • OS: HassOS

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 41 (13 by maintainers)

Most upvoted comments

I’ve got this issue on my very unorthodox system, so I’m assuming it’s not the fault of either room-assistant or home-assistant.

What I did to fix this is I created a script ‘/usr/bin/check_bluetooth.sh’ with this code in it

#!/bin/bash

echo "Checking health of bluetooth interface" | systemd-cat -t "BT Check Script"
thisran=0
while [ "$(hciconfig hci0 | grep -i 'running' &>/dev/null; echo $?)" != 0 ]
do
	echo "Found bluetooth interface down, attempting to re-enable" | systemd-cat -t "BT Check Script"
	hciconfig hci0 up
	sleep 1
	thisran=1
done
if [ $thisran -gt 0 ]; then
	echo "Bluetooth interface correctly re-enabled, terminating" | systemd-cat -t "BT Check Script"
else
	echo "Bluetooth interface running correctly, terminating" | systemd-cat -t "BT Check Script"
fi

then added this in crontab from user root and execute it every 5 minutes. What is does is it checks the BT networking, if it’s up then it just quits, if it’s down it attempts to reset it. Admittedly this is a weak fix: if anything goes wrong, this gets stuck in a loopy-loop forever so take it with a grain of salt.

@mKeRix worth thinking about doing something similar on your side if you get a network down?

Still buggered for me, even after the last update.

Yes I have this problem also after reboot. I did this a couple of times and although sometimes it works after reboot for 1 hours or so, it false again the adpater crashes.

The output of the command sequence:

[bluetooth]# show xx:yy:zz:aa:bb:cc
Controller xx:yy:zz:aa:bb:cc (public)
        Name: computername.domain
        Alias: computername.domain
        Class: 0x000c0104
        Powered: yes
        Discoverable: no
        Pairable: yes
        UUID: Headset AG                (00001112-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: Generic Attribute Profile (00001801-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: A/V Remote Control        (0000110e-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: Generic Access Profile    (00001800-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: PnP Information           (00001200-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: A/V Remote Control Target (0000110c-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: Audio Sink                (0000110b-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: Audio Source              (0000110a-xxxx-yyyy-zzzz-somerandomnumbers)
        UUID: Headset                   (00001108-xxxx-yyyy-zzzz-somerandomnumbers)
        Modalias: usb:v1D6Bx0246xxxx
        Discovering: no

This output was generated while it was working …