Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions greenwavereality/greenwavereality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import xmltodict
import urllib3

requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL'

def grab_xml(host, token=None):
"""Grab XML data from Gateway, returned as a dict."""
Expand All @@ -28,7 +29,7 @@ def set_brightness(host, did, value, token=None):
scheme = "http"
token = "1234567890"
url = (
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>' + str(
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + str(did) + '</did><value>' + str(
value) + '</value><type>level</type></gip>&fmt=xml')
response = requests.get(url, verify=False)
if response.status_code == '200':
Expand All @@ -55,7 +56,7 @@ def turn_on(host, did, token=None):
scheme = "http"
token = "1234567890"
url = (
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>1</value></gip>&fmt=xml')
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + str(did) + '</did><value>1</value></gip>&fmt=xml')
response = requests.get(url, verify=False)
if response.status_code == '200':
return True
Expand All @@ -72,7 +73,7 @@ def turn_off(host, did, token=None):
scheme = "http"
token = "1234567890"
url = (
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>0</value></gip>&fmt=xml')
scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + str(did) + '</did><value>0</value></gip>&fmt=xml')
response = requests.get(url, verify=False)
if response.status_code == '200':
return True
Expand Down Expand Up @@ -103,4 +104,4 @@ def grab_bulbs(host, token=None):
for room in xml:
for device in room['device']:
bulbs[int(device['did'])] = device
return bulbs
return bulbs