Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

ebaauw/homebridge-sc

Repository files navigation

Homebridge SC

Downloads Version Homebridge Discord verified-by-homebridge

GitHub issues GitHub pull requests JavaScript Style Guide

Homebridge plugin for SOMA Connect

Copyright © 2021-2023 Erik Baauw. All rights reserved.

Note: This plugin is no longer being maintained.

This Homebridge plugin exposes SOMA Smart Shades 2 and SOMA Tilt 2 devices, connected to a SOMA Connect, to Apple's HomeKit.

This plugin does not depend on Bluetooth Low Energy (BLE) support on the server running Homebridge. It uses the HTTP API of the SOMA Connect to interact with the SOMA devices. Note that this API is currently in beta.

Note that the SOMA Connect provides native Homebridge support. However, I find that support lacking:

  • It doesn't expose the battery;
  • It doesn't expose the solar panel light level;
  • It exposes Close Upwards and Morning Mode as write-only characteristics, which most HomeKit apps don't like;
  • It doesn't report in which direction ("up" or "down") the blinds are closed;
  • It doesn't support specifying which devices to expose, which might be needed when you have multiple SOMA Connect servers for better BLE signal coverage, but some devices are seen by both Connect servers.

This plugin is my proof-of-concept how better to expose the SOMA Tilt. I hope to feedback my findings to Wazombi Labs for inclusion in the SOMA Connect.

SOMA Connect

SOMA Connect is available as a Raspberry Pi image here. It can also be written to an SD card using the Raspberry Pi Imager. The image provides the light version of PiOS, without the graphical environment. I'm now running it on a Pi 3B+, connected to the network wired over Ethernet, after some stability issues using a Pi Zero W, over WiFi.

SSH access is disabled by default, but easily enabled by placing an ssh file in the boot partition of the SD card, see Remote Access. That way, you don't need to connect a monitor and keyboard. After installing pigpio, the Pi can be monitored remotely by Homebridge RPi.

It looks like the SOMA Connect software is based on HAP-NodeJS alright, but, unfortunately, it's not open source. They seem to have packaged NodeJS, HAP-NodeJS and the SOMA-specific Javascript code into a single soma-connect executable. There doesn't seem to be an easy way to enhance their Javascript code. The executable runs as root, probably to interact with the Bluetooth Low Energy hardware. It looks like soma-connect opens the mDNS port exclusively, so running Homebridge on the same Raspberry Pi as SOMA Connect doesn't seem feasible.

Command-Line Tool

Homebridge SC include a command-line tool, sc, to interact with the SOMA Connect from the command line. It takes a -h or --help argument to provide a brief overview of its functionality and command-line arguments.

Configuration

In Homebridge's config.json you need to specify Homebridge SC as a platform plugin, and provide the IP address of the SOMA Connect.

  "platforms": [
    {
      "platform": "SC",
      "hosts": [
        {
          "host": "192.168.x.x"
        }        
      ]
    }
  ]

If you have multiple SOMA Connect servers, for better Bluetooth signal coverage, you might need to whitelist which devices are exposed through which SOMA Connect:

"platforms": [
  {
    "platform": "SC",
    "hosts": [
      {
        "host": "192.168.x.x",
        "shades": [
          "AA:AA:AA:AA:AA:AA",
          "BB:BB:BB:BB:BB:BB"
        ]
      },
      {
        "host": "192.168.x.y",
        "shades": [
          "CC:CC:CC:CC:CC:CC"
        ]
      }      
    ]
  }
]