From 10cd79bba8aeb264ce0617a21aafbd9a27cdc863 Mon Sep 17 00:00:00 2001 From: Snapcase Date: Tue, 16 Jul 2019 16:11:28 -0400 Subject: [PATCH] make Hue capacity warning less annoying --- script.service.hue/addon.xml | 5 +++-- script.service.hue/resources/lib/AmbiGroup.py | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/script.service.hue/addon.xml b/script.service.hue/addon.xml index 4569c196..237bf611 100644 --- a/script.service.hue/addon.xml +++ b/script.service.hue/addon.xml @@ -1,5 +1,5 @@ + provider-name="zim514" version="0.6.6"> @@ -24,10 +24,11 @@ Automate Hue lights with Kodi playback 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. Automate Hue lights with Kodi playback - v0.6.5: + v0.6.6: - Change some ambilight default settings to better values - Change Hue NuPNP Discovery URL until SSL chain is fixed by Philips - Fix Hue username not saving properly +- Make Hue capacity warning less annoying v0.6.0: - Choice of fallback colour to replace blacks and whites diff --git a/script.service.hue/resources/lib/AmbiGroup.py b/script.service.hue/resources/lib/AmbiGroup.py index fdfdafb1..97831d6e 100644 --- a/script.service.hue/resources/lib/AmbiGroup.py +++ b/script.service.hue/resources/lib/AmbiGroup.py @@ -16,7 +16,8 @@ from .rgbxy import XYPoint from .rgbxy import GamutA,GamutB,GamutC -import xbmc +from xbmc import RenderCapture +from xbmcgui import NOTIFICATION_WARNING from resources.lib.KodiGroup import KodiGroup from resources.lib.KodiGroup import VIDEO,AUDIO,ALLMEDIA,STATE_IDLE,STATE_PAUSED,STATE_PLAYING @@ -105,10 +106,14 @@ def setup(self, monitor,bridge, kgroupID, flash=False, mediaType=VIDEO): super(AmbiGroup,self).setup(bridge, kgroupID, flash=flash, mediaType=1) self.monitor=monitor - - calls=1/(self.updateInterval)*len(self.ambiLights) #updateInterval is in seconds, eg. 0.2 for 200ms. + calls=0 + try: + calls=1/(self.updateInterval)*len(self.ambiLights) #updateInterval is in seconds, eg. 0.2 for 200ms. + if calls > 25: + kodiutils.notification(_("Hue Service"), _("Est. Hue Commands/sec (max 20): {}").format(calls),time=000,icon=NOTIFICATION_WARNING) + except ZeroDivisionError: + kodiutils.notification(_("Hue Service"), _("Recommended minimum update interval: 100ms").format(calls),time=5000,icon=NOTIFICATION_WARNING) logger.debug("callsPerSec: lights: {},interval: {}, calls: {}".format(len(self.ambiLights),self.updateInterval,calls)) - kodiutils.notification(_("Hue Service"), _("Est. Hue Calls/sec (max 10): {}").format(calls),time=10000) def _getColor(self): @@ -117,7 +122,7 @@ def _getColor(self): def _ambiLoop(self): - cap = xbmc.RenderCapture() + cap = RenderCapture() logger.debug("AmbiGroup started")