Zha can't connect to freshly installed RaspBee II on RPi 4B / RaspBee II seems not available

Hey there,

I’m new af to the Raspberry Pi world, as also to Home Assistant. So please already forgive me stupid questions :slight_smile:

I have recently bought a RPi 4B 4GB and the RaspBee II Shield. While I was trying to install deCONZ and/or zha, I stumbled over various things like that you need to configure the device name manually for deCONZ and found some great tutorials, thread here, etc.

But one thing always bothered me and I just can’t get it solved: I cannot see the Rasbee module being listed anywhere. Also not under System => Hardware. It’s just not there. This guide is not using the Rasbee shield, but the Conbee USB Stick, but I thought it might be similar to what I have here. But under “Hardware” I can only see “serial: /dev/ttyAMA0” (which he mentions is there, before he installed the stick) but nothing like “/dev/ttyACM0” or something similar.

What am I doing wrong? Do I have to ssh to the PI and install something first? Do I have to do anything listed here: RaspBee Installation?
I mean, I’m used to using Linux since ages, but tbh, I never ever dealt with any hardware / devices on Linux, so that’s where my knowledge ends. And all tutorials read like that I actually don’t have to do anything else except just sticking the shield onto the Pi and that’s it :confused:

Thanks guys and again, sorry for the probably stupid question and if it had been asked already, but I just couldn’t find the answer…

Greetings,

Andy!

[EDIT] The solution:
First, thanks to @dbrunt for the help, much appreciated!
Second: I still couldn’t get deCONZ to work, but that’s only because I still have no clue how to configure it and set the device :slight_smile: Adding it to ‘/config/configuration.yaml’ had no effect. But I don’t care, I have zha now :slight_smile:

So the actual issue is (and I hope I understood that correctly) that for the RPi 3 and 4 the primary UART (which is the one to be present on the GPIO board, so where the shield is connected to) is connected to the miniUART, which
a) is disabled by default and
b) has less capabilities as the PL011 UART.
So I guess you could (purely theoretically) just enable the miniUART and try to have zha connect to it.
But as mentioned: It’s said to have less features, so we want the primary to be on the PL011.

And the trick to do this is actually by disabling bluetooth, because it is by default assigned to the primary UART and by disabling it, the RPi will also assign the PL011 to the primary! And this procedure is called a device tree overlay, so we reconfigure which UART is primary/secondary.
These overlays are done on the host system, not in HassIO (which runs inside a docker container)!

