Skip to content

Commit

Permalink
make Hue capacity warning less annoying
Browse files Browse the repository at this point in the history
  • Loading branch information
Snapcase committed Jul 16, 2019
1 parent 1610a6a commit 10cd79b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions script.service.hue/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<addon id="script.service.hue" name="Hue Service"
provider-name="zim514" version="0.6.5">
provider-name="zim514" version="0.6.6">

<requires>
<import addon="xbmc.python" version="2.26.0" />
Expand All @@ -24,10 +24,11 @@
<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.6.5:
<news>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
Expand Down
15 changes: 10 additions & 5 deletions script.service.hue/resources/lib/AmbiGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -117,7 +122,7 @@ def _getColor(self):

def _ambiLoop(self):

cap = xbmc.RenderCapture()
cap = RenderCapture()

logger.debug("AmbiGroup started")

Expand Down

0 comments on commit 10cd79b

Please sign in to comment.