Python client for Mobilus Cosmo GTW
Project description
Mobilus Cosmo GTW Client
This code provides a native Python client for the Mobilus Cosmo GTW. It connects directly to the gateway's MQTT broker and sends message commands to control the associated devices. The connection is established locally, so the client must be run on the same network as the gateway. Note: internet access is not required and can be disabled on the device.
Currently, the only tested and supported devices are radio shutters (Mobilus COSMO 2WAY).
In order to use the client, configuration and setup need to be done on the Mobilus Cosmo GTW side. This includes creating a user and pairing the devices with the gateway.
More information can be found on blog post.
Installation
Install the module with pip:
pip install mobilus-client
Usage
For convenience, the client can be run as a module:
python -m mobilus_client --host=GATEWAY_HOST --login=USER_LOGIN --password=USER_PASSWORD COMMANDS
Where:
GATEWAY_HOST
is the IP address of the gateway.USER_LOGIN
andUSER_PASSWORD
are the user credentials to access the gateway.COMMANDS
is a list of commands to be sent to the gateway.
Currently, the following commands are supported:
-
current_state
- Get the current state of the devices. Please note that in the case of shutters, the state may be delayed, especially when the shutter is controlled by a physical switch. -
devices_list
- List all devices that are paired with the gateway. -
call_events:device_id=DEVICE_ID,value=VALUE
- Send a command to the device. This can be used for actual control of the device (shutter).DEVICE_ID
- The ID of the device as returned from devices_list.VALUE
- The value to be sent to the device, currently one of "UP", "DOWN", "STOP", or a percentage value like "85%".
Multiple commands can be sent at once, separated by spaces:
python -m mobilus_client --host=192.168.2.1 --login=admin --password=my_password devices_list call_events:device_id=0,value=100% call_events:device_id=1,value=80%
Output is printed to the console in JSON format, and therefore the client command can be easily chained with jq
for prettier output. For example:
python -m mobilus_client --host=192.168.2.1 --login=admin --password=my_password current_state | jq
Verbose mode can be enabled with the --verbose
flag:
python -m mobilus_client --host=192.168.2.1 --login=admin --password=my_password --verbose current_state
Caveats
The client is tested with Mobilus Cosmo GTW with shutter devices only (COSMO 2WAY). It is possible that it will work with other devices, but it is not guaranteed. The purpose of the client is to provide a simple way to control the devices without the need to use the official Mobilus Cosmo GTW web interface or app, and to integrate it with open-source systems like Home Assistant. I am not affiliated with Mobilus, and the client is provided as is.
Development
Clone the repository and navigate to the project directory. Install the package in editable mode with the following command:
pip install -e .[test]
Check mypy and ruff with the following commands:
mypy .
ruff check
The tests can be run with the following command:
python -m unittest -v
To generate a coverage report:
coverage run -m unittest discover
coverage report -m
To regenerate proto files
docker-compose up --build -f scripts/docker-compose.yml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mobilus_client-0.1.7.tar.gz
.
File metadata
- Download URL: mobilus_client-0.1.7.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99163cdaec16eb49f2ca27b651d81891fc7d90a325c924337e11249e9af41f13 |
|
MD5 | 6b3c20d105062ebbadc4de740f996edd |
|
BLAKE2b-256 | 5aee86cdd371cc7739aee6184c2aacbe544c7caf86fe3b8076ea40d9472e8056 |
Provenance
The following attestation bundles were made for mobilus_client-0.1.7.tar.gz
:
Publisher:
publish.yml
on zpieslak/mobilus-client
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mobilus_client-0.1.7.tar.gz
- Subject digest:
99163cdaec16eb49f2ca27b651d81891fc7d90a325c924337e11249e9af41f13
- Sigstore transparency entry: 150000745
- Sigstore integration time:
- Predicate type:
File details
Details for the file mobilus_client-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: mobilus_client-0.1.7-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 541f308f21b98972ee0f5e8267a8b138ae2ed6d71be46ba76fee5633cf65d4b4 |
|
MD5 | c27cc3ceccb166198202a4691ad07673 |
|
BLAKE2b-256 | d58b4b71b9dc8f6bee5a0074c90f6599de7cc87f2c3bb2fe97a72e9dc18f483b |
Provenance
The following attestation bundles were made for mobilus_client-0.1.7-py3-none-any.whl
:
Publisher:
publish.yml
on zpieslak/mobilus-client
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mobilus_client-0.1.7-py3-none-any.whl
- Subject digest:
541f308f21b98972ee0f5e8267a8b138ae2ed6d71be46ba76fee5633cf65d4b4
- Sigstore transparency entry: 150000750
- Sigstore integration time:
- Predicate type: