{ "info": { "author": "Robert Wolterman", "author_email": "robert.wolterman@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Home Automation", "Topic :: Software Development", "Topic :: System :: Hardware" ], "description": "chip_python_aREST\n============================\nA REST API for controlling CHIP GPIO\n\nManual::\n\nFor Python2.7::\n\n sudo apt-get update\n sudo apt-get install git build-essential python-dev python-pip flex bison python-flask -y\n git clone https://github.com/xtacocorex/chip_python_aREST.git\n cd chip_python_aREST\n sudo python setup.py install\n\nFor Python3::\n\n sudo apt-get update\n sudo apt-get install git build-essential python3-dev python3-pip flex bison python-flask -y\n git clone https://github.com/xtacocorex/chip_python_aREST.git\n cd chip_python_aREST\n sudo python3 setup.py install\n\nCHIP_IO is required to use this library, code and instructions are here: https://github.com/xtacocorex/CHIP_IO\nScripts using this library will need to be run with root permissions (sudo or started at boot by init script).\n\nThis library is also available on pypi and can be installed via pip/pip3.:\n\n # Python2\n sudo pip install chip-python-aREST\n # Python3\n sudo pip3 install chip-python-aREST\n\nUsage\n--------\n\n**Example Script**\n\nThe following is an example script that details a basic way to instantiate the REST API on your CHIP::\n\n import CHIP_aREST.aREST as aREST\n\n # Setup the id\n # The id is a special identifier for your CHIP\n aREST.set_id('5gad42')\n\n # Setup the name\n # The name can be anything you want\n aREST.set_name(\"My Local CHIP\")\n\n # Setup the hardware type\n # Not really needed until CHIP_IO get CHIP Pro support\n aREST.set_hardware(\"chip\")\n\n # This is where any variables and functions would be setup\n\n # Start the API\n # Debug can be turned on/off\n # Keep the host 0.0.0.0 to allow for local network access\n # Port can be whatever you want it to be\n aREST.RestApp(host=\"0.0.0.0\"PeepOpenort=3000,debug=True)\n\nThe API also supports user specified variables and functions::\n\n # First create the variable\n temperature = 25.2\n # Then add it to the API\n aREST.variable(\"temperature\",temperature)\n\n # For funtions, we need to define it first\n # Functions can have arguments and they can be fed in with url parameters\n def myfunction():\n # you can do whatever you want here\n # CHIP_IO Specific calls\n # crazy math\n # or in this case\n return \"myfunction was called, howdy!\"\n\n # Now we add it to the API\n # Make sure you don't add the () to the function\n aREST.function(\"functiontest\",myfunction)\n\nCloud features TBD.\n\nExample scripts are found in the examples folder. They are also installed into /usr/local/bin/.\n\nREST API\n---------\n\nFor local instances of the API, you can access the CHIP via:\n\n http://192.168.0.5:3000/\n\nReplace the IP address with the one for your CHIP. If you have avahi installed on your CHIP, you can replace the IP address with .local.\n\nAll of the REST API are detailed in the tables below. Note the HTTP Method used for the call. Not everything uses a normal HTTP GET method.\n\nIf you use a web browser to send the URL to the CHIP, you are limited to the GET method.\n\nThe curl program installed in Linux or MacOS/OS X can be used to test the API::\n\n curl -X GET http://chipdev.local:3000/digital/csid0/1\n curl -X GET http://chipdev.local:3000/temperature\n curl -X PUT http://chipdev.local:3000/temperature?value=-24.2\n\n**Basics**\n\n +------------------+-------------------------------+------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | / | Basic Info |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /id | Basic Info |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /debug | Dump all data |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | / | Get value of |\n +------------------+-------------------------------+------------------------------------------------------+\n | DELETE | / | Delete |\n +------------------+-------------------------------+------------------------------------------------------+\n | PUT, POST | /?value= | Set to |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | / | Get value of |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /?value= | Get value of with as input |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /version | Get current CHIP_IO version |\n +------------------+-------------------------------+------------------------------------------------------+\n\n**GPIO**\n\n +------------------+-------------------------------+------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET, PUT, POST | /digital//[0,1] | Digital Write 0 or 1 to |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /digital/ | Digital Read |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /digital//r | Digital Read |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /digital/cleanup | Cleanup all GPIO Pins |\n +------------------+-------------------------------+------------------------------------------------------+\n | GET | /digital/cleanup/ | Cleanup only GPIO Pin: |\n +------------------+-------------------------------+------------------------------------------------------+\n\n**PWM**\n\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | GET | /pwm/0/start?duty_cycle=[0.0-100.0]&frequency= | Start PWM0 with duty cycle and frequency. duty_cycle and frequency are optional, they default to 25.0% and 200.0 |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | GET | /pwm/0/stop | Stop PWM0 |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | GET | /pwm/0/cleanup | Cleanup PWM0 |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | GET, PUT, POST | /pwm/0/duty_cycle/[0.0-100.0] | Change PWM0 Duty Cycle |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n | GET, PUT, POST | /pwm/0/frequency/ | Change PWM0 Frequency |\n +------------------+-----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+\n\n**Software PWM**\n\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | GET | /softpwm//start?duty_cycle=[0.0-100.0]&frequency= | Start SoftPWM on with duty cycle and frequency. duty_cycle and frequency are optional, they default to 25.0% and 35.0 |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | GET | /softpwm//stop | Stop SoftPWM on |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | GET | /softpwm//cleanup | Cleanup SoftPWM on |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | GET, PUT, POST | /softpwm//duty_cycle/[0.0-100.0] | Change SoftPWM Duty Cycle on |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n | GET, PUT, POST | /softpwm//frequency/ | Change SoftPWM Frequency on |\n +------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n\n**LRADC**\n\n +------------------+-------------------------------------------+------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET, PUT, POST | /analog/sample_rate/[32.25,62.5,125,250] | Set LRADC Sample Rate to 32.25, 62.5, 125, or 250 |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /analog/sample_rate | Get currrent LRADC Sample Rate |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /analog/scale_factor | Get LRADC Scale Factor |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /analog/raw/[0,1] | Get raw LRADC output for channel 0 or 1 |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /analog/full/[0,1] | Get full LRADC output for channel 0 or 1 |\n +------------------+-------------------------------------------+------------------------------------------------------+\n\n **Utilities**\n\n +------------------+-------------------------------------------+------------------------------------------------------+\n | **Method** | **Command** | **Description** |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET, PUT, POST | /1v8_pin/enable/[1.8,2.0,2.6,3.3] | Enable 1.8V Pin to output 1.8, 2.0, 2.6, or 3.3V |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /1v8_pin/voltage | Get currrent 1.8V Pin voltage setting |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /1v8_pin/disable | Disable 1.8V Pin |\n +------------------+-------------------------------------------+------------------------------------------------------+\n | GET | /unexport_all | Backup function to unexport all GPIO |\n +------------------+-------------------------------------------+------------------------------------------------------+\n\nCredits\n--------\n\nMarco Schwartz for the original pi-aREST node.js code that was used as a basis for this code.\n(https://github.com/marcoschwartz/pi-aREST)\n\nLicense\n-------\n\nCHIP Python aREST by Robert Wolterman, released under the MIT License.\n0.3.0\n----\n* SERVO support\n* CHIP Pro support\n\n0.2.1\n----\n* Python3 Fixes\n\n0.2.0\n----\n* Finished the encapsulation\n* PWM and SoftPWM added\n* Variable Delete\n* Functions verified\n* README updates\n\n0.1.3\n----\n* Encapsulated everything into the class since it keeps everything cleaner\n - By doing this, I cleaned up the actual Flask decorator code\n\n0.1.2\n----\n* Added per pin cleanup code\n* Added debug hook to return all the data\n\n0.1.1\n----\n* Added digital read/write capability\n* Added digital cleanup capability\n\n0.1.0\n----\n* Initial stab at getting this to work\n - REST API info\n - Custom Variables\n - Custom Functions (untested)\n - CHIP_IO Version\n - CHIP_IO LRADC control and status\n - CHIP_IO Utilities for 1.8VDC Pin Control and unexporting all the GPIO Pins\n* Basic example script (gets installed to /usr/bin)\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/xtacocorex/CHIP_aREST/", "keywords": "CHIP CHIPPRO NextThingCo IO GPIO PWM ADC SERVO REST", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "CHIP-aREST", "package_url": "https://pypi.org/project/CHIP-aREST/", "platform": "", "project_url": "https://pypi.org/project/CHIP-aREST/", "project_urls": { "Homepage": "https://github.com/xtacocorex/CHIP_aREST/" }, "release_url": "https://pypi.org/project/CHIP-aREST/0.3/", "requires_dist": [ "flask", "CHIP-IO", "requests", "paho-mqtt" ], "requires_python": "", "summary": "A module to control the CHIP IO channels via a REST API", "version": "0.3" }, "last_serial": 3422185, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "43c886a599f0dead6a5d2c09ec872139", "sha256": "2e918f4241540aa88e95f0a751243d1d2b1846092e895d6cb4ba8b29a972a6dd" }, "downloads": -1, "filename": "CHIP_aREST-0.2.0.tar.gz", "has_sig": false, "md5_digest": "43c886a599f0dead6a5d2c09ec872139", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16755, "upload_time": "2017-02-01T02:45:37", "url": "https://files.pythonhosted.org/packages/03/34/263d67479ef9885c47d92151d460631848aeac9581c4b5bf0ab02283df39/CHIP_aREST-0.2.0.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "2636b1e15b2822ea4950757e0d6d3260", "sha256": "9839b6656faa91d3a1393eb48cc126627dd59445f444639091a47b19847580f3" }, "downloads": -1, "filename": "CHIP_aREST-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2636b1e15b2822ea4950757e0d6d3260", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14443, "upload_time": "2017-12-16T19:52:48", "url": "https://files.pythonhosted.org/packages/55/2f/b06646c596a589193652e7c0f7525bea0537806146c9c163a604c028f5d3/CHIP_aREST-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6159b1e2cc8b555ff63fd9a86e15b9c1", "sha256": "31a8bd827fec12dcea46fe54649b0407fef33aed822c61e7e69ef2898a9f7acb" }, "downloads": -1, "filename": "CHIP_aREST-0.3.tar.gz", "has_sig": false, "md5_digest": "6159b1e2cc8b555ff63fd9a86e15b9c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17193, "upload_time": "2017-12-16T19:52:49", "url": "https://files.pythonhosted.org/packages/74/c0/164b827847ca63492f93705af6a298df82e98e4292c09511d6d8a7016235/CHIP_aREST-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2636b1e15b2822ea4950757e0d6d3260", "sha256": "9839b6656faa91d3a1393eb48cc126627dd59445f444639091a47b19847580f3" }, "downloads": -1, "filename": "CHIP_aREST-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2636b1e15b2822ea4950757e0d6d3260", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14443, "upload_time": "2017-12-16T19:52:48", "url": "https://files.pythonhosted.org/packages/55/2f/b06646c596a589193652e7c0f7525bea0537806146c9c163a604c028f5d3/CHIP_aREST-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6159b1e2cc8b555ff63fd9a86e15b9c1", "sha256": "31a8bd827fec12dcea46fe54649b0407fef33aed822c61e7e69ef2898a9f7acb" }, "downloads": -1, "filename": "CHIP_aREST-0.3.tar.gz", "has_sig": false, "md5_digest": "6159b1e2cc8b555ff63fd9a86e15b9c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17193, "upload_time": "2017-12-16T19:52:49", "url": "https://files.pythonhosted.org/packages/74/c0/164b827847ca63492f93705af6a298df82e98e4292c09511d6d8a7016235/CHIP_aREST-0.3.tar.gz" } ] }