Skip to content

lstrojny/homebridge-ble-thermobeacon

Repository files navigation

Homebridge plugin for Brifit/ORIA thermometers

CI npm version Libraries.io dependency status for GitHub repo npm verified-by-homebridge

Installation

Run npm install -g homebridge-ble-thermobeacon

Enable the plugin in the homebridge config.json:

{
  // ...
  "platforms": [
    {
      "platform": "PrometheusExporter",


      // Debugging enabled
      //
      // Default: false
      "debug": "<boolean>",


      // Publish all button press states as locks
      //
      // Pressed button is presented as unlocked, otherwise locked. Can help identify
      // the beacon
      //
      // Default: false
      "buttonAsLock": "<boolean>",


      // List of devices
      //
      // Default: []
      [
        {
          // Address
          //
          // Bluetooth address of the thermometer. MAC address on Linux, UUID on Mac
          "address": "<string>",


          // Name
          //
          // Specify a name for the thermometer in Homebridge
          "name": "<string>",


          // Publish button press state as lock
          //
          // Per device settings to publish button pressed state as a lock
          "buttonAsLock": "<boolean>"
        }
        //, { ... }
      ]
    }
  ]
}

Configuration

On Linux, the CAP_NET_RAW capability is required for BLE to work as a non-root user.

Systemd

If you are running homebridge with systemd (and you really should), you need to add CAP_NET_RAW as an ambient capability. Either edit the homebridge.service file directly or (preferably) place an override in /etc/systemd/system/homebridge.service.d.

Create the folder:

mkdir /etc/systemd/system/homebridge.service.d

Place this drop-in configuration in the folder, e.g. /etc/systemd/system/homebridge.service.d/bluetooth.conf:

[Service]
AmbientCapabilities=CAP_NET_RAW

Run systemctl daemon-reload to refresh systemd’s unit database and then run systemd-delta --type=extended to check if the drop-in worked as expected.

You should see something like this in the output:

…
[EXTENDED]   /lib/systemd/system/homebridge.service → /etc/systemd/system/homebridge.service.d/bluetooth.conf
…

Restart homebridge afterwards by running systemctl restart homebridge.

Acknowledgements

This project could not have happened without previous work. Many thanks!