diff --git a/NeewerLite-Python.py b/NeewerLite-Python.py
index f321ee8..4dd5397 100644
--- a/NeewerLite-Python.py
+++ b/NeewerLite-Python.py
@@ -2,7 +2,7 @@
## NeewerLite-Python
## by Zach Glenwright
#############################################################
-## > https://github.com/taburineagle/Neewer-PythonLite <
+## > https://github.com/taburineagle/NeewerLite-Python/ <
#############################################################
## A cross-platform Python script using the bleak and
## PySide2 libraries to control Neewer brand lights via
@@ -1137,10 +1137,10 @@ def do_GET(self):
return
else:
# CHECK THE LENGTH OF THE URL REQUEST AND SEE IF IT'S TOO LONG
- if len(self.path) > 150:
+ if len(self.path) > 159: # INCREASED LENGTH DUE TO ADDITION OF doAction IN THE URL
# THE LAST REQUEST WAS WAY TOO LONG, SO QUICKLY RENDER AN ERROR PAGE AND RETURN FROM THE HTTP RENDERER
writeHTMLSections(self, "header")
- writeHTMLSections(self, "errorHelp", "The last request you provided was too long! The NeewerLite-Python HTTP server can only accept URL commands less than 132 characters long after /NeewerLite-Python/.")
+ writeHTMLSections(self, "errorHelp", "The last request you provided was too long! The NeewerLite-Python HTTP server can only accept URL commands less than 132 characters long after /NeewerLite-Python/doAction?.")
writeHTMLSections(self, "footer")
return
@@ -1167,7 +1167,7 @@ def do_GET(self):
self.send_error(403, "The IP of the device you're making the request from (" + clientIP + ") has to be in the list of accepted IP addresses in order to use the NeewerLite-Python HTTP Server, any outside addresses will generate this Forbidden error. To use this device with NeewerLite-Python, add its IP address (or range of IP addresses) to the list of acceptable IPs")
return
- acceptableURL = "/NeewerLite-Python/"
+ acceptableURL = "/NeewerLite-Python/doAction?"
if not acceptableURL in self.path: # if we ask for something that's not the main directory, then redirect to the main error page
self.send_response(302)
@@ -1175,7 +1175,7 @@ def do_GET(self):
self.end_headers()
return
- else: # if the URL contains "/NeewerLite-Python/" then it's a valid URL
+ else: # if the URL contains "/NeewerLite-Python/doAction?" then it's a valid URL
writeHTMLSections(self, "header")
# BREAK THE URL INTO USABLE PARAMTERS
@@ -1217,7 +1217,7 @@ def do_GET(self):
totalLights = len(availableLights)
if totalLights == 0: # there are no lights available to you at the moment!
- self.wfile.write(bytes("NeewerLite-Python is not currently set up with any Neewer lights. To discover new lights, click here.
", "utf-8"))
+ self.wfile.write(bytes("NeewerLite-Python is not currently set up with any Neewer lights. To discover new lights, click here.
", "utf-8"))
else:
self.wfile.write(bytes("List of available Neewer lights:
", "utf-8"))
self.wfile.write(bytes("", "utf-8"))
@@ -1266,39 +1266,39 @@ def writeHTMLSections(self, theSection, errorMsg = ""):
self.wfile.write(bytes(errorMsg + "
", "utf-8"))
self.wfile.write(bytes("Valid parameters to use -
", "utf-8"))
self.wfile.write(bytes("list - list the current lights NeewerPython-Lite has available to it
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/list
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?list
", "utf-8"))
self.wfile.write(bytes("discover - tell NeewerLite-Python to scan for new lights
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/discover
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?discover
", "utf-8"))
self.wfile.write(bytes("link= - (value: index of light to link to) manually link to a specific light - you can specify multiple lights with semicolons (so link=1;2 would try to link to both lights 1 and 2)
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/link=1
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?link=1
", "utf-8"))
self.wfile.write(bytes("light= - the MAC address (or current index of the light) you want to send a command to - you can specify multiple lights with semicolons (so light=1;2 would send a command to both lights 1 and 2)
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/light=11:22:33:44:55:66
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?light=11:22:33:44:55:66
", "utf-8"))
self.wfile.write(bytes("mode= - the mode (value: HSI, CCT, and either ANM or SCENE) - the color mode to switch the light to
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/mode=CCT
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?mode=CCT
", "utf-8"))
self.wfile.write(bytes("(CCT mode only) temp= or temperature= - (value: 3200 to 8500) the color temperature in CCT mode to set the light to
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/temp=5200
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?temp=5200
", "utf-8"))
self.wfile.write(bytes("(HSI mode only) hue= - (value: 0 to 360) the hue value in HSI mode to set the light to
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/hue=240
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?hue=240
", "utf-8"))
self.wfile.write(bytes("(HSI mode only) sat= or saturation= - (value: 0 to 100) the color saturation value in HSI mode to set the light to
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/sat=65
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?sat=65
", "utf-8"))
self.wfile.write(bytes("(ANM/SCENE mode only) scene= - (value: 1 to 9) which animation (scene) to switch the light to
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/scene=3
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?scene=3
", "utf-8"))
self.wfile.write(bytes("(CCT/HSI/ANM modes) bri=, brightness= or intensity= - (value: 0 to 100) how bright you want the light
", "utf-8"))
- self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/brightness=80
", "utf-8"))
+ self.wfile.write(bytes(" Example: http://(server address)/NeewerLite-Python/doAction?brightness=80
", "utf-8"))
self.wfile.write(bytes("
More examples -
", "utf-8"))
self.wfile.write(bytes(" Set the light with MAC address 11:22:33:44:55:66 to CCT mode, with a color temperature of 5200 and brightness of 40
", "utf-8"))
- self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/light=11:22:33:44:55:66&mode=CCT&temp=5200&bri=40
", "utf-8"))
+ self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/doAction?light=11:22:33:44:55:66&mode=CCT&temp=5200&bri=40
", "utf-8"))
self.wfile.write(bytes(" Set the light with MAC address 11:22:33:44:55:66 to HSI mode, with a hue of 70, saturation of 50 and brightness of 10
", "utf-8"))
- self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/light=11:22:33:44:55:66&mode=HSI&hue=70&sat=50&bri=10
", "utf-8"))
+ self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/doAction?light=11:22:33:44:55:66&mode=HSI&hue=70&sat=50&bri=10
", "utf-8"))
self.wfile.write(bytes(" Set the first light available to SCENE mode, using the first animation and brightness of 55
", "utf-8"))
- self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/light=1&mode=SCENE&scene=1&bri=55
", "utf-8"))
+ self.wfile.write(bytes(" http://(server address)/NeewerLite-Python/doAction?light=1&mode=SCENE&scene=1&bri=55
", "utf-8"))
elif theSection == "footer":
footerLinks = "Shortcut links: "
- footerLinks = footerLinks + "Scan for New Lights | "
- footerLinks = footerLinks + "List Currently Available Lights"
+ footerLinks = footerLinks + "Scan for New Lights | "
+ footerLinks = footerLinks + "List Currently Available Lights"
self.wfile.write(bytes("
" + footerLinks + "
", "utf-8"))
- self.wfile.write(bytes("NeewerLite-Python 0.5a by Zach Glenwright
", "utf-8"))
+ self.wfile.write(bytes("NeewerLite-Python 0.5b by Zach Glenwright
", "utf-8"))
self.wfile.write(bytes("