Skip to content

jariz/homeassistant-basestation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Valve Basestation integration for Homeassistant

Read and manage power states for your Valve Index® Base Stations (also referred to as 'Lighthouse V2') through BLE.

Installation

  • Ensure HACS is installed.
  • Go to Community -> Frontend -> press the three dots (top right corner of screen) -> Custom repositories and add the following information:

Will it run?

Before configuring Home Assistant you need a Bluetooth backend and the MAC address of your basestation. Depending on your operating system, you may have to configure the proper Bluetooth backend for your system:

  • On Home Assistant: integration works out of the box.
  • On Home Assistant Container: Works out of the box with --net=host and properly configured Bluetooth on the host.
  • On other Linux systems:
    • Install the bluepy library (via pip). When using a virtual environment, make sure to install the library in the right one.

Scan for devices

Start a scan to determine the MAC addresses of your basestations (you can identify a basestation by looking for entries starting with LHB-, for example: LHB-F27AE376) using this command:

$ sudo hcitool lescan
LE Scan ...
1B:BE:05:0D:B0:5C (unknown)
F3:C7:68:BB:23:0B LHB-60B5777F
F7:8A:B0:FD:08:B5 LHB-F27AE376
[...]

Or, if your distribution is using bluetoothctl use the following commands:

$ bluetoothctl
[bluetooth]# scan on
[NEW] Controller <your Bluetooth adapter> [default]
[NEW] Device F3:C7:68:BB:23:0B LHB-60B5777F

If you can't use hcitool or bluetoothctl but have access to an Android phone you can try BLE Scanner or similar scanner applications from the Play Store to easily find your sensor MAC address. If you are using Windows 10, try the Microsoft Bluetooth LE Explorer app from the Windows Store.

Configuration

To use your basestation(s) in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
switch:
  - platform: basestation
    mac: "xx:xx:xx:xx:xx:xx"

More expansive example

Since you'll probably be adding more than 1 basestation, it's a good idea to use the group integration to group them together and control them all at once.

group:
  basestations:
    name: Basestations
    entities:
      - switch.lhb_1
      - switch.lhb_2

switch:
  - platform: basestation
    mac: "xx:xx:xx:xx:xx:xx"
    name: "LHB 1"
  - platform: basestation
    mac: "xx:xx:xx:xx:xx:xx"
    name: "LHB 2"

Automation ideas

  • Turn the airco on when your VR equipment activates.
  • Turn your basestations off/on when you turn off/on the lights
  • Turn your basestations off if there's no motion detected in the room anymore, or if you've left the house.
  • Start your computer (wake on lan), VR equipment, and screen (power plug) all at once.

Final notes

  • Yes, BLE does not conmmunicate well over long range.
    If this integration becomes any popular, I'm willing to write a gateway app like miflora has at some point.. I more or less did this with ESP32: read here.
  • Largely inspired by the miflora integration, thanks!