To do this, you need to:

  1. Shut down your RPi
  2. Get the SD Card out and hook it to your PC.
  3. You will see a config.txt in the root folder of it. Open it with a text editor
  4. Somewhere around the top, maybe below the “kernel” setting, add:
    RPi3: “dtoverlay=pi3-disable-bt”
    RPi4: “dtoverlay=disable-bt” (Yes, “pi3-disable-bt” also works on RPi 4, but it is just an alias for “disable-bt” since quite some time, you can use on RPi 4 (overlays: Rename pi3- overlays to be less model-specific (#3052) · raspberrypi/linux@8332ad7 · GitHub))
  5. Save the file and insert the card back into your RPi
  6. After HA is back, go to “Configuration” => “Integrations” => Click the “+” in the bottom right corner => Search for “zha” and select the /dev/ttyAMA0 serial device. After a little bit of loading it should auto detect that you have a RaspBee II and suggest which lib it uses to talk to it!

That’s it: I could already successfully add two Xiaomi door/window sensors, so I declare this working :slight_smile: That’s all I did to get the RaspBee working: No further installation needed, no need to do this: RaspBee Installation. Simply stick the RaspBee II shield to your RPi and do the steps above!

If you want to read and understand more about UART and how RPi handles them, check the links dbrunt posted below:

Greetings,

Andy!

P.S.: Yes, the trick with disabling BT is not new and I admit, I also found this in old threads which were about a fresh RPi 3 release and I had no clue on how to do this. So the solution was out there, but with my fresh RPi and HA knowledge, I could just not see that this is the solution to my problem :wink:

13 Likes

Or does somebody at least also have the RaspBee II shield and can share how (s)he set it up? Did it really just appear under “Hardware” after sticking it onto the RPi?

Hi Andy,

Have you tried this: “SSH to the PI, then use raspi-config, to enable the uart”?
It took me a while to figure all that out when I added a RaZberry shield onto a Pi 3 B+. I had to do a miniuart-bt overlay in boot config.txt. Review this: https://www.raspberrypi.org/documentation/configuration/uart.md
and this https://www.raspberrypi.org/documentation/configuration/device-tree.md#part4.6

enable_uart Enable the primary/console UART (ttyS0 on a Pi 3, ttyAMA0 otherwise - unless swapped with an overlay such as miniuart-bt). If the primary UART is ttyAMA0 then enable_uart defaults to 1 (enabled), otherwise it defaults to 0 (disabled). This is because it is necessary to stop the core frequency from changing which would make ttyS0 unusable, so enable_uart=1 implies core_freq=250 (unless force_turbo=1). In some cases this is a performance hit, so it is off by default. More details on UARTs can be found here

Hey Daniel,

thanks for the reply! But as far as I understand, HassOS doesn’t have raspi-config, as it’s not based on Raspbian :confused: So I’m not quite sure how I would achieve this then :frowning:
Still, this rings a little bell, as I heard people had to deactivate Bluetooth to get it working… Let me digg into this a bit :slight_smile:

Greetings,

Andy!

I re-read your posts above and I believe sticks are ttyACM0 while shields are ttyAMA0.
My RaZberry Z-Wave shield on Pi 3B+ is /dev/ttyAMA0.
The Conbee II USB dongle on my HA Debian 10 box is /dev/ttyACM0.

Have you tried selecting /dev/ttyAMA0 in ZHA or deCONZ?

Oh, ok. That is, erm. interesting :smiley: I was under the assumption that this is some kind of placeholder / default / disconnected state. As the guide (which was using the USB stick) also mentioned this. So I expected this AMA0 to be come something else. Not exactly what he had (as again: he has the USB), but well :smiley:

And actually: No: I didn’t try it with deCONZ, I have to admit. I had so many tabs open and issues I ran into and then: I didn’t know if the shield worked at all :wink:
Now trying it again, I again run into the same issue as before: I have no clue how I can edit the config file of the deCONZ plugin… There is no “Config” section at the bottom of the page for me… So back to finding out how this works :slight_smile:

Thanks again for your help!!

I am new to HA as of 9 days ago but have been a HomeSeer user for 20 years
I’m not sure about HASSIO but when I add the deCONZ integration it would appear to simply be a pipe into a Phoscon/deCONZ service that is separate from HA. I ran it in a docker container for use with HS4 on Debian and the docker config/setup for it specifies the serial port it’s to use for the coordinator.
So after a little more investigating I see there is a deCONZ add-on which I presume creates a “docker” container for deCONZ. I tried on my Debian 10 OS and the service won’t start, possibly because I’m not HASSIO. I added it to my sidebar which is where I presume you would go to configure it it’s interface. After that, I believe you would need to add the deCONZ integration…
.

Perhaps see if ZHA can use ttyAMA0…

Screw deCONZ! I got it working with zha, PLUS your hints about UARTs!

So what I did:

  • I tried zha to “just use” the ttyAMA0 and it said “could conenct to device” or something similar. So I went back to your guide, where I just left and added this to the config of the host system, by adding the SD card to my laptop:
    ** enable_uart=1
    ** dtoverlay=pi3-disable-bt
  • Now I see one more device, plus still the ttyAMA0. I tried zha again to connect to it aaaaaand: IT WORKED!! I will now try to find my Xiaomi Door sensors with it!

Thanks again for digging into this, very much appreciated!

Or maybe I try tomorrow, as my wife is already sleeping and the sensor is in the bedroom, lol :slight_smile:

LOL! Sounds like a wise plan! So, what tty device device did it end up being?

As you guessed/said: The ttyAMA0, which is the first UART, according to the docs you linked. Plus, the 2nd device which is now available is the miniUART (ttyS0)

:+1::+1::+1:

Can you share how you set this up? I am trying to install a Raspbee II on a RaspPi 3B+ and I can’t get the shield to be “seen” by the OS. The /dev/ttyACM0 and /dev/ttyAMA0 devices are both in the “audio” group which seems odd to me. I’ve tried adding all the combinations of enabling UART, disabling BT that I’ve come across, both on the config USB stick and in the root of the SD card. I have no idea why it isn’t appearing in /dev/serial/by-id and neither DConz nor ZHA can connect to it on ttyAMA0 or ttyACM0. I’d like to have at least a little progress.

I’m confused by your mention of a “config USB stick”. Can you explain? Is your Zigbee a card or a stick?
The Raspbee II is a “shield” that plugs onto the Pi header pins and will be accessed via /dev/ttyAMA0. The Conbee II is it’s counterpart that is a USB stick which shows up as /dev/ttyACM0 when plugged in. /dev/ttyAMA0 exists regardless of the connection of the Raspbee II as it is originally used for bluetooth on the Pi and that is what the BT overlay takes care of swapping.
I don’t believe /dev/serial/by-id is implemented with udev in Raspberry OS the way other Linux OS’s use it. The rules for what it does are in /etc/udev/rules.d/ and on the Raspberry it looks like it links /dev/ttyAMA0 to /dev/serial0…

Config USB stick == the USB device where I keep config.txt to set up networking at boot.

The Raspbee II is the Pi shield/card.

I didn’t know that /dev/ttyAMA0 was for BT normally. That explains why it’s in the “audio” group. Probably if I can figure out how to disable that, the Raspbee will be visible.

I’ll try looking in /etc/udev/rules.d to see if there’s something I change to do that.

udev rules is not the answer! You need to disable bluetoothon the UART.

To do this, you need to:

Shut down your RPi
Get the SD Card out and hook it to your PC.
You will see a config.txt in the root folder of it. Open it with a text editor
Somewhere around the top, maybe below the “kernel” setting, add:
RPi3: “dtoverlay=pi3-disable-bt”

This is what I have in my /boot/config.txt:

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# mini UART
# enable_uart=1
# core_freq=250

# switch bluetooth function to ttyS0 and restore UART0/ttyAMA0 over GPIO 14&15
dtoverlay=pi3-miniuart-bt

# or disable internal bluetooth
# dtoverlay=pi3-disable-bt

start_x=0
root@HS3Pi3v5:/boot# 

You should be able to sudo nano /boot/config.txt and then reboot the pi…

Use either dtoverlay-pi-miniuart-bt (swaps bluetooth to ttys0) or dtoverlay=pi3-disable-bt (just disable it)

For anyone setting up a Raspbee II on a rPi3 B+:

  • Log into the Hassio host (not the Home Assistant container that you normally connect to with SSH or the SSH UI Add-on.
  • Edit /boot/config.txt and add these lines:
enable_uart=1
dtoverlay=pi3-disable-bt
  • Shutdown Pi
  • Stick the shield on
  • Start Pi
  • Install the DeConz add-on and use /dev/ttyAMA0 as the device
  • Install the DeConz integration and tell it to use the DeConz service you just installed
  • Go into DeConz -> Phoscon and start adding stuff

Glad to see you got it up and running!

BTW, enable_uart=1 is for the mini UART. Not sure if you need that enabled or not.
The PL011 is the main UART which is UART0.
https://www.raspberrypi.org/documentation/configuration/uart.md