# pyRoon ![Build status](https://github.com/pavoni/pyroon/workflows/Build/badge.svg) ![PyPi version](https://img.shields.io/pypi/v/roonapi) ![PyPi downloads](https://img.shields.io/pypi/dm/roonapi)
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)```
Raw data
{
"_id": null,
"home_page": "https://github.com/pavoni/pyroon",
"name": "roonapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.2,<4.0.0",
"maintainer_email": "",
"keywords": "roon,api",
"author": "Greg Dowling",
"author_email": "mail@gregdowling.com",
"download_url": "https://files.pythonhosted.org/packages/93/d2/97cf824aeb208f9d084544ef489cff08b66cd5714e303490e43121f2a6fc/roonapi-0.1.6.tar.gz",
"platform": null,
"description": "# pyRoon ![Build status](https://github.com/pavoni/pyroon/workflows/Build/badge.svg) ![PyPi version](https://img.shields.io/pypi/v/roonapi) ![PyPi downloads](https://img.shields.io/pypi/dm/roonapi)\npython library to interface with the Roon API (www.roonlabs.com)\n\nSee https://github.com/pavoni/pyroon/tree/master/examples for code examples.\n\n\nAn example of connecting to the roon server and using a subscription:\n\n```\nimport time\n\nfrom roonapi import RoonApi\n\nappinfo = {\n \"extension_id\": \"python_roon_test\",\n \"display_name\": \"Python library for Roon\",\n \"display_version\": \"1.0.0\",\n \"publisher\": \"gregd\",\n \"email\": \"mygreat@emailaddress.com\",\n}\n\n# Can be None if you don't yet have a token\ntoken = open(\"mytokenfile\").read()\n\n# Take a look at examples/discovery if you want to use discovery.\nserver = \"192.168.1.160\"\n\nroonapi = RoonApi(appinfo, token, server)\n\n\ndef my_state_callback(event, changed_ids):\n \"\"\"Call when something changes in roon.\"\"\"\n print(\"my_state_callback event:%s changed_ids: %s\" % (event, changed_ids))\n for zone_id in changed_ids:\n zone = roonapi.zones[zone_id]\n print(\"zone_id:%s zone_info: %s\" % (zone_id, zone))\n\n\n# receive state updates in your callback\nroonapi.register_state_callback(my_state_callback)\n\ntime.sleep(60)\n\n# save the token for next time\nwith open(\"mytokenfile\", \"w\") as f:\n f.write(roonapi.token)```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Provides a python interface to interact with Roon",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/pavoni/pyroon",
"Repository": "https://github.com/pavoni/pyroon"
},
"split_keywords": [
"roon",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1745328ff43f50b6ee77be71540a93707134997cad6ae43d40ef73fad1962ace",
"md5": "235a1f71823071d7eb4b7505b0d3c2aa",
"sha256": "811197037679ca834883a761e5e89e82fe0e6ae890d0009a4a6f0adf3eaf18e1"
},
"downloads": -1,
"filename": "roonapi-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "235a1f71823071d7eb4b7505b0d3c2aa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.2,<4.0.0",
"size": 21208,
"upload_time": "2023-12-13T20:52:55",
"upload_time_iso_8601": "2023-12-13T20:52:55.987251Z",
"url": "https://files.pythonhosted.org/packages/17/45/328ff43f50b6ee77be71540a93707134997cad6ae43d40ef73fad1962ace/roonapi-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93d297cf824aeb208f9d084544ef489cff08b66cd5714e303490e43121f2a6fc",
"md5": "e871de55877414ade601c184399eb7bd",
"sha256": "2980258dbf8d0a6a436cf2bc51759a4c4af8b120b6280ba2b42ce9a197a592a4"
},
"downloads": -1,
"filename": "roonapi-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "e871de55877414ade601c184399eb7bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.2,<4.0.0",
"size": 19556,
"upload_time": "2023-12-13T20:52:57",
"upload_time_iso_8601": "2023-12-13T20:52:57.311938Z",
"url": "https://files.pythonhosted.org/packages/93/d2/97cf824aeb208f9d084544ef489cff08b66cd5714e303490e43121f2a6fc/roonapi-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-13 20:52:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pavoni",
"github_project": "pyroon",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "roonapi"
}