{ "info": { "author": "Aram Zegerius", "author_email": "aram@zegeri.us", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# Netatmo2InfluxDB\n\n`Netatmo2InfluxDB` supports the import of multiple Netatmo Thermostats across multiple houses into InfluxDB.\n\n## How it works\n\nBy using the [Netatmo Developer API](https://dev.netatmo.com/), we can fetch data using their `api/homesdata` and `api/getroommeasure` endpoints (see: [`netatmo2influxdb/data.py`](https://gitlab.com/envsense/netatmo-to-influxdb/tree/master/netatmo2influxdb/data.py)). The `api/getroommeasure` endpoint allows a granularity of 30 minutes, which is fine for our application.\n\nTo be able to actually retrieve data, we first have to gather access and refresh tokens. We get those for a given username using their `oauth2/token` endpoint (see: [`netatmo2influxdb/tokens.py`](https://gitlab.com/envsense/netatmo-to-influxdb/tree/master/netatmo2influxdb/tokens.py)). This requires a one-time use of the user's password. The subsequent tokens are then stored in a small sqlite database (`netatmo.db`).\n\nIn a normal use-case we want to retrieve all data there is. For this we use the command-line argument `--all`. This retrieves all home-IDs and related room-IDs (see: [`netatmo2influxdb/data.py:get_home`](https://gitlab.com/envsense/netatmo-to-influxdb/blob/masternetatmo2influxdb/data.py#L15) and [`netatmo2influxdb/parser.py`](https://gitlab.com/envsense/netatmo-to-influxdb/blob/master/netatmo2influxdb/parser.py)), and collects the data. Because we don't want to fetch new data every single time, all the import records (`username`, `home_id`, `room_id`, `start_ts`, `end_ts`, `count`) are stored.\n\nTo store the data in InfluxDB, some small changes have to be made to the data. We parse the epoch timestamp into dt.isoformat and unpack the temperature. By using the provided InfluxDB SeriesHelper, we make sure we only send packages of 512 records at a time. The following tags are included by default: `user`, `home_name`, `home_id`, `room_name`, `room_id`.\n\nBecause some of us like to have extra tags in our InfluxDB database measurements, this capability is added with the `--custom-tags` argument. Just add space-separated `tag:value`'s (see [`netatmo2influxdb/store.py:**custom_tags`](https://gitlab.com/envsense/netatmo-to-influxdb/blob/master/netatmo2influxdb/store.py#L78)).\n\nIf you want to play around, The `--interactive` argument was added. This makes sure all your CLI arguments are parsed, but nothing is actually run. Use like this: `pipenv run python -it app {username} {args} --interactive`. You can also do a dry run with `--dry`. This makes sure nothing gets stored locally or in the InfluxDB instance.\n\n## Install\n\nInstall with pipenv, run `pipenv install`\n\nMake sure to copy `.env.tpl` -> `.env` and add the appropriate values.\n\n## CLI\n\nRun the application with `pipenv run app {netatmo username} {--all or --home ...} {optional arguments}`\n\nTo get insight in what houses and thermostats are available, run `pipenv run app {netatmo username} --get-home`. \n\n```txt\nusage: app [-h] [--home [home_id [['room_id'] ...]]]\n [--custom-tags [tag:value [tag:value ...]]] [--get-home] [--all]\n [--dry] [--clear-db] [--interactive]\n user\n\nGather thermostat data from Netatmo\n\npositional arguments:\n user User to parse\n\noptional arguments:\n -h, --help show this help message and exit\n --home [home_id [['room_id'] ...]]\n Homes and rooms to parse. Use format --home {home_id_1} {room_id_1} {room_id2} ... --home {home_id_2} ...\n --custom-tags [tag:value [tag:value ...]]\n Provide custom tags for InfluxDB. Format: --custom-tags tag:value tag:value\n --get-home Get home and room information\n --all Parse all homes and rooms\n --dry Do a dry-run (don't store in InfluxDB)\n --clear-db Wipes database from users and import history\n --interactive Allows interactive use (ignores all other args)\n ```\n\n## Use with Docker\n\nBecause I run all my internal tools in Docker, here is a brief description on how to get up and running.\n\n### Build the Docker Image\n\n`docker build -t netatmo2influxdb .`\n\n### Use with Docker Crontab\n\nUsing [Docker Crontab](https://github.com/willfarrell/docker-crontab) we can start the container every 30 minutes and shut it down after we're done getting our data.\n\nUse and adjust the following `config.json` file for Crontab:\n\n```json\n[{\n \"schedule\":\"@every 30m\",\n \"image\":\"netatmo2influxdb\",\n \"dockerargs\": \"-d \\\n --env-file /location/of/.env \\\n -v /location/of/netatmo.db:/netatmo2influxdb/netatmo.db\",\n \"command\":\"python app [USERNAME] --all & shutdown -h now\"\n}]\n```\n\nIf you don't have Crontab running yet, use the following command to run the container:\n\n```bash\ndocker run -d \\\n -v /var/run/docker.sock:/var/run/docker.sock:ro \\\n -v ./env:/opt/env:ro \\\n -v /path/to/config/dir:/opt/crontab:rw \\\n -v /path/to/logs:/var/log/crontab:rw \\\n willfarrell/crontab:latest\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/zegerius/netatmo-to-influxdb", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "netatmo2influxdb", "package_url": "https://pypi.org/project/netatmo2influxdb/", "platform": "", "project_url": "https://pypi.org/project/netatmo2influxdb/", "project_urls": { "Homepage": "https://gitlab.com/zegerius/netatmo-to-influxdb" }, "release_url": "https://pypi.org/project/netatmo2influxdb/0.1.2/", "requires_dist": [ "requests", "influxdb" ], "requires_python": ">=3.7.0", "summary": "Send Netatmo Thermostat data to InfluxDB.", "version": "0.1.2" }, "last_serial": 5571842, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1ac5998846c8d2dc5a74eec40d44b793", "sha256": "a94be120e4952c4d6c33b00c6379dda2757d5d17e4b90a388816f10afad494f6" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1ac5998846c8d2dc5a74eec40d44b793", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7.0", "size": 12369, "upload_time": "2019-07-19T08:35:55", "url": "https://files.pythonhosted.org/packages/0e/95/4a15506e28804cf83c43a95b418c01d913b384384c6bf2889419e5aa75e7/netatmo2influxdb-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b39d2af5e236fe100114484cf1a4799b", "sha256": "582b7f77a6c833c643e627df48222823bb05af8eaed3a6903d4ec62605d763b7" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b39d2af5e236fe100114484cf1a4799b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7.0", "size": 12897, "upload_time": "2019-07-19T08:35:58", "url": "https://files.pythonhosted.org/packages/c1/b5/fa035601d7a8085f248dc135045a05de2a094c6f2d96540c7345a2aed841/netatmo2influxdb-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c05bae2bf57c144b6d9cd3775730bb34", "sha256": "6340a80625253042a8f1d3d72b0cd102f807920c4c3b8648a83728ed0b6743a3" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c05bae2bf57c144b6d9cd3775730bb34", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7.0", "size": 12430, "upload_time": "2019-07-23T10:49:58", "url": "https://files.pythonhosted.org/packages/1d/ef/260bf37f523f048539bbdd23e35b903d76077714a6798f1ee6421cd404de/netatmo2influxdb-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3488e73f31d0fed1526aecc6b99d9f1a", "sha256": "6dda8811ffbd375444c4780b6e684784d8c64b2773b025addb0cf35da3a83c52" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3488e73f31d0fed1526aecc6b99d9f1a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7.0", "size": 12949, "upload_time": "2019-07-23T10:50:00", "url": "https://files.pythonhosted.org/packages/9b/35/557c87db0b360c4e0e1330dc092cd774fbdce1987a4daa15bc5e3f6f4c7d/netatmo2influxdb-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "5eac6eb95642ea5999d80c9e91190185", "sha256": "c3929f1fdafd681b561710cb1f47ecf6a2269240982c24061c716538ad25e6f5" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5eac6eb95642ea5999d80c9e91190185", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7.0", "size": 12375, "upload_time": "2019-07-23T10:52:10", "url": "https://files.pythonhosted.org/packages/2d/71/c28b0912b0cfffa935974dfacd8db712d074eae2a92d6c4ddcdc5989f8cb/netatmo2influxdb-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "91b9be9273f8348bc4616c0b8d247cef", "sha256": "0a6e5dbed58a78be0a1ca7d88b04035b17badd8cea9879770bafda72c4621ea6" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.2.tar.gz", "has_sig": false, "md5_digest": "91b9be9273f8348bc4616c0b8d247cef", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7.0", "size": 12897, "upload_time": "2019-07-23T10:52:12", "url": "https://files.pythonhosted.org/packages/7a/f8/699edcf938cd703b14157923ad2221e6175399a60c30bc678fe39c8864de/netatmo2influxdb-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5eac6eb95642ea5999d80c9e91190185", "sha256": "c3929f1fdafd681b561710cb1f47ecf6a2269240982c24061c716538ad25e6f5" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5eac6eb95642ea5999d80c9e91190185", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7.0", "size": 12375, "upload_time": "2019-07-23T10:52:10", "url": "https://files.pythonhosted.org/packages/2d/71/c28b0912b0cfffa935974dfacd8db712d074eae2a92d6c4ddcdc5989f8cb/netatmo2influxdb-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "91b9be9273f8348bc4616c0b8d247cef", "sha256": "0a6e5dbed58a78be0a1ca7d88b04035b17badd8cea9879770bafda72c4621ea6" }, "downloads": -1, "filename": "netatmo2influxdb-0.1.2.tar.gz", "has_sig": false, "md5_digest": "91b9be9273f8348bc4616c0b8d247cef", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7.0", "size": 12897, "upload_time": "2019-07-23T10:52:12", "url": "https://files.pythonhosted.org/packages/7a/f8/699edcf938cd703b14157923ad2221e6175399a60c30bc678fe39c8864de/netatmo2influxdb-0.1.2.tar.gz" } ] }