An open API service indexing awesome lists of open source software.

https://github.com/lab11/soma-shade-control

Control the SOMA smart shades with HTTP.
https://github.com/lab11/soma-shade-control

Last synced: 5 months ago
JSON representation

Control the SOMA smart shades with HTTP.

Awesome Lists containing this project

README

          

SOMA Shade Control
======================

This project was created to control the SOMA smart shades using BLE.
Additionally, a basic HTTP/HTTPS interface allows control over the internet.

# Local Control

SOMA shades can be controlled using a BLE interface.

It refers heavily to [SOMA-Smart-Shades-HTTP-API](https://github.com/paolotremadio/SOMA-Smart-Shades-HTTP-API),
but is written as a node library using noble instead of invoking
the GATT Tool directly.

## Installation

```
cd soma-shade-control
npm install
```
## Usage

Local control provides the following actions:

* Get battery level
```
soma.js battery -m
```
* Get current shade position in percent
```
soma.js position -m
```
* Set a target for the shade position in percent
```
soma.js target 50 -m
```
* Move the shade up
```
soma.js up -m
```
* Move the shade down
```
soma.js down -m
```
* Stop the shade moving
```
soma.js stop -m
```

# HTTP Control

## Installation

First install the dependencies required for local control.
To install as a system service:

```
sudo cp systemd/* /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable soma-http
sudo systemctl start soma-http
```

## Usage
Make sure to change the basic auth credentials `admin:password`, and if using
https, to point the script to the correct cert and private key location.
Then, just run the script:
```
sudo ./soma-http.js
```
or if using https:
```
sudo ./soma-https.js
```

### Interface

The HTTP/HTTPS application has a JSON interface and supports all of the local
control commands. Below are some examples using `curl`.

JSON takes the format:
```
{
"shade": ,
"action": ,
"value":
}
```

* Get battery level
```
curl -L --header "Content-Type: application/json" --request GET -d '{"shade": , "action": "battery" }' -u admin:password /shades
```
* Get current shade position in percent
```
curl -L --header "Content-Type: application/json" --request GET -d '{"shade": , "action": "position" }' -u admin:password /shades
```
* Set a target for the shade position in percent
```
curl -L --header "Content-Type: application/json" --request POST -d '{"shade": , "action": "target", "value": 50 }' -u admin:password /shades
```
* Move the shade up
```
curl -L --header "Content-Type: application/json" --request POST -d '{"shade": , "action": "up"}' -u admin:password /shades
```
* Move the shade down
```
curl -L --header "Content-Type: application/json" --request POST -d '{"shade": , "action": "down"}' -u admin:password /shades
```
* Stop the shade moving
```
curl -L --header "Content-Type: application/json" --request POST -d '{"shade": , "action": "stop"}' -u admin:password /shades
```