diff --git a/README.md b/README.md index 60585cb3..49dffab0 100644 --- a/README.md +++ b/README.md @@ -116,5 +116,4 @@ Audio Group: 1 ## Includes code and contributions from: - [Kodi Volunteer Translators](https://kodi.weblate.cloud), contribute [here](https://kodi.wiki/view/Translations) - [ScreenBloom by Tyler Kershner](https://github.com/kershner/screenBloom) -- [Qhue by Quentin Stafford-Fraser](https://github.com/quentinsf/qhue) - [hue-python-rgb-converter (rgbxy) by Benjamin Knight](https://github.com/benknight/hue-python-rgb-converter) diff --git a/script.service.hue/resources/language/resource.language.en_gb/strings.po b/script.service.hue/resources/language/resource.language.en_gb/strings.po index 123c7430..dda3c950 100644 --- a/script.service.hue/resources/language/resource.language.en_gb/strings.po +++ b/script.service.hue/resources/language/resource.language.en_gb/strings.po @@ -354,8 +354,8 @@ msgid "Disabled by daytime" msgstr "Disabled by daytime" msgctxt "#30064" -msgid "ERROR: Scene not found" -msgstr "ERROR: Scene not found" +msgid "ERROR: Scene not found, it may have been deleted" +msgstr "ERROR: Scene not found, it may have been deleted" msgctxt "#30080" msgid "The following error occurred:" @@ -449,10 +449,6 @@ msgctxt "#30019" msgid "Bridge outdated. Please update your bridge." msgstr "" -msgctxt "#30003" -msgid "ERROR: Scene or Light not found, it may have changed or been deleted. Check your configuration." -msgstr "" - msgctxt "#30033" msgid "Reconnected" msgstr "" @@ -477,3 +473,11 @@ msgstr "" msgctxt "#30026" msgid "Connection failed, retrying..." msgstr "" + +msgctxt "#30003" +msgid "Not selected" +msgstr "" + +msgctxt "#30027" +msgid "ERROR: Light not found, it may have been deleted" +msgstr "" diff --git a/script.service.hue/resources/lib/ambigroup.py b/script.service.hue/resources/lib/ambigroup.py index 9fc7a673..67886d94 100644 --- a/script.service.hue/resources/lib/ambigroup.py +++ b/script.service.hue/resources/lib/ambigroup.py @@ -61,9 +61,15 @@ def reload_settings(self): if len(light_ids) > 0: for L in light_ids: gamut = self._get_light_gamut(self.bridge, L) - light = {L: {'gamut': gamut, 'prev_xy': (0, 0), "index": index}} - self.ambi_lights.update(light) - index = index + 1 + if gamut == 404: + notification(header=_("Hue Service"), message=_(f"ERROR: Light not found, it may have been deleted"), icon=xbmcgui.NOTIFICATION_ERROR) + AMBI_RUNNING.clear() + ADDON.setSettingString(f"group{self.light_group_id}_Lights", "-1") + ADDON.setSettingString(f"group{self.light_group_id}_LightNames", _("Not selected")) + else: + light = {L: {'gamut': gamut, 'prev_xy': (0, 0), "index": index}} + self.ambi_lights.update(light) + index = index + 1 xbmc.log(f"[script.service.hue] AmbiGroup[{self.light_group_id}] Lights: {self.ambi_lights}") self.update_interval = ADDON.getSettingInt(f"group{self.light_group_id}_Interval") / 1000 # convert MS to seconds if self.update_interval == 0: @@ -210,7 +216,7 @@ def _update_hue_rgb(self, r, g, b, light, transition_time, bri): elif response == 404: xbmc.log(f"[script.service.hue] AmbiGroup[{self.light_group_id}] Not Found") AMBI_RUNNING.clear() - notification(header=_("Hue Service"), message=_(f"ERROR: Scene or Light not found, it may have changed or been deleted. Check your configuration."), icon=xbmcgui.NOTIFICATION_ERROR) + notification(header=_("Hue Service"), message=_(f"ERROR: Light not found, it may have been deleted"), icon=xbmcgui.NOTIFICATION_ERROR) AMBI_RUNNING.clear() # shut it down else: xbmc.log(f"[script.service.hue] AmbiGroup[{self.light_group_id}] RequestException Hue call fail") @@ -231,7 +237,10 @@ def bridge_capacity_error(self): def _get_light_gamut(bridge, light): gamut = "C" # default light_data = bridge.make_api_request("GET", f"light/{light}") - if light_data is not None and 'data' in light_data: + if light_data == 404: + xbmc.log(f"[script.service.hue] _get_light_gamut: Light[{light}] not found or ID invalid") + return 404 + elif light_data is not None and 'data' in light_data: for item in light_data['data']: if 'color' in item and 'gamut_type' in item['color']: gamut = item['color']['gamut_type'] diff --git a/script.service.hue/resources/lib/language.py b/script.service.hue/resources/lib/language.py index 6e5b1143..46c6ed04 100644 --- a/script.service.hue/resources/lib/language.py +++ b/script.service.hue/resources/lib/language.py @@ -109,7 +109,7 @@ def get_string(t): _strings['hue status: '] = 30061 _strings['settings'] = 30062 _strings['disabled by daytime'] = 30063 -_strings['error: scene not found'] = 30064 +_strings['error: scene not found, it may have been deleted'] = 30064 _strings['the following error occurred:'] = 30080 _strings['automatically report this error?'] = 30081 _strings['no lights selected for ambilight.'] = 30069 @@ -133,10 +133,11 @@ def get_string(t): _strings['bridge not found automatically. please make sure your bridge is up to date and has access to the internet. [cr]would you like to enter your bridge ip manually?'] = 30007 _strings['connecting...'] = 30009 _strings['bridge outdated. please update your bridge.'] = 30019 -_strings['error: scene or light not found, it may have changed or been deleted. check your configuration.'] = 30003 _strings['reconnected'] = 30033 _strings['re-enable time'] = 31334 _strings['transition time (seconds):'] = 31335 _strings['bridge overloaded, stopping ambilight'] = 30002 _strings['bridge unauthorized, please reconfigure.'] = 30025 _strings['connection failed, retrying...'] = 30026 +_strings['not selected'] = 30003 +_strings['error: light not found, it may have been deleted'] = 30027 diff --git a/script.service.hue/resources/lib/lightgroup.py b/script.service.hue/resources/lib/lightgroup.py index b767e184..dbd56a20 100644 --- a/script.service.hue/resources/lib/lightgroup.py +++ b/script.service.hue/resources/lib/lightgroup.py @@ -152,7 +152,7 @@ def run_action(self, action): ADDON.setSettingString(f"group{self.light_group_id}_{action}SceneName", "Not Selected") ADDON.setSettingString(f"group{self.light_group_id}_{action}SceneID", "-1") xbmc.log(f"[script.service.hue] Scene {scene} not found - group{self.light_group_id}_{action}Behavior ") - notification(header=_("Hue Service"), message=_("ERROR: Scene not found"), icon=xbmcgui.NOTIFICATION_ERROR) + notification(header=_("Hue Service"), message=_("ERROR: Scene not found, it may have been deleted"), icon=xbmcgui.NOTIFICATION_ERROR) else: