Skip to main content

Asynchronous Python client for MyLight Systems.

Project description

Python: MyLight Systems API Client

GitHub Release Python Versions Project Stage Project Maintenance License

Build Status Code Coverage

Asynchronous Python client for the MyLight Systems API, enabling programmatic control and monitoring of MyLight Systems solar energy and home automation devices.

Features

๐Ÿ”‹ Device Management - Control and monitor solar panels, batteries, relays, and sensors โšก Real-time Data - Get live power consumption, production, and device states ๐Ÿ  Home Automation - Switch devices on/off and automate energy management ๐Ÿ“Š Energy Monitoring - Track total energy production, consumption, and efficiency metrics ๐Ÿ” Secure Authentication - Token-based API authentication with error handling ๐Ÿš€ Async/Await - Built for modern Python with full async support

Installation

Install from PyPI:

pip install mylightsystems

Quick Start

import asyncio
from mylightsystems.client import MyLightSystemsApiClient

async def main():
    async with MyLightSystemsApiClient() as client:
        # Authenticate
        auth = await client.auth("your_email@example.com", "your_password")

        # Get user profile
        profile = await client.get_profile(auth.token)
        print(f"User: {profile.id} in {profile.city}, {profile.country}")

        # Get all devices
        devices = await client.get_devices(auth.token)
        print(f"Found {len(devices)} devices")

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

API Overview

The client provides methods to interact with all major MyLight Systems endpoints:

Method Description Documentation
auth(email, password) Authenticate and get access token ๐Ÿ“– Auth
get_profile(token) Get user profile information ๐Ÿ“– Profile
get_devices(token) List all connected devices ๐Ÿ“– Devices
get_states(token) Get real-time device states and sensor data ๐Ÿ“– States
get_measures_total(token, device_id) Get total energy measures for a device ๐Ÿ“– Measures
switch(token, device_id, state) Control device on/off state ๐Ÿ“– Switch

Device Types

The library supports all MyLight Systems device types:

  • ๐Ÿ  Master Device (mst) - Main control unit
  • ๐Ÿ”‹ Battery Device (bat) - Energy storage systems
  • ๐Ÿ”Œ Relay Device (sw) - Controllable switches and outlets
  • ๐Ÿ“Š Counter Device (cmp) - Energy measurement devices
  • ๐Ÿ“ˆ Composite Counter (gmd) - Multi-phase energy meters
  • ๐Ÿ’ป Virtual Device (vrt) - Software-defined devices
  • ๐ŸŒ Ethernet Device (eth) - Network-connected devices

Each device type has specific properties and capabilities. See the Device Models documentation for complete details.

Documentation

๐Ÿ“š Complete API Documentation - Comprehensive guide with examples and advanced usage patterns

Quick Links

API Reference

Reference Guides

Use Cases

Perfect for building:

๐Ÿ  Home Energy Management - Real-time monitoring dashboards and automated energy optimization ๐Ÿ”Œ IoT Integration - Home Assistant components, OpenHAB bindings, Node-RED flows ๐Ÿ“Š Energy Analytics - Historical analysis, solar forecasting, cost optimization ๐Ÿค– Smart Automation - Intelligent device control based on production and consumption

See the complete documentation for detailed examples and implementation patterns.

Requirements

  • Python 3.8+
  • aiohttp
  • Modern async/await support

Contributing

We welcome contributions! This project uses modern Python development tools:

  • mise for tool management
  • uv for dependency management
  • ruff for linting and formatting
  • pre-commit for automated checks

Development Setup

# Install mise for tool management
curl https://mise.run | sh

# Set up the project
mise install
mise run project:setup

Development Commands

# Run all checks and tests
mise run precommit:run

# Run tests only
mise run project:tests

# Run linting
mise run project:lint

# Fix linting issues
mise run project:lint-fix

See our Contributing Guidelines for detailed information.

Authors & Contributors

Created and maintained by Pierre-Emmanuel Mercier.

For a full list of contributors, see the contributor's page.

License

This project is licensed under the MIT License - see the LICENSE file for details.


MyLight Systems is a trademark of MyLight Systems SAS. This project is an unofficial client library and is not affiliated with or endorsed by MyLight Systems SAS.

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

mylightsystems-0.0.8.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

mylightsystems-0.0.8-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mylightsystems-0.0.8.tar.gz.

File metadata

  • Download URL: mylightsystems-0.0.8.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mylightsystems-0.0.8.tar.gz
Algorithm Hash digest
SHA256 f53f83d12567a2472d956908f4c775706a1d1082a03566203beca22e9b60aeec
MD5 a8f40af355ec38fc76b4ea25885231ba
BLAKE2b-256 8a3da5657f69062941bd1aab5612a4b49ece34a4dc6fb837cf23144ec7bb4397

See more details on using hashes here.

Provenance

The following attestation bundles were made for mylightsystems-0.0.8.tar.gz:

Publisher: release.yaml on acesyde/python-mylight-systems-api-client

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

File details

Details for the file mylightsystems-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: mylightsystems-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mylightsystems-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e52922f92fcaa71b7c077ebb2e87859a77cac4702a3c9d2d802f8f2459c3b2e5
MD5 ee9b6b3911d6f237fb240471ed2fda91
BLAKE2b-256 c7de00096b4e75f4a5b144cc8cd744cfa00d2fed8ac6277ff35d2394ed312649

See more details on using hashes here.

Provenance

The following attestation bundles were made for mylightsystems-0.0.8-py3-none-any.whl:

Publisher: release.yaml on acesyde/python-mylight-systems-api-client

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