diff --git a/.gitignore b/.gitignore index 3d675c2..cffdafc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -config.json +config.py lib/__pycache__/ diff --git a/__pycache__/config.cpython-38.pyc b/__pycache__/config.cpython-38.pyc new file mode 100644 index 0000000..1283e75 Binary files /dev/null and b/__pycache__/config.cpython-38.pyc differ diff --git a/config_default.json b/config_default.json deleted file mode 100644 index f9d15ad..0000000 --- a/config_default.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "username": "YOUR USERNAME HERE", - "address": "IP ADDRESS FOR THE HUE BRIDGE" -} diff --git a/default-config.py b/default-config.py new file mode 100644 index 0000000..d19f394 --- /dev/null +++ b/default-config.py @@ -0,0 +1,2 @@ +address = "" +username = "" diff --git a/hue_controller.py b/hue_controller.py new file mode 100644 index 0000000..18d5f55 --- /dev/null +++ b/hue_controller.py @@ -0,0 +1,15 @@ +import requests as req # Used for HTTP requests for the Hue API +import json # API uses JSON +import config # Configuration for the controller + +def genUrl(params: str): + return "https://" + config.address + "/api/" + config.username + params + +def API_Request(ReqType: str, params: str): + apiReq = req.Request( ReqType, genUrl(params) ) + + apiReqPrep = apiReq.prepare() + apiSession = req.Session() + apiSession.send(apiReqPrep) + + diff --git a/hue-controller.py b/main.py similarity index 52% rename from hue-controller.py rename to main.py index 7248506..4fad088 100755 --- a/hue-controller.py +++ b/main.py @@ -1,8 +1,9 @@ #!/usr/bin/env python - -import requests as req # Used for HTTP requests for the Hue API - from lib.input import * # Commandline parser +import hue_controller # Actual controller + +def init(): +init()