Skip to main content

SOMweb client. Open/close Garage doors produced by SOMMER (base+/pro+/tiga/tiga+/barrier systems)

Project description

SOMweb Client

A client library to control garage door operators produced by SOMMER through their SOMweb device.

⚠ It is not enough to have a supported operator 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. 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

# If installed (or cd into src and do python main.py -h if testing during dev)
$ somweb -h
usage: main.py [-h] (--udi UDI | --url URL) --username USERNAME --password PASSWORD --action {alive,auth,is_admin,update_available,device_info,get_udi,get_all,status,open,close,toggle} [--door DOOR_ID]

SOMweb Client.

options:
  -h, --help            show this help message and exit
  --udi UDI             SOMweb UID (access through cloud service)
  --url URL             SOMweb URL (direct local access)
  --username USERNAME   SOMweb username
  --password PASSWORD   SOMweb password
  --action {alive,auth,is_admin,update_available,device_info,get_udi,get_all,status,open,close,toggle}
                        Action to take
  --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

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

Same using direct local access

$ python main.py --url http://192.168.10.10 --username ******** --password ******** --action alive
True
Operation took 0 seconds

Replace IP with your SOMweb device IP or FQDN.

Is Admninistrator

$ python main.py --url http://192.168.10.10 --username ******** --password ******** --action is_admin
True
Operation took 1 seconds

Replace IP with your SOMweb device IP or FQDN.

Firmware Update Available

$ python main.py --url http://192.168.10.10 --username ******** --password ******** --action update_available
False
Operation took 1 seconds

Replace IP with your SOMweb device IP or FQDN.

Device Info

$ python main.py --url http://192.168.10.10 --username ******** --password ******** --action device_info
DeviceInfo(remote_access_enabled=True, firmware_version='2.8.3', ip_address='192.168.10.10', wifi_signal_quality='4', wifi_signal_level='-58', wifi_signal_unit='dBm', time_zone='Europe/Oslo')
Operation took 3 seconds

Replace IP with your SOMweb device IP or FQDN.

UDI

Get Device UDI

$ python main.py --url http://192.168.10.10 --username ******** --password ******** --action get_udi
**********
Operation took 1 seconds

Replace IP with your SOMweb device IP or FQDN.

Authenticate

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

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

Get Doors

Get all connected doors

$ 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

$ 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.

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

Open Door

Open door with id 2.

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

Close Door

Close door with id 2.

$ 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

With UDI (aka connecting through cloud service)

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.createUsingUdi(somwebUDI, username, password)
# optionally with ClientSession from aiohttp.client:
client = SomwebClient.createUsingUdi(somwebUDI, username, password, session)

With IP or FQDN (aka connecting directly)

somwebUri = http://192.168.10.10  # This is the SOMweb device IP or FQDN on the local network (could also be the FQDN to the cloud service).
username = "automation" # Your home automation user as configured in SOMweb
password = "super_secret_password" # Your home automation user password

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

Alive

# 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.

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

Admin

is_admin: bool = client.is_admin

Firmware Update Available

update_available: bool = await client.async_update_available()

Firmware Update Available

device_info: DeviceInfo = await client.async_get_device_info()

UDI

# The SOMweb device UDI
udi: str = client.udi

Get Doors

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

Door Status

Get status of door with id 2

status: DoorStatusType = await client.get_door_status(2)

Toggle Door

Open a closed door and close an open door.

success: bool = await client.toogle_door_position(door_id)

Open Door

success: bool = await client.open_door(door_id)

Close Door

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).

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

Sample usage:

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

Build

# Make sure you have the latest version of PyPA’s build installed:
python3 -m pip install --upgrade build

# Run this command from the same directory where pyproject.toml is located:
python3 -m build

#
# Manual upload to Test PyPi (not preferred approach - use Github Workflow)
#
python3 -m pip install --upgrade twine
python3 -m twine upload --repository testpypi dist/*

Note. When uploading to pypi you use an API token so the username and pwd are as follows:

Username: __token__
Password: pypi-<yourtoken>

The above can be put in file $HOME/.pypirc looking like this:

[testpypi]
  username = __token__
  password = pypi-<yourtoken>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

somweb-1.3.3b4.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

somweb-1.3.3b4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file somweb-1.3.3b4.tar.gz.

File metadata

  • Download URL: somweb-1.3.3b4.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for somweb-1.3.3b4.tar.gz
Algorithm Hash digest
SHA256 6d4c362f7bab2260196a7ef6b1a13841c740d4ef6a109235d6be59f53f0d6bb6
MD5 585ff334f908b441b496cc2e02c74d91
BLAKE2b-256 456e7d46c42e9609712840d646083a8b961bf5215db7968e9f11e8316ff7cd1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for somweb-1.3.3b4.tar.gz:

Publisher: publish-to-pypi.yml on taarskog/pySOMweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file somweb-1.3.3b4-py3-none-any.whl.

File metadata

  • Download URL: somweb-1.3.3b4-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for somweb-1.3.3b4-py3-none-any.whl
Algorithm Hash digest
SHA256 7f70aaa80d10387b334e156be2098e4f652e2fee08b136cbf34cee3e540328d5
MD5 4f3d85f86689b8a3e81be90aa504c9eb
BLAKE2b-256 0294193654fbff428108501a813a1ffbe1f5e23bd54f8cfb016985e3d3c7fcd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for somweb-1.3.3b4-py3-none-any.whl:

Publisher: publish-to-pypi.yml on taarskog/pySOMweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page