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.2.tar.gz
(18.4 kB
view details)
Built Distribution
roonapi-0.1.2-py3-none-any.whl
(19.5 kB
view details)
File details
Details for the file roonapi-0.1.2.tar.gz
.
File metadata
- Download URL: roonapi-0.1.2.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.7.15 Linux/5.15.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db125880a64ed21ace0c52f4023307d8755f1446a8e6dd23d67dbc8becd37469 |
|
MD5 | e2552b285598b826e04aff9db177951b |
|
BLAKE2b-256 | 45148efc0ce03c6287d8576f9fbbf77de3d5c7d8e0d9f0c1678e92ed03e32a1f |
File details
Details for the file roonapi-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: roonapi-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.7.15 Linux/5.15.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62dc0a0c5d6396ef7c59ee0d3f42b978bcf80196f8d8c2f28f2bbc8a6556035b |
|
MD5 | 0fddbc0d40a6579b1d71f7321e31323a |
|
BLAKE2b-256 | 9b02e67f5bd6bebee2c170c6b64c93665a3923c2a4e2f68d7d5e678b25b122f4 |