# 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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "rinnai,home automation,water heater",
"author": "Brad Barbour",
"author_email": "barbourbj@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/05/99/dcaba561004130c14a8363e36219bb90fa910c638b80498b5e2becad94a4/aiorinnai-0.3.1.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.1",
"split_keywords": [
"rinnai",
"home automation",
"water heater"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "7f1cd66eafbc4fa393f671b2055ff0a5",
"sha256": "20533b7818d050fd9d1f3989703d242d941231a48a7e86e4918a2433658c8286"
},
"downloads": -1,
"filename": "aiorinnai-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7f1cd66eafbc4fa393f671b2055ff0a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21925,
"upload_time": "2022-12-06T03:13:38",
"upload_time_iso_8601": "2022-12-06T03:13:38.042546Z",
"url": "https://files.pythonhosted.org/packages/21/26/9ccfeb93cc2b626a5e10b666e4b519a2d066a86ac9c04275c2789e9acb69/aiorinnai-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "372bb4a36bc8edf1eca5533d66031013",
"sha256": "20c00045478a0b7664a4ab89fb97ab7a162fcc55ae29396336bebb66fa1a73fc"
},
"downloads": -1,
"filename": "aiorinnai-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "372bb4a36bc8edf1eca5533d66031013",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20809,
"upload_time": "2022-12-06T03:13:39",
"upload_time_iso_8601": "2022-12-06T03:13:39.580664Z",
"url": "https://files.pythonhosted.org/packages/05/99/dcaba561004130c14a8363e36219bb90fa910c638b80498b5e2becad94a4/aiorinnai-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-06 03:13:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "explosivo22",
"github_project": "aio-rinnaicontrolr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiorinnai"
}