[Solved] What am I missing? OpenHABian and Bluetooth

Ok, so I’m testing OpenHABian on a RPi 3 with a completely clean build.

In my current production RPi3 OH2 box I’ve got BT and BTLE working perfectly, but no matter what I do I can’t get it to work under OpenHABian. I’ve tweaked the serial port settings to disable the Razberry board (options A on, B off and C off from memory) and I’m running all the same drivers & libraries that my production box runs.

I get errors along the lines of ‘device not found’ when I try to run hcitool scan.

What have I missed? Do I need to to change any other settings?

You didn’t miss anything. openHABian is a minimal system and thereby a bit different in what it provides out of the box. Did you see this? openHABian hassle-free openHAB Setup

Hi Thom,

Yup went through that thread prior to posting… I can see people are having problems with BT as well, but no solutions offered. I’ve also made the changes listed in the GitHub repo Issues #64 (https://github.com/openhab/openhabian/issues/64).

I’ll try to install the raspberrypi-sys-mods that @holger.ebert mentions in the post you flagged and see if that works. I’ve already got pi-bluetooth, bluez and other libraries installed.

Sadly I didn’t play around with Bluetooth yet. Because the openHABian base is a very minimal Raspbian, there are some differences. I hope we can find a solution that can then be included in the openHABian image by default! So please try and give me some feedback!

Just so you know: You could always just install a standard Raspbian (Lite) system and add openHABian to the mix following these few steps: http://docs.openhab.org/installation/openhabian.html#manual-setup

I’ll see if I can find time to do a Jessie-lite install and then OpenHABian over the top tonight. That might also solve the issue of not being able to change the locale data from en_US.UTF8 to en_GB.UTF8.

Regarding the BT issue. In my current OH2 box I ran the following as part of the (manual) build:
sudo apt-get install bluez python-bluez python-dev libbluetooth-dev

I then would run
hcitool scan to check BT adapter is working
hcitool lescan to check BTLE adapter is working

Under OpenHABian these calls fail with the device not found error I mentioned earlier.

As I said, I would still be interested in a solution, so please try a few more things before installing Jessie.

Did you look into https://github.com/openhab/openhabian/issues/59 ? I didn’t receive an answer from either of you there. Not the best conditions for improvements in openHABian…

Thom - sorry I didn’t get a notification that you’d replied to the GitHub issue. I’ll try that ASAP and get back to you.

I’ll do a clean OpenHABian install and try a few other things and get back to you.

1 Like

Hi there,

I didn’t test openHABian yet, but in my “normal” setup with RPi 3 + OH2 + YAHM + HM-MOD-RPI-PCB module I also had issues with bluetooth and could get it solved. So the steps in short:

sudo nano /lib/systemd/system/hciuart.service

This file should look like this:

[Unit]
Description=Configure Bluetooth Modems connected by UART
ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins
Before=bluetooth.service
After=dev-serial1.device

[Service]
Type=forking
ExecStart=/usr/bin/hciattach /dev/serial1 bcm43xx 921600 noflow -

[Install]
WantedBy=multi-user.target

(in my case)

Then in the file /etc/init.d/hm-mod-rpi-pcb after ‘### END INIT INFO’ a sleep 20 should be added.

After a reboot that worked for me but I can’t guarantee you’ve got the same issue.

Cheers,
Viktor

I have same issue on openhabian that “device no found” by either bluetoothctl or hcitool
and finally I found issue mostly like due to no user right on “pi” so command
"sudo usermod -G bluetooth -a pi" and restart should able fix this issue.

P.S. also need to add “–noplugin=sap” otherwise will get some error on openhabianPi which shows by “sudo service bluetooth status”

OK, after getting completely sidetracked by PiCorePlayer, Logitech Media Server, a x400 amp and 3.5" touch screens, I’ve finally gone back to this issue.

On a clean build of a new version of openHABian (downloaded Sat 11 March 2017) I tried the following to get the BT/BTLE working.

sudo apt-get install -y bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods

Then trying:

hcitool scan
hcitool lescan

both resulted in the usual “device not found” error.

Adding
sudo apt-get install -y pi-bluetooth
sudo reboot
then resulted in the hcitool scan & hcitool lescan both working as expected.

As it was about 01:00 on Sunday morning, what I can’t remember is whether or not I did the ‘sudo reboot’ before installing the pi-bluetooth as well!

Anyway, I did NOT touch the serial console setup via openhabian-config.

So as far as I can tell, this is now working.

N

2 Likes

I can confirm that it works seamlessly with a fresh openhabianpi-raspbian-20170318 installed on a RPI3

Just type

sudo apt-get install --force-yes -y bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods pi-bluetooth

no need to reboot :slight_smile:

sudo hcitool lescan shows me my BLE keychain NUT

1 Like

Didn’t work for me. My testing rpi3 has openhabianpi-ua-netinst-20170317.

sudo apt-get install --force-yes -y bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods pi-bluetooth

ran without error, but

sudo hcitool scan

results in

Device is not available: No such device

and

sudo hcitool lescan

results in

Set scan parameters failed: File descriptor in bad state

Any suggestions what I can do?

Reboot :slight_smile:

That’s what I did, but without any effect.

Maybe it’s because I had formerly installed z-wave binding. I uninstalled it but maybe there’s still something that blocks /dev/ttyAMA0.

The result of

hcitool dev

Is empty.

How did you install zwave? Some routines specifically disable onboard bluetooth because of known compatibility issues. Check the file /boot/config.txt for the following and remove it.

dtoverlay=pi3-miniuart-bt

@ThomDietrich: Awesome! That did the trick. Thanks!

BTW: I installed and uninstalled zwave binding via paper-ui. Did this answer your question?

You’ve probably executed some script before that. Anyhow, happy you were able to solve the issue!

Yes, works great and now reads my solar inverter data. Thanks very much

Latest Openhabian here @ rpi3 i can see openhabian adapter discovering a lot of bt devices in my inbox.I added my nexus 6 phone (shows as a generic bt device) and the issue i have is that my phone is connecting only when it is on bt discovering mode.If i quit bt settings or turn off screen it shows offline.