Skip to content

Commit

Permalink
Merge pull request #18 from zim514/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Snapcase authored Aug 5, 2019
2 parents d66d9b9 + 94be6ea commit bb2f39b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions script.service.hue/addon.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="0.7.5">
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="0.7.6">
<requires>
<import addon="xbmc.python" version="2.26.0" />
<import addon="script.module.requests" version="2.22.0" />
Expand All @@ -22,7 +22,9 @@
<summary lang="en_GB">Automate Hue lights with Kodi playback</summary>
<description lang="en_GB">Automate your Philips Hue lights with Kodi. Create multi-room scenes that run when you Play, Pause or Stop media playback. Create and delete multi-room scenes from add-on settings then select which to apply for different Playback events. Can use Hue's sunrise and sunset times to automatically disable the service during daytime and turn on the lights at sunset during playback. Includes experimental Ambilight support. Check forum for more information.</description>
<disclaimer lang="en_GB">Automate Hue lights with Kodi playback</disclaimer>
<news>v0.7.5:
<news>v0.7.6:
- Fix ambilight activation at sunset not working.
v0.7.5:
- Fix ambilight breaking on bad render capture
v0.7.3:
- Fix daylight disable schedule
Expand Down
3 changes: 3 additions & 0 deletions script.service.hue/resources/lib/AmbiGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,17 @@ def _ambiLoop(self):
capImage = cap.getImage() #timeout to wait for OS in ms, default 1000
if capImage is None or len(capImage) < 50:
logger.error("capImage is none or <50: {},{}".format(len(capImage),capImage))
self.monitor.waitForAbort(0.25) #slow it down before restarting loop
continue #no image captured, try again next iteration
image = Image.frombuffer("RGBA", (self.captureSize, self.captureSize), buffer(capImage), "raw", "BGRA")
except ValueError:
logger.error("capImage: {},{}".format(len(capImage),capImage))
logger.error("Value Error")
self.monitor.waitForAbort(0.25)
continue #returned capture is smaller than expected when player stopping. give up this loop.
except Exception as ex:
logger.warning("Capture exception",exc_info=1)
self.monitor.waitForAbort(0.25)
continue

colors = colorgram.extract(image,self.numColors)
Expand Down
2 changes: 1 addition & 1 deletion script.service.hue/resources/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def service():

globals.daylight = kodiHue.getDaylight(bridge)
if not globals.daylight:
kodiHue.sunset(bridge,kgroups)
kodiHue.sunset(bridge,kgroups,ambiGroup)

timer += 1
monitor.waitForAbort(1)
Expand Down
4 changes: 3 additions & 1 deletion script.service.hue/resources/lib/kodiHue.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,15 @@ def getDaylight(bridge):
return bridge.sensors['1']()['state']['daylight']


def sunset(bridge,kgroups):
def sunset(bridge,kgroups,ambiGroup):
logger.info("Applying sunset scenes")

for g in kgroups:
logger.debug("in sunset() g: {}, kgroupID: {}".format(g,g.kgroupID))
if globals.ADDON.getSettingBool("group{}_enabled".format(g.kgroupID)):
g.sunset()
if globals.ADDON.getSettingBool("group3_enabled"):
ambiGroup.sunset()
return


Expand Down

0 comments on commit bb2f39b

Please sign in to comment.