somweb


Namesomweb JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/taarskog/pysomweb
SummarySOMweb client. Open/close Garage doors produced by SOMMER (base+/pro+/tiga/tiga+/barrier systems)
upload_time2023-04-10 19:06:51
maintainer
docs_urlNone
authorTrond Aarskog
requires_python>=3.6.0
licenseMIT
keywords sommer somweb garage door home assistant home automation heiigjen
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# SOMweb Client

A client library to control garage door operators produced by [SOMMER](https://www.sommer.eu) through their [SOMweb](https://www.sommer.eu/somweb.html) device.

> ⚠ It is not enough to have a [supported operator](https://www.sommer.eu/en/somweb.html#kompatibilitaet) to use this package. You also need the SOMWeb device.

## Made for home automation

The package is created as part of an extension to [Home Assistant](https://www.home-assistant.io/). There are no dependencies and no references to Home Assistant, so you can use the package directly from python or integrate it with any other home automation system.

## Test from terminal

In all samples replace **\*\*\*\*** with your values.

### Usage

```sh
$ python main.py -h
usage: main.py [-h] --udi UDI --username USERNAME --password PASSWORD --action {alive,auth,get_all,status,open,close,toggle} [--door DOOR_ID]

SOMweb Client.

optional arguments:
  -h, --help            show this help message and exit
  --udi UDI             SOMweb UID
  --username USERNAME   SOMweb username
  --password PASSWORD   SOMweb password
  --action {alive,auth,get_all,status,open,close,toggle}
                        SOMweb password
  --door DOOR_ID        Id of door to perform the following actions on: "status", "open", "close" or "toggle"
```

### Alive

Check if SOMweb is reachable and responding to requests

```sh
$ python main.py --udi ******** --username ******** --password ******** --action alive
True
Operation took 0 seconds
```

### Authenticate

Returns success, valid token and the html of the front page.

```sh
python main.py --udi ******** --username ******** --password ******** --action auth
AuthResponse(success=True, token='...', page_content='...')
Operation took 1 seconds
```

### Get Doors

Get all connected doors

```sh
$ python main.py --udi ******** --username ******** --password ******** --action get_all
[Door(id='2', name='Garage')]
Operation took 1 seconds
```

### Door Status

Get status of door with id 2

```sh
$ python main.py --udi ******** --username ******** --password ******** --action status --door 2
DoorStatusType.CLOSED
Operation took 1 seconds
```

### Toggle Door

Open a closed door and close an open door.

Does not wait for operation to finish so it takes 1s.

```sh
$ python main.py --udi ******** --username ******** --password ******** --action toggle --door 2
True
Operation took 1 seconds
```

### Open Door

Open door with id 2.

```sh
$ python main.py --udi ******** --username ******** --password ******** --action open --door 2
True
Operation took 23 seconds
```

### Close Door

Close door with id 2.

```sh
$ python main.py --udi ******** --username ******** --password ******** --action close --door 2
True
Operation took 26 seconds
```

## How to use

See models.py for class properties.

### Create client

```py
somwebUDI = 1234567  # This is the SOMweb UDI. You can find it under device information
username = "automation" # Your home automation user as configured in SOMweb
password = "super_secret_password" # Your home automation user password

client = SomwebClient(somwebUDI, username, password)
# optionally with ClientSession from aiohttp.client:
client = SomwebClient(somwebUDI, username, password, session)
```

### Alive

```py
# Check that SOMweb device is reachable
is_alive: bool = await client.is_alive()

```

### Authenticate

> ⚠ **Rembember to authenticate before calling any other operation**

is_alive is the only operation not requiring authentication.

```py
auth: AuthResponse = await client.authenticate()
if auth.success:
    ...
else
    ...
```

### Get Doors

```py
doors: List[Door] = client.get_doors()
```

### Door Status

Get status of door with id 2

```py
status: DoorStatusType = await client.get_door_status(2)
```

### Toggle Door

Open a closed door and close an open door.

```py
success: bool = await client.toogle_door_position(door_id)
```

### Open Door

```py
success: bool = await client.open_door(door_id)
```

### Close Door

```py
success: bool = await client.close_door(door_id)
```

### Await Door Status

Call this after opening/closing to wait for the operation to complete.

Will return false if timeout occurs before status is reached (currently 60 seconds).

```py
success: bool = await client.wait_for_door_state(door_id, door_status)
```

Sample usage:

```py
door_id = 2
auth = await client.authenticate()
await client.open_door(door_id):
await client.wait_for_door_state(door_id, DoorStatusType.OPEN)
```

## Build

python setup.py bdist_wheel sdist

pipenv shell
python setup.py upload



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/taarskog/pysomweb",
    "name": "somweb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": "",
    "keywords": "sommer,SOMweb,garage door,home assistant,home automation,heiigjen",
    "author": "Trond Aarskog",
    "author_email": "somweb@heiigjen.com",
    "download_url": "https://files.pythonhosted.org/packages/53/15/56db17abda0044edcbb804879eab2c074c3082f5d052b28a575ef56e356e/somweb-1.1.3.tar.gz",
    "platform": null,
    "description": "\n# SOMweb Client\n\nA client library to control garage door operators produced by [SOMMER](https://www.sommer.eu) through their [SOMweb](https://www.sommer.eu/somweb.html) device.\n\n> \u26a0 It is not enough to have a [supported operator](https://www.sommer.eu/en/somweb.html#kompatibilitaet) to use this package. You also need the SOMWeb device.\n\n## Made for home automation\n\nThe package is created as part of an extension to [Home Assistant](https://www.home-assistant.io/). There are no dependencies and no references to Home Assistant, so you can use the package directly from python or integrate it with any other home automation system.\n\n## Test from terminal\n\nIn all samples replace **\\*\\*\\*\\*** with your values.\n\n### Usage\n\n```sh\n$ python main.py -h\nusage: main.py [-h] --udi UDI --username USERNAME --password PASSWORD --action {alive,auth,get_all,status,open,close,toggle} [--door DOOR_ID]\n\nSOMweb Client.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --udi UDI             SOMweb UID\n  --username USERNAME   SOMweb username\n  --password PASSWORD   SOMweb password\n  --action {alive,auth,get_all,status,open,close,toggle}\n                        SOMweb password\n  --door DOOR_ID        Id of door to perform the following actions on: \"status\", \"open\", \"close\" or \"toggle\"\n```\n\n### Alive\n\nCheck if SOMweb is reachable and responding to requests\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action alive\nTrue\nOperation took 0 seconds\n```\n\n### Authenticate\n\nReturns success, valid token and the html of the front page.\n\n```sh\npython main.py --udi ******** --username ******** --password ******** --action auth\nAuthResponse(success=True, token='...', page_content='...')\nOperation took 1 seconds\n```\n\n### Get Doors\n\nGet all connected doors\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action get_all\n[Door(id='2', name='Garage')]\nOperation took 1 seconds\n```\n\n### Door Status\n\nGet status of door with id 2\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action status --door 2\nDoorStatusType.CLOSED\nOperation took 1 seconds\n```\n\n### Toggle Door\n\nOpen a closed door and close an open door.\n\nDoes not wait for operation to finish so it takes 1s.\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action toggle --door 2\nTrue\nOperation took 1 seconds\n```\n\n### Open Door\n\nOpen door with id 2.\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action open --door 2\nTrue\nOperation took 23 seconds\n```\n\n### Close Door\n\nClose door with id 2.\n\n```sh\n$ python main.py --udi ******** --username ******** --password ******** --action close --door 2\nTrue\nOperation took 26 seconds\n```\n\n## How to use\n\nSee models.py for class properties.\n\n### Create client\n\n```py\nsomwebUDI = 1234567  # This is the SOMweb UDI. You can find it under device information\nusername = \"automation\" # Your home automation user as configured in SOMweb\npassword = \"super_secret_password\" # Your home automation user password\n\nclient = SomwebClient(somwebUDI, username, password)\n# optionally with ClientSession from aiohttp.client:\nclient = SomwebClient(somwebUDI, username, password, session)\n```\n\n### Alive\n\n```py\n# Check that SOMweb device is reachable\nis_alive: bool = await client.is_alive()\n\n```\n\n### Authenticate\n\n> \u26a0 **Rembember to authenticate before calling any other operation**\n\nis_alive is the only operation not requiring authentication.\n\n```py\nauth: AuthResponse = await client.authenticate()\nif auth.success:\n    ...\nelse\n    ...\n```\n\n### Get Doors\n\n```py\ndoors: List[Door] = client.get_doors()\n```\n\n### Door Status\n\nGet status of door with id 2\n\n```py\nstatus: DoorStatusType = await client.get_door_status(2)\n```\n\n### Toggle Door\n\nOpen a closed door and close an open door.\n\n```py\nsuccess: bool = await client.toogle_door_position(door_id)\n```\n\n### Open Door\n\n```py\nsuccess: bool = await client.open_door(door_id)\n```\n\n### Close Door\n\n```py\nsuccess: bool = await client.close_door(door_id)\n```\n\n### Await Door Status\n\nCall this after opening/closing to wait for the operation to complete.\n\nWill return false if timeout occurs before status is reached (currently 60 seconds).\n\n```py\nsuccess: bool = await client.wait_for_door_state(door_id, door_status)\n```\n\nSample usage:\n\n```py\ndoor_id = 2\nauth = await client.authenticate()\nawait client.open_door(door_id):\nawait client.wait_for_door_state(door_id, DoorStatusType.OPEN)\n```\n\n## Build\n\npython setup.py bdist_wheel sdist\n\npipenv shell\npython setup.py upload\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SOMweb client. Open/close Garage doors produced by SOMMER (base+/pro+/tiga/tiga+/barrier systems)",
    "version": "1.1.3",
    "split_keywords": [
        "sommer",
        "somweb",
        "garage door",
        "home assistant",
        "home automation",
        "heiigjen"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "345ba1bec3e88786f69b251feca3b9477f01fd89965440f1a4565c0d426e0351",
                "md5": "f7f154a4b4b4ae73758284030605965a",
                "sha256": "903f41dfe0542c15f5a42f2e10f81c1d0231e426aad4878f37343f7a8f280072"
            },
            "downloads": -1,
            "filename": "somweb-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f7f154a4b4b4ae73758284030605965a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.0",
            "size": 9804,
            "upload_time": "2023-04-10T19:06:50",
            "upload_time_iso_8601": "2023-04-10T19:06:50.647498Z",
            "url": "https://files.pythonhosted.org/packages/34/5b/a1bec3e88786f69b251feca3b9477f01fd89965440f1a4565c0d426e0351/somweb-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "531556db17abda0044edcbb804879eab2c074c3082f5d052b28a575ef56e356e",
                "md5": "3a1c2ceedd2200038c2aade96fef1315",
                "sha256": "a9ef2269bea219c7ba0908930bc99d1319a4c86e214fe346264b3edc9bdd0ab4"
            },
            "downloads": -1,
            "filename": "somweb-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3a1c2ceedd2200038c2aade96fef1315",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 11240,
            "upload_time": "2023-04-10T19:06:51",
            "upload_time_iso_8601": "2023-04-10T19:06:51.973483Z",
            "url": "https://files.pythonhosted.org/packages/53/15/56db17abda0044edcbb804879eab2c074c3082f5d052b28a575ef56e356e/somweb-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 19:06:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "taarskog",
    "github_project": "pysomweb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "somweb"
}
        
Elapsed time: 0.05509s