mylightsystems


Namemylightsystems JSON
Version 0.0.9 PyPI version JSON
download
home_pageNone
SummaryAsynchronous Python client for MyLight Systems.
upload_time2025-08-09 16:45:31
maintainerPierre-Emmanuel Mercier
docs_urlNone
authorPierre-Emmanuel Mercier
requires_python>=3.13
licenseMIT
keywords mylight systems api async client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python: MyLight Systems API Client

[![GitHub Release][releases-shield]][releases]
[![Python Versions][python-versions-shield]][pypi]
![Project Stage][project-stage-shield]
![Project Maintenance][maintenance-shield]
[![License][license-shield]](.github/LICENSE.md)

[![Build Status][build-shield]][build]
[![Code Coverage][codecov-shield]][codecov]

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:

```bash
pip install mylightsystems
```

## Quick Start

```python
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](docs/auth.md)                   |
| `get_profile(token)`                   | Get user profile information                | [📖 Profile](docs/get_profile.md)         |
| `get_devices(token)`                   | List all connected devices                  | [📖 Devices](docs/get_devices.md)         |
| `get_states(token)`                    | Get real-time device states and sensor data | [📖 States](docs/get_states.md)           |
| `get_measures_total(token, device_id)` | Get total energy measures for a device      | [📖 Measures](docs/get_measures_total.md) |
| `switch(token, device_id, state)`      | Control device on/off state                 | [📖 Switch](docs/switch.md)               |

## 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](docs/models.md) documentation for complete details.

## Documentation

📚 **[Complete API Documentation](docs/index.md)** - Comprehensive guide with examples and advanced usage patterns

### Quick Links
- **[Getting Started](docs/index.md#quick-start)** - Complete setup and usage examples
- **[Advanced Usage](docs/index.md#advanced-usage)** - Energy monitoring, automation, and health monitoring
- **[Error handling](docs/index.md#error-handling)** - Comprehensive error handling patterns
- **[Retry Patterns](docs/index.md#retry-and-resilience-patterns)** - Production-ready resilience strategies

### API Reference
- [Authentication](docs/auth.md) - Login and token management
- [User Profile](docs/get_profile.md) - Get account information
- [Device Management](docs/get_devices.md) - List and identify devices
- [Device States](docs/get_states.md) - Real-time monitoring
- [Energy Measures](docs/get_measures_total.md) - Total energy data
- [Device Control](docs/switch.md) - Switch devices on/off

### Reference Guides
- [Data Models](docs/models.md) - All data structures and fields
- [Exception Handling](docs/exceptions.md) - Error types and handling patterns

## 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](docs/index.md) 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](https://mise.jdx.dev/)** for tool management
- **[uv](https://docs.astral.sh/uv/)** for dependency management
- **[ruff](https://docs.astral.sh/ruff/)** for linting and formatting
- **[pre-commit](https://pre-commit.com/)** for automated checks

### Development Setup

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

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

### Development Commands

```bash
# 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](.github/CONTRIBUTING.md) for detailed information.

## Authors & Contributors

Created and maintained by [Pierre-Emmanuel Mercier][acesyde].

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

## License

This project is licensed under the MIT License - see the [LICENSE](.github/LICENSE.md) 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.

