Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Python Elmax API client

Elmax Logo

Asynchronous Python API client for interacting with the Elmax Cloud services, via HTTP apis.

Release Build Status Testing Status Documentation

Installation

Use the package manager pip to install Python Elmax API client:

$ pip3 install elmax-api --user

or, to install it globally, use the following command

$ pip3 install elmax-api

Usage

import asyncio

from elmax_api.http import Elmax
from elmax_api.model.command import SwitchCommand

MY_USERNAME = 'TYPE_HERE_YOUR_ELMAX_EMAIL'
MY_PASSWORD = 'TYPE_HERE_YOUR_ELMAX_PASSWORD'


async def main():
    # Instantiate the Elmax API client
    client = Elmax(username=MY_USERNAME, password=MY_PASSWORD)

    # List panels for your user
    panels = await client.list_control_panels()
    print(f"Found {len(panels)} panels for user {client.get_authenticated_username()}")

    # Get online panels only
    online_panels = []
    for p in panels:
        status = 'ONLINE' if p.online else 'OFFLINE'
        print(f"+ {p.hash}: {status}")
        if p.online:
            online_panels.append(p)

    if len(online_panels) == 0:
        print("Sorry, no panel to work with. Exiting.")
        exit(0)

    # Fetch status of first panel
    p = online_panels[0]
    panel_status = await client.get_panel_status(control_panel_id=p.hash)

    # Print some zone status
    for z in panel_status.zones:
        print(f"Zone '{z.name}' open: {z.opened}")

    # Toggle some actuator
    actuator = panel_status.actuators[0]
    old_status = actuator.opened
    print(f"Actuator {actuator.name} was {'ON' if old_status else 'OFF'}")
    print(f"Switching {'OFF' if old_status else 'ON'} actuator {actuator.name}")
    await client.execute_command(endpoint_id=actuator.endpoint_id, command=SwitchCommand.TURN_ON if not old_status else SwitchCommand.TURN_OFF)

    print("Waiting a bit...")
    await asyncio.sleep(5)

    print("Reverting back original actuator status")
    await client.execute_command(endpoint_id=actuator.endpoint_id,
                                 command=SwitchCommand.TURN_ON if old_status else SwitchCommand.TURN_OFF)
    print("Done!")

if __name__ == '__main__':
    asyncio.run(main())

Documentation

Full API documentation is available on GitHub pages, here.

Metadata

Release files for elmax-api 0.0.3rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elmax-api 0.0.3rc2
File Size Uploaded
elmax_api-0.0.3rc2.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elmax-api 0.0.3rc2
File Interpreter ABI Platform
elmax_api-0.0.3rc2-py3-none-any.whl Python 3 none any Details

Total release size: 28.3 kB

Release files / elmax_api-0.0.3rc2.tar.gz

Download URL elmax_api-0.0.3rc2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
625059094838d208c8dfa4209ca0f47a3a85a39a5b1b1410b902e5765bbb3a6d
BLAKE2b-256 checksum
How to use checksums
e99303f8779e1c953dcc68c3dbd6d20ee2e35c538fb149e76237675643e54c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / elmax_api-0.0.3rc2-py3-none-any.whl

Download URL elmax_api-0.0.3rc2-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9107a857c16852090ce0d7ecfd1c50e9ef73af631b48e5221ef6bf04dc9e0de2
BLAKE2b-256 checksum
How to use checksums
a48b4cfdff331b5fdcbb5876afa8f0bab992fa8ec0f083bc11fd545ad0d2996f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page