pyheos


Namepyheos JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
SummaryAn async python library for controlling HEOS devices through the HEOS CLI Protocol
upload_time2025-03-21 21:34:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseASL 2.0
keywords heos dennon maranz
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ![pyheos](assets/pyheos-logo.png "pyheos - An asynchronous Python library for controlling Denon and Marantz products with HEOSĀ® Built-in")

[![CI Status](https://github.com/andrewsayre/pyheos/workflows/CI/badge.svg)](https://github.com/andrewsayre/pyheos/actions)
[![codecov](https://codecov.io/github/andrewsayre/pyheos/graph/badge.svg?token=PV4P3AN7Z1)](https://codecov.io/github/andrewsayre/pyheos)
[![image](https://img.shields.io/pypi/v/pyheos.svg)](https://pypi.org/project/pyheos/)
[![image](https://img.shields.io/pypi/pyversions/pyheos.svg)](https://pypi.org/project/pyheos/)
[![image](https://img.shields.io/pypi/l/pyheos.svg)](https://pypi.org/project/pyheos/)

An asynchronous Python library for controlling Denon and Marantz products with HEOSĀ® Built-in through the HEOS CLI Protocol (version 1.21 for HEOS firmware 3.40 or newer).

## Installation

```bash
pip install pyheos
```

## Getting Started

### `Heos` class

The `Heos` class is the implementation providing control to all HEOS compatible devices on the local network through a single network connection. It is suggested to connect to a device that is hard-wired.

#### `pyheos.Heos.create_and_connect(host: str, **kwargs) -> Heos`

Coroutine that accepts the host and options arguments (as defined in the `pyheos.HeosOptions` below), creates an instance of `Heos` and connects, returning the instance.

#### `pyheos.Heos(options: HeosOptions)`

- `options: HeosOptions`: An instance of HeosOptions that encapsulates options and configuration (see below)

#### `pyheos.Heos.connect() -> None`

Connect to the specified host. This method is a coroutine.

#### `pyheos.Heos.disconnect() -> None`

Disconnect from the specified host. This method is a coroutine.

#### `pyheos.Heos.get_players(*, refresh)`

Retrieve the available players as a `dict[int, pyheos.Heos.HeosPlayer]` where the key represents the `player_id` and the value the `HeosPlayer` instance. This method is a coroutine. This method will populate the `players` property and will begin tracking changes to the players.

- `refresh`: Set to `True` to retrieve the latest available players from the CLI. The default is `False` and will return the previous loaded players.

### `HeosOptions` class

This class encapsulates the options and configuration for connecting to a HEOS system.

#### `pyheos.HeosOptions(host, *, timeout, heart_beat, heart_beat_interval, dispatcher, auto_reconnect, auto_reconnect_delay, auto_reconnect_max_attempts, credentials)`

- `host: str`: A host name or IP address of a HEOS-capable device. This parameter is required.
- `timeout: float`: The timeout in seconds for opening a connection and issuing commands to the device. Default is `pyheos.const.DEFAULT_TIMEOUT = 15.0`. This parameter is required.
- `heart_beat: bool`: Set to `True` to enable heart beat messages, `False` to disable. Used in conjunction with `heart_beat_delay`. The default is `True`.
- `heart_beat_interval: float`: The interval in seconds between heart beat messages. Used in conjunction with `heart_beat`. Default is `pyheos.const.DEFAULT_HEART_BEAT = 10.0`
- `events: bool`: Set to `True` to enable event updates, `False` to disable. The default is `True`.
- `all_progress_events: bool`: Set to `True` to receive media progress events, `False` to only receive media changed events. The default is `True`.
- `dispatcher: pyheos.Dispatcher | None`: The dispatcher instance to use for event callbacks. If not provided, an internally created instance will be used.
- `auto_failover: bool`: Set to True to automatically failover to other hosts if the connection is lost. The default is False. Used in conjunction with `auto_failover_hosts`.
- `auto_failover_hosts: Sequence[str]`: A sequence of host names or IP addresses of other hosts in the HEOS system. The default is an empty list, which will be populated automatically from the system information.
- `auto_reconnect: bool`: Set to `True` to automatically reconnect if the connection is lost. The default is `False`. Used in conjunction with `auto_reconnect_delay`.
- `auto_reconnect_delay: float`: The number of seconds to wait before attempting to reconnect upon a connection failure. The default is `DEFAULT_RECONNECT_DELAY = 1.0`. Used in conjunction with `auto_reconnect`.
- `auto_reconnect_max_attempts: float`: The maximum number of reconnection attempts before giving up. Set to `0` for unlimited attempts. The default is `0` (unlimited).
- `credentials`: credentials to use to automatically sign-in to the HEOS account upon successful connection. If not provided, the account will not be signed in.

##### Example:

```python
import pyheos

heos = await Heos.create_and_connect('172.16.0.1', auto_reconnect=True)

players = await heos.get_players()
...
await heos.disconnect()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyheos",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "heos, dennon, maranz",
    "author": null,
    "author_email": "Andrew Sayre <andrew@sayre.net>",
    "download_url": "https://files.pythonhosted.org/packages/f5/9f/b3fd9a05754c4d062a05d55e2acde1911f3ddf27aad8ea18c4680e9bf380/pyheos-1.0.4.tar.gz",
    "platform": "any",
    "description": "# ![pyheos](assets/pyheos-logo.png \"pyheos - An asynchronous Python library for controlling Denon and Marantz products with HEOS\u00ae Built-in\")\n\n[![CI Status](https://github.com/andrewsayre/pyheos/workflows/CI/badge.svg)](https://github.com/andrewsayre/pyheos/actions)\n[![codecov](https://codecov.io/github/andrewsayre/pyheos/graph/badge.svg?token=PV4P3AN7Z1)](https://codecov.io/github/andrewsayre/pyheos)\n[![image](https://img.shields.io/pypi/v/pyheos.svg)](https://pypi.org/project/pyheos/)\n[![image](https://img.shields.io/pypi/pyversions/pyheos.svg)](https://pypi.org/project/pyheos/)\n[![image](https://img.shields.io/pypi/l/pyheos.svg)](https://pypi.org/project/pyheos/)\n\nAn asynchronous Python library for controlling Denon and Marantz products with HEOS\u00ae Built-in through the HEOS CLI Protocol (version 1.21 for HEOS firmware 3.40 or newer).\n\n## Installation\n\n```bash\npip install pyheos\n```\n\n## Getting Started\n\n### `Heos` class\n\nThe `Heos` class is the implementation providing control to all HEOS compatible devices on the local network through a single network connection. It is suggested to connect to a device that is hard-wired.\n\n#### `pyheos.Heos.create_and_connect(host: str, **kwargs) -> Heos`\n\nCoroutine that accepts the host and options arguments (as defined in the `pyheos.HeosOptions` below), creates an instance of `Heos` and connects, returning the instance.\n\n#### `pyheos.Heos(options: HeosOptions)`\n\n- `options: HeosOptions`: An instance of HeosOptions that encapsulates options and configuration (see below)\n\n#### `pyheos.Heos.connect() -> None`\n\nConnect to the specified host. This method is a coroutine.\n\n#### `pyheos.Heos.disconnect() -> None`\n\nDisconnect from the specified host. This method is a coroutine.\n\n#### `pyheos.Heos.get_players(*, refresh)`\n\nRetrieve the available players as a `dict[int, pyheos.Heos.HeosPlayer]` where the key represents the `player_id` and the value the `HeosPlayer` instance. This method is a coroutine. This method will populate the `players` property and will begin tracking changes to the players.\n\n- `refresh`: Set to `True` to retrieve the latest available players from the CLI. The default is `False` and will return the previous loaded players.\n\n### `HeosOptions` class\n\nThis class encapsulates the options and configuration for connecting to a HEOS system.\n\n#### `pyheos.HeosOptions(host, *, timeout, heart_beat, heart_beat_interval, dispatcher, auto_reconnect, auto_reconnect_delay, auto_reconnect_max_attempts, credentials)`\n\n- `host: str`: A host name or IP address of a HEOS-capable device. This parameter is required.\n- `timeout: float`: The timeout in seconds for opening a connection and issuing commands to the device. Default is `pyheos.const.DEFAULT_TIMEOUT = 15.0`. This parameter is required.\n- `heart_beat: bool`: Set to `True` to enable heart beat messages, `False` to disable. Used in conjunction with `heart_beat_delay`. The default is `True`.\n- `heart_beat_interval: float`: The interval in seconds between heart beat messages. Used in conjunction with `heart_beat`. Default is `pyheos.const.DEFAULT_HEART_BEAT = 10.0`\n- `events: bool`: Set to `True` to enable event updates, `False` to disable. The default is `True`.\n- `all_progress_events: bool`: Set to `True` to receive media progress events, `False` to only receive media changed events. The default is `True`.\n- `dispatcher: pyheos.Dispatcher | None`: The dispatcher instance to use for event callbacks. If not provided, an internally created instance will be used.\n- `auto_failover: bool`: Set to True to automatically failover to other hosts if the connection is lost. The default is False. Used in conjunction with `auto_failover_hosts`.\n- `auto_failover_hosts: Sequence[str]`: A sequence of host names or IP addresses of other hosts in the HEOS system. The default is an empty list, which will be populated automatically from the system information.\n- `auto_reconnect: bool`: Set to `True` to automatically reconnect if the connection is lost. The default is `False`. Used in conjunction with `auto_reconnect_delay`.\n- `auto_reconnect_delay: float`: The number of seconds to wait before attempting to reconnect upon a connection failure. The default is `DEFAULT_RECONNECT_DELAY = 1.0`. Used in conjunction with `auto_reconnect`.\n- `auto_reconnect_max_attempts: float`: The maximum number of reconnection attempts before giving up. Set to `0` for unlimited attempts. The default is `0` (unlimited).\n- `credentials`: credentials to use to automatically sign-in to the HEOS account upon successful connection. If not provided, the account will not be signed in.\n\n##### Example:\n\n```python\nimport pyheos\n\nheos = await Heos.create_and_connect('172.16.0.1', auto_reconnect=True)\n\nplayers = await heos.get_players()\n...\nawait heos.disconnect()\n```\n",
    "bugtrack_url": null,
    "license": "ASL 2.0",
    "summary": "An async python library for controlling HEOS devices through the HEOS CLI Protocol",
    "version": "1.0.4",
    "project_urls": {
        "Source Code": "https://github.com/andrewsayre/pyheos"
    },
    "split_keywords": [
        "heos",
        " dennon",
        " maranz"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aa080ffc2186affd8f64afc7783a4bdd1d8610eb789e0b159e0a3426cc035546",
                "md5": "8dbfaea464d7406b63e58717c3863011",
                "sha256": "fc5953b3d8c3b139a12bcba3657d402ab6f5909bda5409d20345edc6a861ea74"
            },
            "downloads": -1,
            "filename": "pyheos-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8dbfaea464d7406b63e58717c3863011",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 54377,
            "upload_time": "2025-03-21T21:33:59",
            "upload_time_iso_8601": "2025-03-21T21:33:59.437031Z",
            "url": "https://files.pythonhosted.org/packages/aa/08/0ffc2186affd8f64afc7783a4bdd1d8610eb789e0b159e0a3426cc035546/pyheos-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f59fb3fd9a05754c4d062a05d55e2acde1911f3ddf27aad8ea18c4680e9bf380",
                "md5": "10c64c1ebfb27c6973b41694f52929de",
                "sha256": "875c617c570aa97a6b4fdfbd22cbc8df7008c45936c8ad991799e18d4ea51092"
            },
            "downloads": -1,
            "filename": "pyheos-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "10c64c1ebfb27c6973b41694f52929de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 66428,
            "upload_time": "2025-03-21T21:34:00",
            "upload_time_iso_8601": "2025-03-21T21:34:00.615646Z",
            "url": "https://files.pythonhosted.org/packages/f5/9f/b3fd9a05754c4d062a05d55e2acde1911f3ddf27aad8ea18c4680e9bf380/pyheos-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-21 21:34:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andrewsayre",
    "github_project": "pyheos",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyheos"
}
        
Elapsed time: 0.88475s