A simple http server written to interact with a Lutron Caseta Wireless Smart Bridge to list and activate scenes (and possibly devices in the future) via http
- Clone the Repository
$ git clone https://github.com/michaelgaultjr/pylutron_server.git
- Enter Directory
$ cd pylutron_server
- Install required packages
$ pip3 install -r requirements.txt
- Set
BRIDGE_HOST
environment variable (in.env
orexport
)
BRIDGE_HOST=(your lutron bridge ip)
- Press the pairing button on your Lutron Caseta Bridge then run
get_certs.py
(not required if you already have the certificates)
$ python3 get_certs.py
- Start server
$ python3 main.py
# Required
BRIDGE_HOST="192.168.1.1" # Lutron Castea Bridge IP
# Optional
HOST="0.0.0.0" # Server Host
PORT=8080 # Server Port
CASETA_KEY="caseta.key" # Lutron Caseta Certificate Key File
CASETA_CERT="caseta.crt" # Lutron Caseta Certificate File
BRIDGE_CERT="caseta-bridge.crt" # Lutron Caseta Bridge Certificate File
LEAP_PORT=8081 # Lutron Caseta LEAP Protocol Port
By default navigating to http://localhost:8080
will provide you with a simple web interface with a list of the scenes and their ids, and an Activate
button to activate the respetive scene.
GET /api/scenes
Returns a json array of scene ids.
-
Success Response:
- Code:
200
Content:["1", "2", "3"]
- Code:
POST /api/scenes
Activates a scene and returns scene id.
-
JSON Body Properties
scene_id
:string
-
Success Response:
- Code: 200
Content:{scene_id}
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:Scene '{scene_id}' not found"
OR
- Code: 400 BAD REQUEST
Content:No 'scene_id' provided
OR
- Code: 400 BAD REQUEST
Content:No body
- Code: 404 NOT FOUND