This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial working version of aiosoma with tests (#1)
- Loading branch information
1 parent
b10b6e7
commit 9ceeb0a
Showing
12 changed files
with
1,099 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,6 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,108 @@ | ||
# Usage | ||
|
||
To use this package, import it: | ||
To use this package, import `Aiosoma`: | ||
|
||
```python | ||
import asyncio_soma_connect | ||
from aiosoma import Aiosoma | ||
``` | ||
|
||
TODO: Document usage | ||
Next, create an `Aiosoma` object using either the hostname or IP address and port | ||
of your SOMA Connect. Using a static IP address is recommended. | ||
|
||
```python | ||
from aiosoma import Aiosoma | ||
|
||
soma = Aiosoma("soma-connect.local", 3000) | ||
``` | ||
|
||
## Methods | ||
|
||
### list_devices() | ||
|
||
Use to list all the devices visible to SOMA Connect. The `mac` address of the | ||
shade you want to control is a required parameter for all the other methods. | ||
|
||
```json | ||
{ | ||
"result": "success", | ||
"version": "2.3.1", | ||
"shades": [ | ||
{ | ||
"name": "Office", | ||
"mac": "aa:bb:cc:dd:ee:ff", | ||
"type": "shade", | ||
"gen": "2S" | ||
}, | ||
{ | ||
"name": "Kitchen", | ||
"mac": "aa:b1:cc:d1:ee:f1", | ||
"type": "shade", | ||
"gen": "2S" | ||
}, | ||
{ | ||
"name": "Lounge", | ||
"mac": "a1:bb:c1:dd:e1:ff", | ||
"type": "shade", | ||
"gen": "2S" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### get_shade_state(mac) | ||
|
||
Returns the firmware version and current position of the shade: | ||
|
||
```json | ||
{ | ||
"result": "success", | ||
"version": "2.3.1", | ||
"mac": "aa:bb:cc:dd:ee:ff", | ||
"position": 100 | ||
} | ||
``` | ||
|
||
### open_shade(mac) | ||
|
||
This method will open the shade unless stopped by manually calling `stop_shade()`. | ||
|
||
Returns: | ||
|
||
```json | ||
{ "result": "success", "version": "2.3.1", "mac": "aa:bb:cc:dd:ee:ff" } | ||
``` | ||
|
||
### close_shade(mac) | ||
|
||
This method will close the shade unless stopped by manually calling `stop_shade()`. | ||
|
||
Returns: | ||
|
||
```json | ||
{ "result": "success", "version": "2.3.1", "mac": "aa:bb:cc:dd:ee:ff" } | ||
``` | ||
|
||
### stop_shade(mac) | ||
|
||
This method will stop any movement currently in progress. | ||
|
||
Returns: | ||
|
||
```json | ||
{ "result": "success", "version": "2.3.1", "mac": "aa:bb:cc:dd:ee:ff" } | ||
``` | ||
|
||
### set_shade_position(MAC, position: int) | ||
|
||
This method will set the shade to the position specified, where 0 is fully open | ||
and 100 is fully closed. | ||
|
||
Returns: | ||
|
||
```json | ||
{ "result": "success", "version": "2.3.1", "mac": "aa:bb:cc:dd:ee:ff" } | ||
``` | ||
|
||
### get_battery_level(mac) | ||
|
||
Returns the current battery level of the shade: |
Oops, something went wrong.