A Python wrapper to read out sensors from Technische Alternative using the C.M.I.
Project description
TA-CMI
A Python wrapper to read out sensors from Technische Alternative using the C.M.I.
How to use package
Json API
import asyncio
from ta_cmi import CMI, Languages, ApiError, RateLimitError, InvalidCredentialsError, InvalidDeviceError, ChannelType
async def main():
try:
cmi = CMI("http://192.168.1.101", "admin", "admin")
devices = await cmi.get_devices()
device = devices[0]
# Set type automatically
await device.fetch_type()
# Set type manually
device.set_device_type("UVR16x2")
await device.update()
print(str(device))
inputChannels = device.get_channels(ChannelType.INPUT)
outputChannels = device.get_channels(ChannelType.OUTPUT)
analogLogging = device.get_channels(ChannelType.ANALOG_LOGGING)
for i in inputChannels:
ch = inputChannels.get(i)
print(str(ch))
for o in outputChannels:
ch = outputChannels.get(o)
print(f"{str(ch)} - {ch.get_unit(Languages.DE)}")
for al in analogLogging:
ch = analogLogging.get(al)
print(f"{str(ch)} - {ch.get_unit(Languages.DE)}")
except (ApiError, RateLimitError, InvalidCredentialsError, InvalidDeviceError) as error:
print(f"Error: {error}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
Supported data types
| Device type | Inputs | Outputs | DL-inputs | System-values: General | System-values: Date | System-values: Time | System-values: Sun | System-values: Electrical power | Analog network inputs | Digital network inputs | M-Bus | Modbus | KNX | Analog logging | Digital logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UVR1611 | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ |
| UVR16x2 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ✔ |
| RSM610 | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ❌ | ❌ | ❌ | ❌ |
| CAN-I/O45 | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| CAN-EZ2 | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| CAN-MTx2 | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| CAN-BC2 | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ |
| UVR65 | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| CAN-EZ3 | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ✔ | ❌ | ✔ | ✔ |
| UVR610 | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ✔ | ❌ | ✔ | ✔ |
| UVR67 | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Note The supported data types may differ from the official API. If a device type supports other data types than listed here, please create an issue.
CoE Server
Data can be retrieved using this CoE to HTTP server
import asyncio
from ta_cmi import (
ApiError,
ChannelMode,
CoE,
InvalidCredentialsError,
InvalidDeviceError,
Languages,
RateLimitError,
)
async def main():
try:
coe = CoE("http://192.168.2.201:9000")
can_id = 42
await coe.update(can_id)
analog_channels = coe.get_channels(can_id, ChannelMode.ANALOG)
digital_channels = coe.get_channels(can_id, ChannelMode.DIGITAL)
for i in analog_channels:
ch = analog_channels.get(i)
print(str(ch))
for o in digital_channels:
ch = digital_channels.get(o)
print(f"{str(ch)} - {ch.get_unit(Languages.DE)}")
except (ApiError, RateLimitError, InvalidCredentialsError, InvalidDeviceError) as error:
print(f"Error: {error}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ta_cmi-3.6.3.tar.gz.
File metadata
- Download URL: ta_cmi-3.6.3.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f53456828393cbf694c687b24a66abbeae13de98064da2983bfe08ca6f68fd5
|
|
| MD5 |
1fc6ea71826c22c68bdd72b9e72434ad
|
|
| BLAKE2b-256 |
4ddc12c31cbc4b2690a4e06218a2fa50a99fa542bb5b9a0cff0478aee148fe7a
|
File details
Details for the file ta_cmi-3.6.3-py3-none-any.whl.
File metadata
- Download URL: ta_cmi-3.6.3-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27c2b566ec35c8efe59e5534a6a22539733d2f9c4f59832d08d75c37f15951b5
|
|
| MD5 |
07a4445033d8c2ecb06ec4b290a1ad8d
|
|
| BLAKE2b-256 |
6571dbe54c5b0e700d1a1b290c47be1a3698878bd1839461702106ba8ee2a3fb
|