示例#1
0
def _error_report_dialog(exc):
    response = xbmcgui.Dialog().yesnocustom(heading=_("Hue Service Error"), message=_("The following error occurred:") + f"\n[COLOR=red]{exc}[/COLOR]\n" + _("Automatically report this error?"), customlabel=_("Never report errors"))
    if response == 2:
        xbmc.log("[script.service.hue] Error Reporting disabled")
        ADDON.setSettingBool("error_reporting", False)
        return False
    return response
示例#2
0
def _validate_ambilight():
    xbmc.log(
        f"[script.service.hue] Validate ambilight config. Enabled: {ADDON.getSettingBool('group3_enabled')}"
    )
    if ADDON.getSettingBool("group3_enabled"):
        light_ids = ADDON.getSetting("group3_Lights")
        if light_ids == "-1":
            ADDON.setSettingBool("group3_enabled", False)
            xbmc.log("[script.service.hue] No ambilights selected")
            notification(_("Hue Service"),
                         _("No lights selected for Ambilight."),
                         icon=xbmcgui.NOTIFICATION_ERROR)
def _validate_ambilight():
    logger.debug("Validate ambilight config. Enabled: {}".format(
        settings_storage['ambiEnabled']))
    if settings_storage['ambiEnabled']:
        light_ids = ADDON.getSetting("group3_Lights")
        if light_ids == "-1":
            logger.error("No ambilights selected")
            xbmcgui.Dialog().notification(
                _("Hue Service"),
                _("No lights selected for Ambilight."),
                icon=xbmcgui.NOTIFICATION_ERROR)
            ADDON.setSettingBool("group3_enabled", False)
            settings_storage['ambiEnabled'] = False
示例#4
0
 def _bridge_error500(self):
     self.bridge_error500 = self.bridge_error500 + 1  # increment counter
     if self.bridge_error500 > 50 and ADDON.getSettingBool("show500Error"):
         AMBI_RUNNING.clear()  # shut it down
         stop_showing_error = xbmcgui.Dialog().yesno(
             _("Hue Bridge over capacity"),
             _("The Hue Bridge is over capacity. Increase refresh rate or reduce the number of Ambilights."
               ),
             yeslabel=_("Do not show again"),
             nolabel=_("Ok"))
         if stop_showing_error:
             ADDON.setSettingBool("show500Error", False)
         self.bridge_error500 = 0
    def configure_ambilights(self, group_id):
        lights = self.select_hue_lights()
        light_names = []
        color_lights = []
        if lights is not None:
            for L in lights:
                light_names.append(self._get_light_name(L))
                color_lights.append(L)

            ADDON.setSettingString(f"group{group_id}_Lights",
                                   ','.join(color_lights))
            ADDON.setSettingString(f"group{group_id}_LightNames",
                                   ', '.join(light_names))
            ADDON.setSettingBool(f"group{group_id}_enabled", True)
            ADDON.openSettings()
示例#6
0
def _validate_schedule():
    xbmc.log(
        f"[script.service.hue] Validate schedule. Schedule Enabled: {ADDON.getSettingBool('enableSchedule')}"
    )
    if ADDON.getSettingBool("enableSchedule"):
        try:
            convert_time(ADDON.getSettingString("startTime"))
            convert_time(ADDON.getSettingString("endTime"))
            # xbmc.log("[script.service.hue] Time looks valid")
        except ValueError as e:
            ADDON.setSettingBool("EnableSchedule", False)
            xbmc.log(f"[script.service.hue] Invalid time settings: {e}")
            notification(_("Hue Service"),
                         _("Invalid start or end time, schedule disabled"),
                         icon=xbmcgui.NOTIFICATION_ERROR)
def _validate_schedule():
    logger.debug("Validate schedule. Schedule Enabled: {}".format(
        settings_storage['enableSchedule']))
    if settings_storage['enableSchedule']:
        try:
            convert_time(settings_storage['startTime'])
            convert_time(settings_storage['endTime'])
            logger.debug("Time looks valid")
        except ValueError as e:
            logger.error("Invalid time settings: {}".format(e))

            xbmcgui.Dialog().notification(
                _("Hue Service"),
                _("Invalid start or end time, schedule disabled"),
                icon=xbmcgui.NOTIFICATION_ERROR)
            ADDON.setSettingBool("EnableSchedule", False)
            settings_storage['enableSchedule'] = False