A small http server for controlling a Lightpack via Prismatik's API.
I'm using it in conjunction with homebridge-http so that I can control my Lightpack via HomeKit and Siri.
Clone the repo
git clone [email protected]:jgillman/lightpack-prismatik-http-api.git lightpack
Set up the virtualenv
virtualenv lightpack
cd lightpack
source bin/activate
Install the requirements
pip install -r requirements.txt
Update the variables in mypack/__init__.py
if you use a different host/port
or use an api_key.
Get the current status (as json):
$ curl "http://localhost:8080/lightpack"
Turn it on:
curl "http://localhost:8080/lightpack/on"
Turn it off:
curl "http://localhost:8080/lightpack/off"
Change to profile PROFILE_NAME
:
curl "http://localhost:8080/lightpack/profile/PROFILE_NAME"
Successful requests get a 200 with a body of JSON:
{
'power': 'on',
'profile': 'Lightpack'
}
Bad requests get a 404 with no body.
- This is the first Python I've ever written and I make no claims to it's quality or style.
- I wrote this for myself so its portability between systems is questionable at best 😄