question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hcitool not working

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:41 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
embclacommented, Oct 31, 2020

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?

1reaction
Veldkornetcommented, Oct 27, 2020

Still buggered for me, even after the last update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bluetooth scan usin "hcitool scan" returns no results (Hama ...
Try running the following: sudo bluetoothctl agent on default-agent scan on. Type scan off to stop scanning.
Read more >
Hcitool not working - Home Assistant OS
Im connected to hassio using putty and $ sudo hcitool lescan is not woking. Im trying seach for a MAC address on a...
Read more >
hcitool lescan does not work on Bluetooth version 5
It has turned out to me that hcitool is not capable of running lescan on Bluetooth v5.X hardware. Running sudo hcitool lescan would...
Read more >
hcitool scan does not find my bluetooth device - Ask Ubuntu
I have a small device that has a bluetooth chip. I can see it through the GUI System Settings > Bluetooth, when adding...
Read more >
Hcitool lescan does not work - Fedora Discussion
Hi there, Bus 002 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) bluetoothctl Agent registered [CHG] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found