<!--
SPDX-FileCopyrightText: 2020 Andrius Štikonas <andrius@stikonas.eu>
SPDX-License-Identifier: CC-BY-4.0
-->
# NeoHubAPI
This is a simple python wrapper around Heatmiser's Neohub API. Up-to-date
documentation for the API can be obtained from the [Heatmiser Developer
Portal](https://dev.heatmiser.com). You will need to sign up for a free account.
The primary purpose of this module is to help with [Home
Assistant](https://www.home-assistant.io) integration but it can also be used as
a standalone library for other projects.
## Connection methods
The API provides two connection methods. The so-called "legacy" method is by way of an unencrypted connection to port 4242 of the Neohub. The newer method uses an encrypted websocket on port 4243, but only works on a second generation hub (look for the sticker on the back).
To use the websocket connection, you need to obtain a token from the Heatmiser Neo app. Go to `Settings > API > +` in the app and create one.
On newer hubs, the legacy connection may be disabled by default. If you want to use it, go to `Settings > API` in the app, and enable it from there.
## Usage example
```python
import asyncio
import neohubapi.neohub as neohub
async def run():
# Legacy connection
hub = neohub.NeoHub()
# Or, for a websocket connection:
# hub = neohub.Neohub(port=4243, token='xxx-xxxxxxx')
system = await hub.get_system()
hub_data = await hub.get_devices_data()
devices = hub_data['neo_devices']
for device in devices:
print(f"Temperature in zone {device.name}: {device.temperature}")
await device.identify()
asyncio.run(run())
```
## neohub_cli.py
This package includes a CLI for performing common tasks.
```
$ neohub_cli.py help # Shows all commands
$ neohub_cli.py help set_time # Displays help for the set_time function
$ neohub_cli.py --hub_ip=myneohub set_time "2021-01-31 15:43:00" # Specify times like this
$ neohub_cli.py --hub_ip=myneohub set_lock 1234 "Living Room" # Name NeoStats like this.
$ neohub_cli.py --hub_ip=myneohub --hub_token=XXX get_system # Get system variables with websocket connection
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/neohubapi/neohubapi/",
"name": "neohubapi",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "neohub, heatmiser",
"author": "Andrius \u0160tikonas",
"author_email": "andrius@stikonas.eu",
"download_url": "https://files.pythonhosted.org/packages/06/a0/26c4b304b43fd1e1571ee8aa25bbc70e473ace1b4b29e162d210fc23f87d/neohubapi-2.1.tar.gz",
"platform": null,
"description": "<!--\n SPDX-FileCopyrightText: 2020 Andrius \u0160tikonas <andrius@stikonas.eu>\n SPDX-License-Identifier: CC-BY-4.0\n-->\n\n# NeoHubAPI\n\nThis is a simple python wrapper around Heatmiser's Neohub API. Up-to-date \ndocumentation for the API can be obtained from the [Heatmiser Developer\nPortal](https://dev.heatmiser.com). You will need to sign up for a free account.\n\nThe primary purpose of this module is to help with [Home\nAssistant](https://www.home-assistant.io) integration but it can also be used as\n a standalone library for other projects.\n\n## Connection methods\n\nThe API provides two connection methods. The so-called \"legacy\" method is by way of an unencrypted connection to port 4242 of the Neohub. The newer method uses an encrypted websocket on port 4243, but only works on a second generation hub (look for the sticker on the back).\n\nTo use the websocket connection, you need to obtain a token from the Heatmiser Neo app. Go to `Settings > API > +` in the app and create one.\n\nOn newer hubs, the legacy connection may be disabled by default. If you want to use it, go to `Settings > API` in the app, and enable it from there.\n\n## Usage example\n\n```python\nimport asyncio\nimport neohubapi.neohub as neohub\n\n\nasync def run():\n # Legacy connection\n hub = neohub.NeoHub()\n # Or, for a websocket connection:\n # hub = neohub.Neohub(port=4243, token='xxx-xxxxxxx')\n system = await hub.get_system()\n hub_data = await hub.get_devices_data()\n devices = hub_data['neo_devices']\n for device in devices:\n print(f\"Temperature in zone {device.name}: {device.temperature}\")\n await device.identify()\n\n\nasyncio.run(run())\n```\n\n\n\n## neohub_cli.py\n\nThis package includes a CLI for performing common tasks.\n\n```\n$ neohub_cli.py help # Shows all commands\n$ neohub_cli.py help set_time # Displays help for the set_time function\n$ neohub_cli.py --hub_ip=myneohub set_time \"2021-01-31 15:43:00\" # Specify times like this\n$ neohub_cli.py --hub_ip=myneohub set_lock 1234 \"Living Room\" # Name NeoStats like this.\n$ neohub_cli.py --hub_ip=myneohub --hub_token=XXX get_system # Get system variables with websocket connection\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Async library to communicate with Heatmiser NeoHub 2 API.",
"version": "2.1",
"project_urls": {
"Homepage": "https://gitlab.com/neohubapi/neohubapi/"
},
"split_keywords": [
"neohub",
" heatmiser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "caa1d02070520e98800ecdf8476b56493199365df7729163328add07b88425e9",
"md5": "d6edbb91267087d0b01a867bfc1a86ab",
"sha256": "8cd25317310cad575d84f5be582fb278d2a2a129556972847341a257367d24d3"
},
"downloads": -1,
"filename": "neohubapi-2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d6edbb91267087d0b01a867bfc1a86ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14997,
"upload_time": "2024-04-27T22:42:56",
"upload_time_iso_8601": "2024-04-27T22:42:56.656286Z",
"url": "https://files.pythonhosted.org/packages/ca/a1/d02070520e98800ecdf8476b56493199365df7729163328add07b88425e9/neohubapi-2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "06a026c4b304b43fd1e1571ee8aa25bbc70e473ace1b4b29e162d210fc23f87d",
"md5": "2133021282cac74d527970e857df967c",
"sha256": "671a487e608906caf478f56f4863f975e6cd7e3b843a8ea52d66f8c5efb05057"
},
"downloads": -1,
"filename": "neohubapi-2.1.tar.gz",
"has_sig": false,
"md5_digest": "2133021282cac74d527970e857df967c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26618,
"upload_time": "2024-04-27T22:42:57",
"upload_time_iso_8601": "2024-04-27T22:42:57.891160Z",
"url": "https://files.pythonhosted.org/packages/06/a0/26c4b304b43fd1e1571ee8aa25bbc70e473ace1b4b29e162d210fc23f87d/neohubapi-2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-27 22:42:57",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "neohubapi",
"gitlab_project": "neohubapi",
"lcname": "neohubapi"
}