{ "info": { "author": "Benoit Delbosc", "author_email": "bdelbosc@free.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python :: 3.7", "Topic :: System :: Hardware" ], "description": "# BrewBlox iSpindel service\n\nThis a BrewBlox service to support [iSpindel](https://github.com/universam1/iSpindel/)\nan electronic hydrometer.\n\n\nThis project is under active development.\n\n\n## How does it work ?\n\nThe iSpindel is configured to send metrics using the generic HTTP POST protocol.\n\nWhen the iSpindel wake up (like every minute) it submits a POST request containing the metrics to the iSpindel BrewBlox service.\n\nThe service then publish metrics to the event-bus, the BrewBlox history service is in charge to persist the metrics into the InfluxDB database.\n\n## Configuration\n\n### Deploy the iSpindel service on the BrewBlox stack\n\n\nYou need to add the service to your existing BrewBlox docker compose file.\n\n```yaml\n ispindel:\n image: bdelbosc/brewblox-ispindel:rpi-latest\n depends_on:\n - history\n labels:\n - \"traefik.port=5000\"\n - \"traefik.frontend.rule=PathPrefix: /ispindel\"\n```\n\nThe `brewblox-ispindel` docker images are available on docker hub.\n\nNote that the image tag to use is:\n- `rpi-latest` for the `arm` architecture (when deploying on a RaspberryPi)\n- `latest` for the `amd` architecture\n\n### Configure the iSpindel\n\nThe `brewblox-ispindel` endpoint needs to be accessible in `HTTP`,\nyou need to find the `IP` address and `PORT` where the service:\n[http://IP:PORT/ispindel/_service/status](http://IP:PORT/ispindel/_service/status)\nreply with a: \n```json\n{\"status\": \"ok\"}\n```\nThen:\n- Switch the iSpindel on\n- Press the reset button 3-4 times which sets up an access point\n- Connect to the Wifi network \"iSpindel\"\n- Open a browser on [http://192.168.4.1](http://192.168.4.1)\n- From the \"Configuration\" menu, configure the Wifi access, then\n - Service Type: `HTTP`\n - Token:\n - Server Address: ``\n - Server Port: ``\n - Server URL: `/ispindel/ispindel`\n\n\nDouble check that your are using an HTTP service type (and not a TCP).\n\n### Add Graph to your dashboard\n\nFrom your dashboard `ACTIONS > New Widget` then select and create a `Graph` widget.\n\nOnce the iSpindel is configured to send data to BrewBlox, you should see its metrics when configuring the widget:\n\n![graph-ispindel](./graph-ispindel.png)\n\n \n## Development\n\n### Run tests\n\n```bash\n# install pip3 if not already done\nsudo pip3 install pipenv\n\n# init the env\npipenv lock\npipenv sync -d\n\n# Run the tests\npipenv run pytest\n```\n\n### Build a docker image\n\n1. Install the [brewblox-tools](https://github.com/BrewBlox/brewblox-tools)\n\n2. Go into the brewblox-ispindel directory and build the `rpi-latest` image\n```bash\nbbt-localbuild -r bdelbosc/brewblox-ispindel --tags latest -a arm\n```\n\nUse `-a amd` to build the `latest` image for amd architecture.\n\n### Simulate iSpindel request\n\nFrom the BrewBlox host:\n\n```bash\ncurl -XPOST http://localhost:9000/ispindel/ispindel\n-d'{\"name\":\"iSpindel000\",\"ID\":4974097,\"angle\":83.49442,\"temperature\":21.4375,\"temp_units\":\"C\",\"battery\":4.035453,\"gravity\":30.29128,\"interval\":60,\"RSSI\":-76}'\n```\n\n### Check iSpindel service logs\n\nEach time the service receive a request there is a log showing the temperature and gravity.\nTo run from the directory containing the `docker-compose.yml` file.\n\n```bash\ndocker-compose logs ispindel\n...\nispindel_1 | 2019/04/12 14:18:34 INFO __main__ iSpindel iSpindel000, temp: 21.75, gravity: 22.63023\nispindel_1 | 2019/04/12 14:19:05 INFO __main__ iSpindel iSpindel000, temp: 21.6875, gravity: 22.69526\n```\n\n### View iSpindel metrics persisted in the influxdb database\n\nTo run from the directory containing the `docker-compose.yml` file.\n\n```sql\ndocker-compose exec influx influx\n> USE brewblox\n> SHOW SERIES\nkey\n---\niSpindel000 -- This is the name given to the iSpindel\nsparkey\nspock\n\n> SELECT * FROM \"iSpindel000\"\nname: iSpindel000\ntime angle battery gravity rssi temperature\n---- ----- ------- ------- ---- -----------\n1546121491626257000 83.49442 4.035453 30.29128 -76 21.4375\n1546121530861939000 84.41665 4.035453 30.75696 -75 19.125\n\n> -- Latest metrics \n> PRECISION rfc3339\n> SELECT * FROM \"iSpindel000\" WHERE time > now() -5m ORDER BY time DESC LIMIT 10\ntime Combined Influx points angle battery gravity rssi temperature\n---- ----------------------- ----- ------- ------- ---- -----------\n2019-04-12T14:15:29.715678Z 1 71.6947 4.233577 22.67045 -68 21.9375\n2019-04-12T14:14:58.997279Z 1 71.58447 4.233577 22.51496 -67 21.9375\n\n```\n\n### [azure-pipelines.yml](./azure-pipelines.yml)\n\n[Azure](https://dev.azure.com) can automatically test and deploy all commits you push to GitHub. If you haven't enabled travis for your repository: don't worry, it won't do anything.\n\nTo deploy your software, you will also need [PyPi](https://pypi.org/) and [Docker Hub](https://hub.docker.com/) accounts.\n\n## TODO\n\n- Give a docker-compose configuration to expose the service in http (default is now https which is not supported by iSpindel)\n- Support an HTTP token that can be set in the docker-compose file.\n\n## Limitations\n\n- There is no security on the iSpindel endpoint", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bdelbosc/brewblox-ispindel", "keywords": "brewing brewpi brewblox embedded plugin service ispindel hydrometer", "license": "", "maintainer": "", "maintainer_email": "", "name": "brewblox-ispindel", "package_url": "https://pypi.org/project/brewblox-ispindel/", "platform": "", "project_url": "https://pypi.org/project/brewblox-ispindel/", "project_urls": { "Homepage": "https://github.com/bdelbosc/brewblox-ispindel" }, "release_url": "https://pypi.org/project/brewblox-ispindel/0.2.0/", "requires_dist": null, "requires_python": ">=3.7", "summary": "", "version": "0.2.0" }, "last_serial": 5159806, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "21b991af55a99e63149d27bf4f41f534", "sha256": "8220eed476270d6101d21b6a87e55f7a6f60f21b6af72d27001b1516a50abe9b" }, "downloads": -1, "filename": "brewblox-ispindel-0.2.0.tar.gz", "has_sig": false, "md5_digest": "21b991af55a99e63149d27bf4f41f534", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 5798, "upload_time": "2019-04-18T11:33:25", "url": "https://files.pythonhosted.org/packages/dd/26/1e927707e1db32477e3b203fd82cc6fa492b06828f326eee6cb134ea32c7/brewblox-ispindel-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "21b991af55a99e63149d27bf4f41f534", "sha256": "8220eed476270d6101d21b6a87e55f7a6f60f21b6af72d27001b1516a50abe9b" }, "downloads": -1, "filename": "brewblox-ispindel-0.2.0.tar.gz", "has_sig": false, "md5_digest": "21b991af55a99e63149d27bf4f41f534", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 5798, "upload_time": "2019-04-18T11:33:25", "url": "https://files.pythonhosted.org/packages/dd/26/1e927707e1db32477e3b203fd82cc6fa492b06828f326eee6cb134ea32c7/brewblox-ispindel-0.2.0.tar.gz" } ] }