Files
openclaw-workspace/docs/home-assistant/ROOM_ASSISTANT_SETUP.md
2026-04-11 09:45:12 -05:00

3.1 KiB

Room Presence Setup with Pi Zeros

Prerequisites

  • Raspberry Pi Zero W (or Pi Zero 2 W)
  • MicroSD card (8GB+)
  • Power supply for Pi
  • MQTT broker running on Home Assistant

Step 1: Flash Raspberry Pi OS

  1. Download Raspberry Pi Imager from https://www.raspberrypi.com/software/

  2. Flash Raspberry Pi OS Lite (no desktop, smaller footprint)

  3. Enable SSH and WiFi in the imager settings:

    • Set hostname: livingroom-pi (one per room)
    • Enable SSH with password auth
    • Set WiFi credentials
  4. Insert SD card and boot the Pi

Step 2: Copy Files to Pi

# From your computer, copy the files to the Pi
scp room-assistant-config.yml setup-room-assistant.sh pi@<pi-ip>:~/

# SSH into the Pi
ssh pi@<pi-ip>
# Default password: raspberry

Step 3: Run Setup

# Make the script executable
chmod +x setup-room-assistant.sh

# Run as sudo
sudo ./setup-room-assistant.sh

The script will prompt for:

  • Room name (e.g., LivingRoom, Kitchen)
  • MQTT username and password
  • Phone MAC addresses

Step 4: Find Phone MAC Address

On iPhone: Settings → About → Bluetooth → Copy address (xx:xx:xx:xx:xx:xx)

On Android: Settings → About Phone → Status → Bluetooth address

Step 5: Verify in Home Assistant

Once running, room-assistant will create MQTT discoveries. In HA:

  1. Settings → Devices & Services → MQTT

  2. Look for new device_tracker entities:

    • device_tracker.corey_phone_livingroom
    • device_tracker.kathy_phone_livingroom
  3. These appear in HA's device tracker UI

Step 6: Create Room Zones (Optional)

# In HA, create zones for each room
# Configuration.yaml or in the UI:
homeassistant:
  zone:
    - name: Living Room
      latitude: !secret home_lat
      longitude: !secret home_lon
      radius: 5  # meters

Files Created

File Purpose
room-assistant-config.yml Template config (edit per room)
setup-room-assistant.sh Automated install script
config/local.yml Generated config (lives on Pi)

Managing Multiple Pis

Create a config file per room:

Room Hostname Instance Name
Living Room livingroom-pi LivingRoom
Kitchen kitchen-pi Kitchen
Bedroom bedroom-pi Bedroom

Troubleshooting

WiFi not connecting?

  • Check /etc/wpa_supplicant/wpa_supplicant.conf for WiFi config
  • Pi Zero W supports 2.4GHz only

Bluetooth not scanning?

# Check Bluetooth status
hciconfig
# Restart Bluetooth
sudo systemctl restart hciuart

MQTT not connecting?

  • Verify MQTT credentials in /home/pi/.room-assistant/config/local.yml
  • Check HA MQTT add-on is running

View logs:

journalctl -u room-assistant -f

Customize RSSI Threshold

Lower value = detects devices farther away Higher value = must be closer to be detected

bluetoothClassic:
  rssiThreshold: -70  # Default, adjust as needed

Adding New Devices

Edit /home/pi/.room-assistant/config/local.yml and add:

knownDevices:
  - name: 'New Device'
    address: 'AA:BB:CC:DD:EE:FF'

Then:

sudo systemctl restart room-assistant