Provides a python interface to interact with Roon
Project description
pyRoon
python library to interface with the Roon API (www.roonlabs.com)
See https://github.com/pavoni/pyroon/tree/master/examples for code examples.
An example of connecting to the roon server and using a subscription:
import time
from roonapi import RoonApi
appinfo = {
"extension_id": "python_roon_test",
"display_name": "Python library for Roon",
"display_version": "1.0.0",
"publisher": "gregd",
"email": "mygreat@emailaddress.com",
}
# Can be None if you don't yet have a token
token = open("mytokenfile").read()
# Take a look at examples/discovery if you want to use discovery.
server = "192.168.1.160"
roonapi = RoonApi(appinfo, token, server)
def my_state_callback(event, changed_ids):
"""Call when something changes in roon."""
print("my_state_callback event:%s changed_ids: %s" % (event, changed_ids))
for zone_id in changed_ids:
zone = roonapi.zones[zone_id]
print("zone_id:%s zone_info: %s" % (zone_id, zone))
# receive state updates in your callback
roonapi.register_state_callback(my_state_callback)
time.sleep(60)
# save the token for next time
with open("mytokenfile", "w") as f:
f.write(roonapi.token)```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
roonapi-0.1.5.tar.gz
(19.5 kB
view details)
Built Distribution
roonapi-0.1.5-py3-none-any.whl
(21.1 kB
view details)
File details
Details for the file roonapi-0.1.5.tar.gz
.
File metadata
- Download URL: roonapi-0.1.5.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9194979e48f51242febdb1fcbed8eea13b719c1a5aaea9ee653b9c8d0bfe070 |
|
MD5 | cbcdebbd38c0989f9dbc18267dcad9e0 |
|
BLAKE2b-256 | 427f952af9b5c9585d1d1bdae75a90f543ffb79ace4e931714ac8a9fdc3aa540 |
File details
Details for the file roonapi-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: roonapi-0.1.5-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a3358c0f71e7ddc7d9a8eeef060bfcd8efa3816ae60819b2e9c17601d3942ba |
|
MD5 | 9df33623c5aa70d394d43e0b485605c8 |
|
BLAKE2b-256 | 60573693bb26e1ab319e71140d711617ee23ef40bd1f839b7f715bc8ff85821c |