How to set up cod.m CC2538 + CC2592 Raspberry Pi Module for Home Assistant
It should also work for the CC2652P2 Raspberry Pi Module for Home Assistant
Biggest hurdle: Accessing Raspberry UART when running Hassio
I wrote this as a comprehensive guide to install the cod.m CC2538 + CC2592 Raspberry Pi Funcmodul v0.3. It required some info that I was able to gather from the internet in several places. It was written in Januari 2021. Things might have changed since then. I am using windows to set this all up.
To make this work I needed these items
- Raspberry Pi with MicroSD card with Home Assistant installed.
- cod.m CC2538 + CC2592 Raspberry Pi Module v 0.3
- USB-stick (altervatively a Micro-SD to SD card converter)
- An antenna that has a u.FL connector.
- I myself had an antenna lying around that was SMA male. So I bought a u.FL-female to SMA-female antenna conver.
- Exxample: Bits and Parts. I had it in my mail the day after it was processed.
First off, this is the fastest, easiest method. I did not try this method, but instead of getting SSH access to your system this is also a possibility I was told:
- Shut down your Raspberry Pi.
- Take out the SSD card and place it in your pc.
- Navigate to the correct folder (presumably
mnt/boot/config.txt
). - Edit the file as described in [Editing the config.txt file](## Editing the config.txt file). You won't have to use VI.
- Place the Sd card back into the Raspberry Pi.
- Follow the guide from there.
- Install Putty
- go to https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
- download the .msi and run it.
- PuTTYgen should be in yout start menu (Windows key + type 'PuTTYgen' to find it). Run it.
- Changing setings is optional; I left it to default. Press the 'Generate' button and move your mouse over the blank area to generate some randomness.
- If you want to add some security to to using the key you can add a password here. I did.
- Save it somewhere safe by pressing 'Save private key'. Name it whatever you want.
- Now you have a file you can always open again by PuTTYgen and the public key will be visible again.
- The public key we want will not be correctly saved by the 'Save public key' button. You accomplish this by doing the following:
- Copy the public key from the text field. Be sure to copy all of it.
- Paste it in an advanced text editot like Notepad++ or Visial Studio Code. They can be found on the internet and are free.
- The default encoding is normally UTF-8. Set this to ANSI. (In notepad++ you select Encoding -> Convert To ANSI)
- The default line endings are Windows (CR LF). Set this to Unix (LF) (In notepad++ you right click in the bottom right where it states: CRLF and select LF.
- Save it somewhere and name it
authorized_keys
.
There are 2 ways to get the key onto the Rapberry Pi.
- Prepare a USB stick:
- Copy the File we just created to a USB drive that is formatted FAT, ext4 or NTFS.
- Give it the name : CONFIG
- Copy the
authorized_keys
in the root. - Plug in into your Raspberry Pi.
- Now either:
- Import it: Go to your HA interface and click 'Supervisor' -> 'System'. Under 'Host' select 'Import from USB'. It might be hidden under the tripple dots.
- Reboot Home Assistant
- Shut down Home Assistant
- Get the Micro-SD card an put it in your pc.
- Create a folder named CONFIG
- Copy the file in there
- Put the card back
- Start up your system
- Start up Putty
- Enter the up or hostname into the field.
- Use port 22222
- Optionally give it a name and hit 'Save'.
- In the left menu under 'Connection', select 'SSH' -> 'Auth'.
- In the Authentication Parameters click 'Browse...'
- Select yout private key (ppk file)
- Click 'Open'
- Log in as
root
, and use the password you set.
After you have logged in...
- Type
login
- Make a backup; Type
cp /mnt/boot/config.txt /mnt.boot.config.bak
- vi is the only editor. Type
vi mnt/boot/config.txt
- If you have no idea how vi works (I did not); use the link below as a reference
- Enable the line
enable_uart=1
by removing the#
- Under
[all]
add the linedtoverlay=disable-bt
to disable it.- Even though I have a Pi4, this worked for me.
- You also need to disable hciuart. However it was not set up. You can check this by running
systemctl status hciuart
- If it iss found disable it
systemctl disable hciuart
- If it iss found disable it
- Turn off the Raspberry pi.
- Press the u.FL antenna onto the module. Make sure you place it on the u.FL straight and apply slight pressure. It will click on there.
- Connect the module in the correct way (which is on the Raspberry Pi on the other side than the USB connectors are; hovering over the rapberry pi; not the other way).
- The Raspberri Pi and the module will not fit in any Raspberri Case. If you want to fit it make sure you get one with a bit of spave on the top. I strapped the antenna to the case with a tie-wrap so that if you or your pet accidentally trips over the cable you don't destroy your hardware.
- Power up.
- Go to 'Configuration' -> 'Integrations'
- Click '+ Add Integration' icon in the bottom right and search for ZHA (Select Zigbee Home Automation)
- For me it configured automatically. But you can look at the link at the resources
- Click on the ZHA Integration (1 device)
- In the bottom right click '+ Add Device'
- Access with PuTTY:
- I followed this guide to get access to the OS: https://developers.home-assistant.io/docs/operating-system/debugging/
- It links to a page which describes how to create the SSH key file: https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-putty/
- Getting to the file; after I was logged in I used some info on this thread to get it running
- Info on 'vi'
- Read more about UART configuration:
- Adding the device to Home Assistant
- 0.2 (2021-01-20)
- Added the preparation part.
- Added antenna connection to [Hardware](## Hardware)
- Added the Alternative version of putting the Micro SD card in the PC to edit.
- 0.1 (2021-01-17) -Initial version