# aiorinnai - Python interface for the Rinnai Control-R API
[![PyPi](https://img.shields.io/pypi/v/aiorinnai?style=for-the-badge)](https://pypi.org/project/aiorinnai)
[![License](https://img.shields.io/github/license/explosivo22/aio-rinnaicontrolr?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
Python library for communicating with the [Rinnai Control-R Water Heaters and control devices](https://www.rinnai.us/tankless-water-heater/accessories/wifi) via the Rinnai Control-R cloud API.
***WARNING***
* This library only works if you have migrated to the Rinnai 2.0 app. This will require a firmware update to your Control-R module.
* [IOS](https://apps.apple.com/us/app/rinnai-control-r-2-0/id1180734911?app=itunes&ign-mpt=uo%3D4)
* [Android](https://play.google.com/store/apps/details?id=com.controlr)
NOTE:
* This library is community supported, please submit changes and improvements.
* This is a very basic interface, not well thought out at this point, but works for the use cases that initially prompted spitting this out from.
## Supports
- starting/stop recirculation
- setting temperature
## Installation
```
pip install aiorinnai==0.3.0
```
## Examples
```python
import asyncio
from aiohttp import ClientSession
from aiorinnai import async_get_api
async def main() -> None:
"""Run!"""
api = await async_get_api("<EMAIL>", "<PASSWORD>")
# Get user account information:
user_info = await api.user.get_info()
# Get device information
first_device_id = user_info["devices"]["items"][0]["id"]
device_info = await api.device.get_info(first_device_id)
#Start Recirculation
#Last variable is duration in minutes
start_recirculation = await api.device.start_recirculation(device_info['data']['getDevices'], 5)
#Stop Recirculation
stop_recirculation = await api.device.stop_recirculation(device_info['data']['getDevices'])
#Set Temperature
#Last variable is the temperature in increments of 5
set_temperature = await api.device.set_temperature(device_info['data']['getDevices'], 130)
asyncio.run(main())
```
By default, the library creates a new connection to Rinnai with each coroutine. If you are calling a large number of coroutines (or merely want to squeeze out every second of runtime savings possible), an aiohttp ClientSession can be used for connection pooling:
```python
import asyncio
from aiohttp import ClientSession
from aiorinnai import async_get_api
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
api = await async_get_api("<EMAIL>", "<PASSWORD>", session=websession)
# Get user account information:
user_info = await api.user.get_info()
# Get device information
first_device_id = user_info["devices"]["items"][0]["id"]
device_info = await api.device.get_info(first_device_id)
#Start Recirculation
#Last variable is duration in minutes
start_recirculation = await api.device.start_recirculation(user_info["id"], first_device_id, 5)
print(start_recirculation)
#Stop Recirculation
stop_recirculation = await api.device.stop_recirculation(user_info["id"], first_device_id)
print(stop_recirculation)
#Set Temperature
#Last variable is the temperature in increments of 5
set_temperature = await api.device.set_temperature(user_info["id"], first_device_id, 130)
asyncio.run(main())
```
## Known Issues
* not all APIs supported
Raw data
{
"_id": null,
"home_page": "https://github.com/explosivo22/aio-rinnaicontrolr",
"name": "aiorinnai",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "rinnai, home automation, water heater",
"author": "Brad Barbour",
"author_email": "barbourbj@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5d/39/953a499900a6e762fe012a22aced04172fc90a51e27f297cfc0f37418b24/aiorinnai-0.3.5.tar.gz",
"platform": null,
"description": "\n# aiorinnai - Python interface for the Rinnai Control-R API\n\n[![PyPi](https://img.shields.io/pypi/v/aiorinnai?style=for-the-badge)](https://pypi.org/project/aiorinnai)\n[![License](https://img.shields.io/github/license/explosivo22/aio-rinnaicontrolr?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)\n\nPython library for communicating with the [Rinnai Control-R Water Heaters and control devices](https://www.rinnai.us/tankless-water-heater/accessories/wifi) via the Rinnai Control-R cloud API.\n\n***WARNING***\n* This library only works if you have migrated to the Rinnai 2.0 app. This will require a firmware update to your Control-R module.\n* [IOS](https://apps.apple.com/us/app/rinnai-control-r-2-0/id1180734911?app=itunes&ign-mpt=uo%3D4)\n* [Android](https://play.google.com/store/apps/details?id=com.controlr)\n\nNOTE:\n\n* This library is community supported, please submit changes and improvements.\n* This is a very basic interface, not well thought out at this point, but works for the use cases that initially prompted spitting this out from.\n\n## Supports\n\n- starting/stop recirculation\n- setting temperature\n\n## Installation\n\n```\npip install aiorinnai==0.3.0\n```\n\n## Examples\n\n```python\nimport asyncio\n\nfrom aiohttp import ClientSession\n\nfrom aiorinnai import async_get_api\n\n\nasync def main() -> None:\n \"\"\"Run!\"\"\"\n api = await async_get_api(\"<EMAIL>\", \"<PASSWORD>\")\n\n # Get user account information:\n user_info = await api.user.get_info()\n\n # Get device information\n first_device_id = user_info[\"devices\"][\"items\"][0][\"id\"]\n device_info = await api.device.get_info(first_device_id)\n\n #Start Recirculation\n #Last variable is duration in minutes\n start_recirculation = await api.device.start_recirculation(device_info['data']['getDevices'], 5)\n\n #Stop Recirculation\n stop_recirculation = await api.device.stop_recirculation(device_info['data']['getDevices'])\n\n #Set Temperature\n #Last variable is the temperature in increments of 5\n set_temperature = await api.device.set_temperature(device_info['data']['getDevices'], 130)\n\n\nasyncio.run(main())\n\n```\nBy default, the library creates a new connection to Rinnai with each coroutine. If you are calling a large number of coroutines (or merely want to squeeze out every second of runtime savings possible), an aiohttp ClientSession can be used for connection pooling:\n\n```python\nimport asyncio\n\nfrom aiohttp import ClientSession\n\nfrom aiorinnai import async_get_api\n\n\nasync def main() -> None:\n \"\"\"Create the aiohttp session and run the example.\"\"\"\n async with ClientSession() as websession:\n api = await async_get_api(\"<EMAIL>\", \"<PASSWORD>\", session=websession)\n\n # Get user account information:\n user_info = await api.user.get_info()\n\n # Get device information\n first_device_id = user_info[\"devices\"][\"items\"][0][\"id\"]\n device_info = await api.device.get_info(first_device_id)\n\n #Start Recirculation\n #Last variable is duration in minutes\n start_recirculation = await api.device.start_recirculation(user_info[\"id\"], first_device_id, 5)\n\n print(start_recirculation)\n\n #Stop Recirculation\n stop_recirculation = await api.device.stop_recirculation(user_info[\"id\"], first_device_id)\n\n print(stop_recirculation)\n\n #Set Temperature\n #Last variable is the temperature in increments of 5\n set_temperature = await api.device.set_temperature(user_info[\"id\"], first_device_id, 130)\n\n\nasyncio.run(main())\n```\n\n## Known Issues\n\n* not all APIs supported\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "Python interface for Rinnai Control-R API",
"version": "0.3.5",
"project_urls": {
"Homepage": "https://github.com/explosivo22/aio-rinnaicontrolr"
},
"split_keywords": [
"rinnai",
" home automation",
" water heater"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fce19dabbfdd3132bb131556ce10ae776650949a256925c06327a5e9b5402502",
"md5": "401f332eda1b46508a2a1a207510a293",
"sha256": "14fcb1f8e6f21d31b5a4ff09b6027461d2dc4c81f503b2a81297bbf19540eb3c"
},
"downloads": -1,
"filename": "aiorinnai-0.3.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "401f332eda1b46508a2a1a207510a293",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21927,
"upload_time": "2025-01-05T03:04:57",
"upload_time_iso_8601": "2025-01-05T03:04:57.443584Z",
"url": "https://files.pythonhosted.org/packages/fc/e1/9dabbfdd3132bb131556ce10ae776650949a256925c06327a5e9b5402502/aiorinnai-0.3.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5d39953a499900a6e762fe012a22aced04172fc90a51e27f297cfc0f37418b24",
"md5": "1d76e7f0ba795ef3e02e7f8d479ae414",
"sha256": "b6dd8f2e4985ef285d45d154d7d286af1b0eaa482db1bf6e1b287492d0b51f16"
},
"downloads": -1,
"filename": "aiorinnai-0.3.5.tar.gz",
"has_sig": false,
"md5_digest": "1d76e7f0ba795ef3e02e7f8d479ae414",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21569,
"upload_time": "2025-01-05T03:04:59",
"upload_time_iso_8601": "2025-01-05T03:04:59.971745Z",
"url": "https://files.pythonhosted.org/packages/5d/39/953a499900a6e762fe012a22aced04172fc90a51e27f297cfc0f37418b24/aiorinnai-0.3.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-05 03:04:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "explosivo22",
"github_project": "aio-rinnaicontrolr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiorinnai"
}