🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis β†’
Socket
Book a DemoInstallSign in
Socket

ta-cmi

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ta-cmi

A Python wrapper to read out sensors from Technische Alternative using the C.M.I.

pipPyPI
Version
3.3.2
Maintainers
1

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 typeInputsOutputsDL-inputsSystem-values: GeneralSystem-values: DateSystem-values: TimeSystem-values: SunSystem-values: Electrical powerAnalog network inputsDigital network inputsM-BusModbusKNXAnalog loggingDigital 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()

Keywords

api

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts