Skip to main content

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

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.

Metadata

Release files for mylightsystems 0.0.9

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

Source distribution (sdist)

Source distribution for mylightsystems 0.0.9
File Size Uploaded Provenance Actions
mylightsystems-0.0.9.tar.gz 10.1 kB With provenance Details for mylightsystems-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mylightsystems 0.0.9
File Interpreter ABI Platform Actions
mylightsystems-0.0.9-py3-none-any.whl Python 3 none any Details for mylightsystems-0.0.9-py3-none-any.whl

Total release size: 19.4 kB

Release files / mylightsystems-0.0.9.tar.gz

Download URL mylightsystems-0.0.9.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9ca8e0d0d75bdc9fe19a6730a2ddef0ec576859f8613444e9bd1e17a6167d709
BLAKE2b-256 checksum
How to use checksums
255396679065d2fc45e3398718da590203271eda3e4d5f385f38af9f3a7d6a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2025.

Transparency log

Release files / mylightsystems-0.0.9-py3-none-any.whl

Download URL mylightsystems-0.0.9-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45e2d91988ea17a1b8b05807807767c676f99302292ff2620e5fafd7f7ff9281
BLAKE2b-256 checksum
How to use checksums
d7f98d21286f15cb5f57822289f8d1192ab06a3aff96a610ed3601e4fb3a55bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2025.

Transparency log

Security for mylightsystems 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mylightsystems-0.0.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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