2015-04-03, 02:08
OK try downloading it again.. I have made it so it should install those components when you try and do the installation.. I never did it because mine already had it installed from other plugins.
cb01:~/.kodi/addons # grep version= script.module.requests/addon.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
version="2.6.0"
<import addon="xbmc.python" version="2.14.0"/>
cb01:~/.kodi/addons # grep version= script.module.simplejson/addon.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
version="3.3.0"
<import addon="xbmc.python" version="2.1.0"/>
20:20:52 T:139855829886720 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
20:20:53 T:139855829886720 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: string indices must be integers
Traceback (most recent call last):
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 96, in onPlayBackStarted
preVideolightState = getLightState(type=bulbs['type'], name=bulbs['set'])
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 36, in getLightState
info.append({'id': light['id'], 'label': light['label'], 'power': light['power'], 'hue': light['color']['hue'], 'saturation': light['color']['saturation'],
TypeError: string indices must be integers
-->End of Python script error report<--
...normal playback messages deleted...
20:21:39 T:139855829886720 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: 'bool' object is not iterable
Traceback (most recent call last):
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 120, in onPlayBackStopped
restoreLights(preVideolightState, duration=config.get('Delay', 'EndPlay'))
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 44, in restoreLights
for light in LightStates:
TypeError: 'bool' object is not iterable
-->End of Python script error report<--
[Authentication]
apiKey = ?????????????????????????
cloudAccount = ??????????????????????
password = ???????????
[Bulbs]
type = label
set = tvroom
[Delay]
MovieStart = 10
TVStart = 10
Pause = 2
UnPause = 2
EndPlay = 15
cb01:~/.kodi/addons/service.NateKodi.LIFX # python service.py
https://api.lifx.co/v1beta1/lights/label%3Atvroom/color.json
Traceback (most recent call last):
File "service.py", line 86, in <module>
print(light['id'])
NameError: name 'light' is not defined
def getLightState(name, type='label'):
""" This function checks what lights are in the group and what color they are currently set to """
if name == 'all':
getAvaliableLights = requests.get(lifxCloud + '/' + name, headers=header)
else:
getAvaliableLights = requests.get(lifxCloud + '/' + urllib.quote(type + ':' + name), headers=header)
if getAvaliableLights.status_code == requests.codes.ok:
avaliableLights = json.loads(getAvaliableLights.text)
info = []
for light in avaliableLights:
print (light['id'])
print (light['label'])
print (light['power'])
print (light['color']['hue'])
print (light['color']['saturation'])
print (light['brightness'])
#info.append({'id': light['id'], 'label': light['label'], 'power': light['power'], 'hue': light['color']['hue'], 'saturation': light['color']['saturation'], 'brightness': light['brightness']})
return info
return False
06:31:41 T:140626874050304 NOTICE: https://api.lifx.co/v1beta1/lights/label%3Atvroom/color.json
...video playback messages...
06:32:25 T:140626874050304 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
06:32:26 T:140626874050304 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: string indices must be integers
Traceback (most recent call last):
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 103, in onPlayBackStarted
preVideolightState = getLightState(type=bulbs['type'], name=bulbs['set'])
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 36, in getLightState
print (light['id'])
TypeError: string indices must be integers
-->End of Python script error report<--
print(avaliableLights)
06:57:29 T:140358557062912 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
06:57:29 T:140358557062912 NOTICE: {u'group': {u'id': u'ccdfb3c266712ac75867e448f17fc07e', u'name': u'Group1'}, u'uuid': u'02f2a281-b444-4965-bc42-9839782c24d9', u'power': u'on', u'brightness': 0.86904707408255133, u'color': {u'hue': 38.090180819409476, u'saturation': 0.0, u'kelvin': 4000}, u'label': u'tvroom', u'connected': True, u'location': {u'id': u'22d9156dfad1ade398fe5096c7a8c8c0', u'name': u'Home'}, u'seconds_since_seen': 0.0038925909999999999, u'id': u'd073d5006d5c', u'last_seen': u'2015-04-04T13:57:29.755+00:00'}
06:57:29 T:140358557062912 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: string indices must be integers
Traceback (most recent call last):
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 104, in onPlayBackStarted
preVideolightState = getLightState(type=bulbs['type'], name=bulbs['set'])
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 37, in getLightState
print (light['id'])
TypeError: string indices must be integers
-->End of Python script error report<--
{
"group": {
"id": "ccdfb3c266712ac75867e448f17fc07e",
"name": "Group1"
},
"uuid": "02f2a281-b444-4965-bc42-9839782c24d9",
"power": "on",
"brightness": 0.8690470740825513,
"color": {
"hue": 38.090180819409476,
"saturation": 0.0,
"kelvin": 4000
},
"label": "tvroom",
"connected": true,
"location": {
"id": "22d9156dfad1ade398fe5096c7a8c8c0",
"name": "Home"
},
"seconds_since_seen": 0.003484479,
"id": "d073d5006d5c",
"last_seen": "2015-04-04T15:58:39.037+00:00"
}
diff -u service.py service.alt.py
--- service.py 2015-04-04 10:23:53.378815153 -0700
+++ service.alt.py 2015-04-04 10:22:58.346965267 -0700
@@ -32,9 +32,11 @@
if getAvaliableLights.status_code == requests.codes.ok:
avaliableLights = json.loads(getAvaliableLights.text)
info = []
- for light in avaliableLights:
- info.append({'id': light['id'], 'label': light['label'], 'power': light['power'], 'hue': light['color']['hue'], 'saturation': light['color']['saturation'],
- 'brightness': light['brightness']})
+ if reqtype == 'label':
+ info.append({'id': avaliableLights['id'], 'label': avaliableLights['label'], 'power': avaliableLights['power'], 'hue': avaliableLights['color']['hue'], 'saturation': avaliableLights['color']['saturation'], 'brightness': avaliableLights['brightness']})
+ else:
+ for light in avaliableLights:
+ info.append({'id': light['id'], 'label': light['label'], 'power': light['power'], 'hue': light['color']['hue'], 'saturation': light['color']['saturation'],'brightness': light['brightness']})
return info
return False
@@ -63,6 +65,7 @@
def loadConfig ():
global header
+ global reqtype
global bulbs
global setColor
global config
@@ -75,7 +78,8 @@
apiKey = 'Bearer ' + apiKey
header = {'content-type': 'application/json', 'authorization': apiKey}
- bulbs = {'type': config.get('Bulbs', 'type'), 'set': config.get('Bulbs', 'set')}
+ reqtype = config.get('Bulbs', 'type')
+ bulbs = {'type': reqtype, 'set': config.get('Bulbs', 'set')}
bulbURL = urllib.quote(bulbs['type'] + ':' + bulbs['set'])
setColor = lifxCloud + bulbURL + '/color.json'
type = group
set = Group1