{ "info": { "author": "Edward Moyse", "author_email": "edward.moyse@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Introduction\n============\n\nIndigoRESTWrapper is intended to provide more complete access to the information in the Indigo database.\n\nThis is a (completely unauthorized) wrapper for Indigo (http://www.indigodomo.com/), using \nDjango (https://www.djangoproject.com/) and Django-rest-framework (http://www.django-rest-framework.org/).\n\nIt can do two things:\n - wrap (some of) the current REST calls, in case you'd like different authentication (the authentication provided by django \n REST is detailed here: http://www.django-rest-framework.org/api-guide/authentication/)\n - provide a few new acccessors, such as retrieving a device by its 'id' and also providing a view of the history of a device.\n\nTechnically it works by either just calling the current Indigo REST api, or for information which isn't available there, scanning the database file(s).\n\nCurrently available APIs:\n - http://localhost:8000/devices/ \n - returns a list of all the details about all the devices. It's more detailed than Indigo's devices.json, but it's cached and so some values will certainly be out of date. However, you can use device_history to get this information.\n - http://localhost:8000/device/1838057829/\n - Complete information about the device with the matching device id. This is also cached and so some values will certainly be out of date. You can use device_history to get this information though.\n - http://localhost:8000/device_history/1838057829/\n - The history of the device. The exact format will depend on the type, but it will typically be a ts\n\nThere are also some which wrap the current Indigo API. The big problem here is simply that currently IndigoRESTWrapper can't interact with Indigo if Indigo is protected with authentication. This should be possible to fix relatively quickly, but one option is to block any access to indigo's port via your router's firewall, and then it doesn't matter so much that Indigo is unprotected.\n - http://localhost:8000/indigo_devices/\n - ... more to come\n\nInstallation\n============\nBefore you start\n----------------\n\nIf you don't know Django at all, you might want to follow the Django tutorial first:\nhttps://docs.djangoproject.com/en/1.9/intro/\n\nYou should make sure you have an up-to-date version of pip:\n\n.. code:: bash\n\n [sudo] pip install -U pip\n\nInstall virtualenv and virtualenvwrapper (if you haven't already):\n\n.. code:: bash\n\n [sudo] pip install virtualenv\n [sudo] pip install virtualenvwrapper\n\nBTW on default OSX pip installs to :\n/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh\n\nMore details are here: http://virtualenvwrapper.readthedocs.org/ but a short version might be:\n\n.. code:: bash\n\n cd $HOME\n mkdir .virtualenvs\n nano .bash_login\n\nand to .bash_login you could add the following:\n\n.. code:: bash\n\n export PROJECT_HOME=$HOME/Documents\n export PIP_PATH=/Library/Frameworks/Python.framework/Versions/2.7\n export WORKON_HOME=$HOME/.virtualenvs\n export VIRTUALENVWRAPPER_VIRTUALENV=$PIP_PATH/bin/virtualenv\n export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'\n export PATH=$PATH:$PIP_PATH/bin\n source $PIP_PATH/bin/virtualenvwrapper.sh\n\nThe we need to set up the virtualenv:\n\n.. code:: bash\n\n mkvirtualenv indigorestserver\n workon indigorestserver\n\nInstalling Django and django-indigorestwrapper\n----------------------------------------------\n\nFirst make a work directory:\n\n.. code:: bash\n\n cd Documents\n mkdir IndigoRestWrapper\n cd IndigoRestWrapper\n\nTo install it you need to first install some dependencies:\n\n.. code:: bash\n\n pip install django\n pip install djangorestframework\n\nTo check this package out now do:\n\n.. code:: bash\n\n pip install django-indigorestwrapper\n\nCreate a new project:\n\n.. code:: bash\n\n django-admin startproject mysite\n\nEdit mysite/settings.py.\n\nAdd the following to INSTALLED_APPS:\n\n.. code:: python\n\n 'rest_framework',\n 'indigorestwrapper',\n\nDATABASES should look like:\n\n.. code:: python\n\n DATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),\n },\n 'indigo_db': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': os.path.join(BASE_DIR, '/Library/Application Support/Perceptive Automation/Indigo 6/Logs/indigo_history.sqlite'),\n }\n }\n\n(actually you're free to use whichever DB you prefer for default, but I'm keeping it sqlite3 for the benefit of this tutrorial)\n\nAt the end add:\n\n.. code:: python\n\n REST_FRAMEWORK = {\n # Use Django's standard `django.contrib.auth` permissions,\n # or allow read-only access for unauthenticated users.\n 'DEFAULT_PERMISSION_CLASSES': (\n 'rest_framework.permissions.IsAuthenticated',\n ),\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n 'rest_framework.authentication.TokenAuthentication',\n 'rest_framework.authentication.SessionAuthentication',\n ),\n }\n # INDIGO_URL = 'http://myserver.com:8176'\n INDIGO_URL = 'http://127.0.0.1:8176'\n\nYou might need to update the location for indigo_db in the DATABASES section (though what is above is the default) and INDIGO_URL at the end, to tell it where to find the indigo server.\n\nThen, in the project directory, do:\n\n.. code:: bash\n\n ./manage.py migrate \n ./manage.py makemigrations\n\nAnd finally, to try to grab the device data from indigo, do:\n\n.. code:: bash\n\n ./manage.py updateindigodb\n\n(Currently this requires indigo to be unprotected - you could always disable it to run this command, then re-enable it when done - though of course any forwarding of indigo commands will not work once the server is password protected again)\n\nNow you should be able to get a server up and running using:\n\n.. code:: bash\n\n ./manage.py runserver\n\n(This is just for debugging - you should really set something up with e.g. Apache)", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/EdwardMoyse/django-indigorestwrapper", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-indigorestwrapper", "package_url": "https://pypi.org/project/django-indigorestwrapper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-indigorestwrapper/", "project_urls": { "Homepage": "https://github.com/EdwardMoyse/django-indigorestwrapper" }, "release_url": "https://pypi.org/project/django-indigorestwrapper/0.6/", "requires_dist": null, "requires_python": "", "summary": "This is a (completely unauthorized) REST wrapper for the Indigo home automation application, using Django and Django-rest-framework.", "version": "0.6" }, "last_serial": 2095605, "releases": { "0.6": [ { "comment_text": "", "digests": { "md5": "b752fd9a7b711d860726217b78977c0a", "sha256": "d7fb98cb4e06449368cfbc44279f7a4b6eaf4ee269ba63567c9418435eec066b" }, "downloads": -1, "filename": "django-indigorestwrapper-0.6.tar.gz", "has_sig": false, "md5_digest": "b752fd9a7b711d860726217b78977c0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11896, "upload_time": "2016-05-02T19:19:15", "url": "https://files.pythonhosted.org/packages/0e/9e/4723dee4f0021f833e156a71502998bcea3049c5b23154a435bfb965355b/django-indigorestwrapper-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b752fd9a7b711d860726217b78977c0a", "sha256": "d7fb98cb4e06449368cfbc44279f7a4b6eaf4ee269ba63567c9418435eec066b" }, "downloads": -1, "filename": "django-indigorestwrapper-0.6.tar.gz", "has_sig": false, "md5_digest": "b752fd9a7b711d860726217b78977c0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11896, "upload_time": "2016-05-02T19:19:15", "url": "https://files.pythonhosted.org/packages/0e/9e/4723dee4f0021f833e156a71502998bcea3049c5b23154a435bfb965355b/django-indigorestwrapper-0.6.tar.gz" } ] }