[build-shield]: https://github.com/acesyde/python-mylight-systems-api-client/actions/workflows/tests.yaml/badge.svg
[build]: https://github.com/acesyde/python-mylight-systems-api-client/actions
[codecov-shield]: https://codecov.io/gh/acesyde/python-mylight-systems-api-client/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/acesyde/python-mylight-systems-api-client
[contributors]: https://github.com/acesyde/python-mylight-systems-api-client/graphs/contributors
[acesyde]: https://github.com/acesyde
[license-shield]: https://img.shields.io/github/license/acesyde/python-mylight-systems-api-client.svg
[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg
[project-stage-shield]: https://img.shields.io/badge/project%20stage-stable-green.svg
[python-versions-shield]: https://img.shields.io/pypi/pyversions/mylightsystems
[releases-shield]: https://img.shields.io/github/release/acesyde/python-mylight-systems-api-client.svg
[releases]: https://github.com/acesyde/python-mylight-systems-api-client/releases
[pypi]: https://pypi.org/project/mylightsystems/


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mylightsystems",
    "maintainer": "Pierre-Emmanuel Mercier",
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": "acesyde@gmail.com",
    "keywords": "MyLight Systems, api, async, client",
    "author": "Pierre-Emmanuel Mercier",
    "author_email": "acesyde@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/25/53/96679065d2fc45e3398718da590203271eda3e4d5f385f38af9f3a7d6a23/mylightsystems-0.0.9.tar.gz",
    "platform": null,
    "description": "# Python: MyLight Systems API Client\n\n[![GitHub Release][releases-shield]][releases]\n[![Python Versions][python-versions-shield]][pypi]\n![Project Stage][project-stage-shield]\n![Project Maintenance][maintenance-shield]\n[![License][license-shield]](.github/LICENSE.md)\n\n[![Build Status][build-shield]][build]\n[![Code Coverage][codecov-shield]][codecov]\n\nAsynchronous Python client for the MyLight Systems API, enabling programmatic control and monitoring of MyLight Systems solar energy and home automation devices.\n\n## Features\n\n\ud83d\udd0b **Device Management** - Control and monitor solar panels, batteries, relays, and sensors\n\u26a1 **Real-time Data** - Get live power consumption, production, and device states\n\ud83c\udfe0 **Home Automation** - Switch devices on/off and automate energy management\n\ud83d\udcca **Energy Monitoring** - Track total energy production, consumption, and efficiency metrics\n\ud83d\udd10 **Secure Authentication** - Token-based API authentication with error handling\n\ud83d\ude80 **Async/Await** - Built for modern Python with full async support\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install mylightsystems\n```\n\n## Quick Start\n\n```python\nimport asyncio\nfrom mylightsystems.client import MyLightSystemsApiClient\n\nasync def main():\n    async with MyLightSystemsApiClient() as client:\n        # Authenticate\n        auth = await client.auth(\"your_email@example.com\", \"your_password\")\n\n        # Get user profile\n        profile = await client.get_profile(auth.token)\n        print(f\"User: {profile.id} in {profile.city}, {profile.country}\")\n\n        # Get all devices\n        devices = await client.get_devices(auth.token)\n        print(f\"Found {len(devices)} devices\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## API Overview\n\nThe client provides methods to interact with all major MyLight Systems endpoints:\n\n| Method                                 | Description                                 | Documentation                            |\n| -------------------------------------- | ------------------------------------------- | ---------------------------------------- |\n| `auth(email, password)`                | Authenticate and get access token           | [\ud83d\udcd6 Auth](docs/auth.md)                   |\n| `get_profile(token)`                   | Get user profile information                | [\ud83d\udcd6 Profile](docs/get_profile.md)         |\n| `get_devices(token)`                   | List all connected devices                  | [\ud83d\udcd6 Devices](docs/get_devices.md)         |\n| `get_states(token)`                    | Get real-time device states and sensor data | [\ud83d\udcd6 States](docs/get_states.md)           |\n| `get_measures_total(token, device_id)` | Get total energy measures for a device      | [\ud83d\udcd6 Measures](docs/get_measures_total.md) |\n| `switch(token, device_id, state)`      | Control device on/off state                 | [\ud83d\udcd6 Switch](docs/switch.md)               |\n\n## Device Types\n\nThe library supports all MyLight Systems device types:\n\n- **\ud83c\udfe0 Master Device** (`mst`) - Main control unit\n- **\ud83d\udd0b Battery Device** (`bat`) - Energy storage systems\n- **\ud83d\udd0c Relay Device** (`sw`) - Controllable switches and outlets\n- **\ud83d\udcca Counter Device** (`cmp`) - Energy measurement devices\n- **\ud83d\udcc8 Composite Counter** (`gmd`) - Multi-phase energy meters\n- **\ud83d\udcbb Virtual Device** (`vrt`) - Software-defined devices\n- **\ud83c\udf10 Ethernet Device** (`eth`) - Network-connected devices\n\nEach device type has specific properties and capabilities. See the [Device Models](docs/models.md) documentation for complete details.\n\n## Documentation\n\n\ud83d\udcda **[Complete API Documentation](docs/index.md)** - Comprehensive guide with examples and advanced usage patterns\n\n### Quick Links\n- **[Getting Started](docs/index.md#quick-start)** - Complete setup and usage examples\n- **[Advanced Usage](docs/index.md#advanced-usage)** - Energy monitoring, automation, and health monitoring\n- **[Error handling](docs/index.md#error-handling)** - Comprehensive error handling patterns\n- **[Retry Patterns](docs/index.md#retry-and-resilience-patterns)** - Production-ready resilience strategies\n\n### API Reference\n- [Authentication](docs/auth.md) - Login and token management\n- [User Profile](docs/get_profile.md) - Get account information\n- [Device Management](docs/get_devices.md) - List and identify devices\n- [Device States](docs/get_states.md) - Real-time monitoring\n- [Energy Measures](docs/get_measures_total.md) - Total energy data\n- [Device Control](docs/switch.md) - Switch devices on/off\n\n### Reference Guides\n- [Data Models](docs/models.md) - All data structures and fields\n- [Exception Handling](docs/exceptions.md) - Error types and handling patterns\n\n## Use Cases\n\nPerfect for building:\n\n\ud83c\udfe0 **Home Energy Management** - Real-time monitoring dashboards and automated energy optimization\n\ud83d\udd0c **IoT Integration** - Home Assistant components, OpenHAB bindings, Node-RED flows\n\ud83d\udcca **Energy Analytics** - Historical analysis, solar forecasting, cost optimization\n\ud83e\udd16 **Smart Automation** - Intelligent device control based on production and consumption\n\nSee the [complete documentation](docs/index.md) for detailed examples and implementation patterns.\n\n## Requirements\n\n- Python 3.8+\n- aiohttp\n- Modern async/await support\n\n## Contributing\n\nWe welcome contributions! This project uses modern Python development tools:\n\n- **[mise](https://mise.jdx.dev/)** for tool management\n- **[uv](https://docs.astral.sh/uv/)** for dependency management\n- **[ruff](https://docs.astral.sh/ruff/)** for linting and formatting\n- **[pre-commit](https://pre-commit.com/)** for automated checks\n\n### Development Setup\n\n```bash\n# Install mise for tool management\ncurl https://mise.run | sh\n\n# Set up the project\nmise install\nmise run project:setup\n```\n\n### Development Commands\n\n```bash\n# Run all checks and tests\nmise run precommit:run\n\n# Run tests only\nmise run project:tests\n\n# Run linting\nmise run project:lint\n\n# Fix linting issues\nmise run project:lint-fix\n```\n\nSee our [Contributing Guidelines](.github/CONTRIBUTING.md) for detailed information.\n\n## Authors & Contributors\n\nCreated and maintained by [Pierre-Emmanuel Mercier][acesyde].\n\nFor a full list of contributors, see [the contributor's page][contributors].\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](.github/LICENSE.md) file for details.\n\n---\n\n**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.\n\n[build-shield]: https://github.com/acesyde/python-mylight-systems-api-client/actions/workflows/tests.yaml/badge.svg\n[build]: https://github.com/acesyde/python-mylight-systems-api-client/actions\n[codecov-shield]: https://codecov.io/gh/acesyde/python-mylight-systems-api-client/branch/master/graph/badge.svg\n[codecov]: https://codecov.io/gh/acesyde/python-mylight-systems-api-client\n[contributors]: https://github.com/acesyde/python-mylight-systems-api-client/graphs/contributors\n[acesyde]: https://github.com/acesyde\n[license-shield]: https://img.shields.io/github/license/acesyde/python-mylight-systems-api-client.svg\n[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg\n[project-stage-shield]: https://img.shields.io/badge/project%20stage-stable-green.svg\n[python-versions-shield]: https://img.shields.io/pypi/pyversions/mylightsystems\n[releases-shield]: https://img.shields.io/github/release/acesyde/python-mylight-systems-api-client.svg\n[releases]: https://github.com/acesyde/python-mylight-systems-api-client/releases\n[pypi]: https://pypi.org/project/mylightsystems/\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Asynchronous Python client for MyLight Systems.",
    "version": "0.0.9",
    "project_urls": {
        "Bug Tracker": "https://github.com/acesyde/python-mylight-systems-api-client/issues",
        "Changelog": "https://github.com/acesyde/python-mylight-systems-api-client/releases",
        "Documentation": "https://github.com/acesyde/python-mylight-systems-api-client",
        "Homepage": "https://github.com/acesyde/python-mylight-systems-api-client",
        "Repository": "https://github.com/acesyde/python-mylight-systems-api-client"
    },
    "split_keywords": [
        "mylight systems",
        " api",
        " async",
        " client"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d7f98d21286f15cb5f57822289f8d1192ab06a3aff96a610ed3601e4fb3a55bb",
                "md5": "1829dda7c7c6856d4d9b8e4cca59f941",
                "sha256": "45e2d91988ea17a1b8b05807807767c676f99302292ff2620e5fafd7f7ff9281"
            },
            "downloads": -1,
            "filename": "mylightsystems-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1829dda7c7c6856d4d9b8e4cca59f941",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 9338,
            "upload_time": "2025-08-09T16:45:29",
            "upload_time_iso_8601": "2025-08-09T16:45:29.711491Z",
            "url": "https://files.pythonhosted.org/packages/d7/f9/8d21286f15cb5f57822289f8d1192ab06a3aff96a610ed3601e4fb3a55bb/mylightsystems-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "255396679065d2fc45e3398718da590203271eda3e4d5f385f38af9f3a7d6a23",
                "md5": "02cf7fd62a33aad53be8af5750826461",
                "sha256": "9ca8e0d0d75bdc9fe19a6730a2ddef0ec576859f8613444e9bd1e17a6167d709"
            },
            "downloads": -1,
            "filename": "mylightsystems-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "02cf7fd62a33aad53be8af5750826461",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 10060,
            "upload_time": "2025-08-09T16:45:31",
            "upload_time_iso_8601": "2025-08-09T16:45:31.186799Z",
            "url": "https://files.pythonhosted.org/packages/25/53/96679065d2fc45e3398718da590203271eda3e4d5f385f38af9f3a7d6a23/mylightsystems-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 16:45:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "acesyde",
    "github_project": "python-mylight-systems-api-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mylightsystems"
}
        
Elapsed time: 2.36155s