Skip to content

A small http server for controlling a Lightpack via Prismatik's API

License

Notifications You must be signed in to change notification settings

jgillman/lightpack-prismatik-http-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightpack + Prismatik HTTP API

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.

Install

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

Configure

Update the variables in mypack/__init__.py if you use a different host/port or use an api_key.

Usage

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"

Responses

Successful requests get a 200 with a body of JSON:

{
  'power': 'on',
  'profile': 'Lightpack'
}

Bad requests get a 404 with no body.


Disclaimer

  1. This is the first Python I've ever written and I make no claims to it's quality or style.
  2. I wrote this for myself so its portability between systems is questionable at best 😄

About

A small http server for controlling a Lightpack via Prismatik's API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages