Ejemplo n.º 1
0
 def generated_triggers(function):
     global logTitle
     for k in keyThingsDict.keys():
         logPrefix = u"generated_triggers(): adding @when(\"Thing {} changed\") trigger for {}".format(k, unicode(keyThingsDict.get(k).get("thing_name")))
         LogAction.logInfo(logTitle, logPrefix)
         when("Thing {} changed".format(k))(function)
     return function
Ejemplo n.º 2
0
def Scene_Goodnight(event):
    # Scene_Goodnight.log.info("::Boiler_Control rule -> A Heater recieved a command - updating boiler state::")
    LogAction.logError("Scene_Goodnight", "goodnight going to bed")
    global tgoodnight
    global CT_HPSP_Night

    events.sendCommand("CT_FairyLights433Socket", "OFF")
    events.sendCommand("ZbColourBulb01Switch", "OFF")
    events.sendCommand("ZbColourBulb02Switch", "OFF")

    events.sendCommand("radio", "OFF")
    events.sendCommand("vCT_TVKodiSpeakers", "OFF")
    events.postUpdate("CT_Heating_PresetTempNormal",
                      items["CT_HPSP_Night"].toString())
    events.postUpdate("FR_Heating_PresetTempNormal",
                      items["FR_HPSP_Night"].toString())
    events.postUpdate("ER_Heating_PresetTempNormal",
                      items["ER_HPSP_Night"].toString())
    events.postUpdate("AT_Heating_PresetTempNormal",
                      items["AT_HPSP_Night"].toString())
    events.postUpdate("BR_Heating_PresetTempNormal",
                      items["BR_HPSP_Night"].toString())
    events.postUpdate("OF_Heating_PresetTempNormal",
                      items["OF_HPSP_Night"].toString())
    events.postUpdate("HL_Heating_PresetTempNormal",
                      items["HL_HPSP_Night"].toString())
    events.sendCommand("Heating_UpdateHeaters", "ON")
    events.postUpdate("Scene_Goodnight", "OFF")
    events.sendCommand("workLightsPowerSocket", "OFF")
    events.sendCommand("workLightsPowerSocket", "OFF")
    # events.sendCommand("Heating_UpdateHeaters", "ON") #trigger updating of heaters and boiler etc

    tgoodnight = ScriptExecution.createTimer(
        DateTime.now().plusSeconds(300),
        lambda: events.sendCommand("ZbWhiteBulb01Switch", "OFF"))
Ejemplo n.º 3
0
def DimNow(Item):
    try:
        global iteration
        interval = dimmertimers[Item]['FadeStepMS']

        if iteration >= (int(dimmertimers[Item]['loops'])):
            events.sendCommand(Item, str(dimmertimers[Item]['TargetValue']))
            dimmertimers[Item]['timer'].cancel()
            iteration = 0
            dimmertimers[Item]['timer'] = None
            del dimmertimers[Item]
            return
        else:
            NewPercent = round(
                float(str(items[Item])) -
                float(dimmertimers[Item]['PercentPerStep']), 2)
            events.sendCommand(Item, str(NewPercent))
            dimmertimers[Item]['timer'].reschedule(
                DateTime.now().plusMillis(interval))
            iteration += 1

        dimmertimers[Item]['iteration'] = iteration
    except:
        LogAction.logInfo("DimNow Routine", u"CleanUp")
        dimmertimers[Item]['timer'].cancel()
        dimmertimers[Item]['timer'] = None
        del dimmertimers[Item]
Ejemplo n.º 4
0
def scene_Goodnight_init(event):
    LogAction.logInfo("StartUp - set up Item Scene_Goodnight",
                      "StartUp - set up Item Scene_Goodnight")
    # events.postUpdate("BridgeLightSensorState", "OFF")
    global tsceneStartup
    if tsceneStartup is None:
        tsceneStartup = ScriptExecution.createTimer(
            DateTime.now().plusSeconds(45),
            lambda: events.postUpdate("Scene_Goodnight", "OFF"))
Ejemplo n.º 5
0
def zbAvail(event):
    LogAction.logInfo("gTHSensorTemperatures", "== gTHSensorTemperatures  Item {} received  update: {}", event.itemName, event.itemState)
    newname = event.itemName[:event.itemName.rfind('_')+1] + "reachable"
    events.postUpdate(newname, "Online")  # use reachable not triggering event cos its temp
    zbAvail.log.info("== ZB  temp sensor availability marked  ONLINE::")

    if event.itemName not in timers or timers[event.itemName].hasTerminated():
        timers[event.itemName] = ScriptExecution.createTimer(DateTime.now().plusMinutes(timeoutMinutes), lambda: events.postUpdate(newname, "Offline"))
    else:
        timers[event.itemName].reschedule(DateTime.now().plusMinutes(timeoutMinutes))
Ejemplo n.º 6
0
def heating_cron9(event):
    for item in ir.getItem("gHeating_PresetTempNormal").members:
        item.state = ir.getItem(
            item.name[:item.name.find('_')] +
            "_HPSP_Evening").state  # prefix =  # get prefix eg FR, CT etc
        LogAction.logWarn("CRON set setpoints",
                          "===> _HPSP_Evening setpoint Item : {}, is now: {}",
                          item.name, item.state)
    events.sendCommand("Heating_UpdateHeaters",
                       "ON")  #trigger updating of heaters and boiler etc
Ejemplo n.º 7
0
def zbRouterAvail(event):
    zbRouterAvail.log.debug("== zbRouterAvail::")
    LogAction.logDebug("zbRouterAvail", "==xxxccc Item {} received update: {}",
                       event.itemName, event.itemState)
    events.postUpdate("ZbRouter_01_Reachable", "Online")
    #log.debug("Battery charging monitor: {}: start".format(event.itemState))
    global zbRouterTimer
    if zbRouterTimer is not None and not zbRouterTimer.hasTerminated():
        zbRouterTimer.cancel()
    zbRouterTimer = ScriptExecution.createTimer(
        DateTime.now().plusSeconds(routerTimeout),
        lambda: events.postUpdate("ZbRouter_01_Reachable", "Offline"))
    zbRouterAvail.log.debug("==== zbRouterAvail timer started!!!!!!!!!!!::")
Ejemplo n.º 8
0
def conservatory_tv_off(event):
    conservatory_tv_off.log.info("conservatory_tv_off")
    global t_CTtvPowerOff

    Voice.say("Turning off Conservatory TV", "voicerss:enGB", "chromecast:chromecast:GHM_Conservatory", PercentType(50))

    # events.postUpdate("shutdownKodiConservatoryProxy", "OFF") - this routine can be removed if this works
    LogAction.logError("Shutdown Conservatory Kodi","Shutdown Conservatory Kodi: {}", event.itemName)
    events.sendCommand("kodiConservatory_systemcommand","Shutdown")

    events.sendCommand("amplifierStandby", "OFF")

    if t_CTtvPowerOff is None:
        t_CTtvPowerOff = ScriptExecution.createTimer(DateTime.now().plusSeconds(30), lambda: tvoffbody())
Ejemplo n.º 9
0
def kodi_startup(event):
    LogAction.logError("System started - INIT all KODI PROXY ITEMS",
                       "System started - INIT all KODI PROXY ITEMS")

    if ir.getItem("shutdownKodiFrontRoomProxy").state == NULL:
        events.postUpdate(ir.getItem("shutdownKodiFrontRoomProxy"), "OFF")
        LogAction.logError(
            "INIT KODI PROXY",
            "System started rule - change front room KodiPi proxy from NULL to OFF"
        )

    # if ir.getItem("shutdownKodiConservatoryProxy").state == NULL:
    #     events.postUpdate(ir.getItem("shutdownKodiConservatoryProxy"), "OFF")
    #     LogAction.logError("INIT KODI PROXY", "System started rule - change Conservatory KodiPi proxy from NULL to OFF")

    if ir.getItem("shutdownKodiBedroomProxy").state == NULL:
        events.postUpdate(ir.getItem("shutdownKodiBedroomProxy"), "OFF")
        LogAction.logError(
            "INIT KODI PROXY",
            "System started rule - change Bed room KodiPi proxy from NULL to OFF"
        )

    if ir.getItem("shutdownKodiAtticProxy").state == NULL:
        events.postUpdate(ir.getItem("shutdownKodiAtticProxy"), "OFF")
        LogAction.logError(
            "INIT KODI PROXY",
            "System started rule - change attic KodiPi proxy from NULL to OFF"
        )  # end
Ejemplo n.º 10
0
def dimmer(event):
    global iteration
    interval = 250
    Loops = 0
    Befehl = str(event.getItemCommand()).split(",")

    try:  #Fehlerbehebung bei fehlenden FadeStep
        FadeStepMS = int(Befehl[4])
    except (IndexError, ValueError):
        FadeStepMS = interval

    TargetValue = int(Befehl[1])
    FadePeriodMs = int(Befehl[2])
    Item = Befehl[3]

    try:
        StartValue = items[Item]
    except (KeyError):
        return

    if items[Item] == NULL:
        LogAction.logInfo("Timer Test", u"Abbruch")
        return

    LogAction.logInfo("Timer Test", u"Item = " + Item)
    if Item in dimmertimers:
        LogAction.logInfo("Timer Test", u"Item existiert")
        dimmertimers[Item]['timer'].cancel()
        dimmertimers[Item]['timer'] = None
        del dimmertimers[Item]

    PercentPerStep = ((float(str(StartValue))) -
                      float(str(TargetValue))) / (FadePeriodMs / FadeStepMS)
    if PercentPerStep == 0:
        LogAction.logInfo("Dimmer Routine", u"Nichts zu tun!")
        return

    Loops = FadePeriodMs / FadeStepMS

    dimmertimers[Item] = {
        'item':
        Item,
        'timer':
        ScriptExecution.createTimer(DateTime.now().plusMillis(interval),
                                    lambda: DimNow(Item)),
        'loops':
        Loops,
        'TargetValue':
        TargetValue,
        'FadePeriod':
        FadePeriodMs,
        'PercentPerStep':
        PercentPerStep,
        'FadeStepMS':
        FadeStepMS
    }

    dimmertimers[Item]['timer'].reschedule(DateTime.now().plusMillis(interval))
Ejemplo n.º 11
0
def bgAvail(event):
    LogAction.logDebug(
        "gBG_socket_maxworktime_updates",
        "!!!! gBG_socket_maxworktime_updates  Item {} received  update: {}",
        event.itemName, event.itemState)
    # create the 'reachable' item name e.g bg_wifisocket_4_maxworktime to bg_wifisocket_4_reachable
    newname = event.itemName[:event.itemName.rfind('_') + 1] + "reachable"
    events.postUpdate(
        newname, "Online")  # use reachable not triggering event cos its temp
    bgAvail.log.debug("== BG sockets Online/Offline status marked  ONLINE::")

    if event.itemName not in timers or timers[event.itemName].hasTerminated():
        timers[event.itemName] = ScriptExecution.createTimer(
            DateTime.now().plusSeconds(timeoutSeconds),
            lambda: events.postUpdate(newname, "Offline"))
    else:
        timers[event.itemName].reschedule(
            DateTime.now().plusSeconds(timeoutSeconds))
Ejemplo n.º 12
0
        def cb():
            global logTitle
            current_state = str(things.get(ThingUID(binding_thing_name)).status)
            if current_state == "ONLINE":
                LogAction.logInfo(logTitle, u"No need to restart {} (status={})".format(binding_name, current_state))
                if notify_restart is True:
                    NotificationAction.sendBroadcastNotification(u"Auto restart canceled for {} (status={})".format(binding_name, current_state))
            else:
                LogAction.logInfo(logTitle, u"Will now restart {} (status={})".format(binding_name, current_state))
                # Keep track of binding restarts
                restart_counter = binding_restarts.get(binding_id)
                if restart_counter is None:
                    binding_restarts[binding_id] = 1
                else:
                    binding_restarts[binding_id] = int(restart_counter) + 1

                if notify_restart is True:
                    NotificationAction.sendBroadcastNotification(u"Auto restart of {} (status={})".format(binding_name, current_state))
                # Restart the binding (use the 'openhab-karaf' entry in ssh config file)
                Exec.executeCommandLine("/bin/sh@@-c@@ssh openhab-karaf bundle:restart {}".format(binding_id))
            timers[binding_id] = None
Ejemplo n.º 13
0
def monitor_master_heating_mode(event):
    LogAction.logError("monitoR", "handle MasterHeatingMode updated {}",
                       ir.getItem("masterHeatingMode").state.toString())

    global offTemp
    if ir.getItem("masterHeatingMode").state.toString() == "auto":
        LogAction.logError(
            "monitor_heating_mode",
            "HMH .. make all rooms - AUTO - MASTER Heating Mode : {}",
            ir.getItem("masterHeatingMode").state.toString())
        for item in ir.getItem("gHeatingModes").members:
            events.postUpdate(item, "auto")

    elif ir.getItem("masterHeatingMode").state.toString() == "off":
        LogAction.logError(
            "monitor_heating_mode",
            "HMH .. processing case OFF MASTER Heating Mode: : {}",
            ir.getItem("masterHeatingMode").state.toString())
        for item in ir.getItem("gHeatingModes").members:
            events.postUpdate(item, "off")
        # for item in ir.getItem("gTemperatureSetpoints").members:
        #     events.postUpdate(item, offTemp)

    elif ir.getItem("masterHeatingMode").state.toString() == "manual":
        LogAction.logError(
            "monitor_heating_mode",
            "HMH .. processing case MANUAL MASTER Heating Mode: : {}",
            ir.getItem("masterHeatingMode").state.toString())
        for item in ir.getItem("gHeatingModes").members:
            events.postUpdate(item, "manual")

    else:
        LogAction.logError("monitor_heating_mode",
                           "HMH .. Heating Mode unknown:  {}",
                           ir.getItem("masterHeatingMode").state.toString())

    events.sendCommand("Heating_UpdateHeaters",
                       "ON")  #trigger updating of heaters and boiler etc
Ejemplo n.º 14
0
def addWatchdogItems():
    """
    Create the Watchdog Items and Group if they don't exist yet.
    """
    global logTitle

    # Add Watchdog Group if it doesn't exist
    if ir.getItems(WATCHDOG_GROUP) == []:
        LogAction.logInfo(logTitle, u"Create Group [{}]".format(WATCHDOG_GROUP))
        add_item(WATCHDOG_GROUP, item_type="Group", label="Watchdog Items Group", tags=["Watchdog"])
    try:
        for entry in keyThingsDict.values():
            wdItemName = entry.get("status_item")
            if ir.getItems(wdItemName) == []:
                add_item(wdItemName, item_type="String", groups=[WATCHDOG_GROUP], label=entry.get("thing_name"), tags=["Watchdog"])
                LogAction.logInfo(logTitle, u"Created item [{}] in Group [{}]".format(wdItemName, WATCHDOG_GROUP))
    except:
        import traceback
        LogAction.logError(logTitle, u"{}".format(traceback.format_exc()))
Ejemplo n.º 15
0
def Rule_KeyThingStatusUpdate(event):
    global logTitle
    global keyThingsDict
    logPrefix = "Rule_KeyThingStatusUpdate(): "
    LogAction.logDebug(logTitle, logPrefix + "event = " + pp.pformat(event))

    keyThings = []
    if event:
        keyThings.append(str(event.thingUID))
    else:
        for k in keyThingsDict.keys():
            keyThings.append(k)

    for k in keyThings:
        keyItemInfo = keyThingsDict[k]
        keyStatusItem = keyItemInfo.get("status_item")
        keyStatusItemThingName = keyItemInfo.get("thing_name")
        bindingRestartInfo = keyItemInfo.get("restart_info")
        nodeName = k.split(":")[-1]
        # thing state is not available in event if rule triggered by cron:
        if event:
            nodeState = str(event.statusInfo)
            LogAction.logInfo(logTitle, logPrefix+"Thing {} ({}, status item {}) status changed to {}".format(nodeName, keyStatusItemThingName, keyStatusItem, nodeState))
        else:
            nodeState = things.get(ThingUID(k)).status
        events.postUpdate(keyStatusItem, str(nodeState))

        # Restart some bindings if needed
        if bindingRestartInfo:
            LogAction.logDebug(logTitle, logPrefix+u"Restart {} (URI {}) if offline; current status is {}".format(keyStatusItemThingName, bindingRestartInfo.get("binding_uri"), nodeState))
            # Note: schedule_binding_restart() takes care of managing the Thing status
            schedule_binding_restart(
                bindingRestartInfo.get("binding_uri"),
                keyStatusItemThingName,
                k,
                bindingRestartInfo.get("wait_time"),
                reschedule_timer_on_update=bindingRestartInfo.get("reschedule_timer_on_update", False),
                notify_restart=bindingRestartInfo.get("notify_restart", False)
            )
Ejemplo n.º 16
0
def checkIfHeatersNeedUpdating(event):
    checkIfHeatersNeedUpdating.log.debug(
        "HHH HeatingMode, Setpoint or Temperature updated")

    # get prefix eg FR, CT etc
    prefix = event.itemName[:event.itemName.rfind('_')]
    LogAction.logDebug(
        "Check if Heaters need changing",
        "HHH Check if Heaters need changing etc due to Item: {}, received  update: {}",
        event.itemName, event.itemState)

    HeatingMode = ir.getItem(prefix + "_HeatingMode")
    LogAction.logDebug("Check if Heaters need changing",
                       "HHH HeatingMode {} : {}", prefix, HeatingMode.state)

    TSetpoint = ir.getItem(prefix + "_TemperatureSetpoint")
    LogAction.logDebug("Check if Heaters need changing",
                       "HHH Setpoint    {} : {}", prefix, TSetpoint.state)

    Temperature = ir.getItem(prefix + "_Temperature")
    LogAction.logDebug("Check if Heaters need changing",
                       "HHH Temperature {} : {}", prefix, Temperature.state)

    Heater = ir.getItem(prefix + "_Heater")
    LogAction.logDebug("Check if Heaters need changing",
                       "HHH Heater      {} : {}", prefix, Heater.state)

    Reachable = ir.getItem(prefix + "_RTVReachable")
    LogAction.logDebug("Check if Heaters need changing",
                       "HHH Reachable   {} : {}", prefix, Reachable.state)

    #!handle an offline TRV
    if Reachable.state.toString() != "Online":  # is the trv actually online??
        LogAction.logError(
            "Check if Heaters need changing",
            "HHH ZZZZ---ZZZZ Reachable-Offline - sending OFF, leaving!!!!!   prefix: {} ",
            prefix)
        #turn this one off
        events.sendCommand(Heater, "OFF")
        return  #dont continue on and update the bolier control if this RTV is Offline

    LogAction.logDebug(
        "Check if Heaters need changing",
        "HHH current HeatingMode.state: {}  masterHeatingMode.state: {}",
        HeatingMode.state,
        ir.getItem("masterHeatingMode").state)

    if (HeatingMode.state.toString()
            == "off") or (ir.getItem("masterHeatingMode").state.toString()
                          == "off"):
        if (ir.getItem("masterHeatingMode").state.toString() == "off"):
            LogAction.logDebug("Check if Heaters need changing",
                               "HHH Master Heating Mode is OFF")

        LogAction.logDebug(
            "Check if Heaters need changing",
            "HHH Turn heater OFF for {}  cos its Heating Mode is {}", prefix,
            HeatingMode.state)
        events.sendCommand(Heater, "OFF")

    elif (HeatingMode.state.toString()
          == "auto") or (HeatingMode.state.toString() == "manual"):
        LogAction.logDebug("Check if Heaters need changing",
                           "HHH mode is auto or manual")
        LogAction.logDebug("Check if Heaters need changing",
                           "HHH Heater.itemName: {}", Heater)

        setpoint = TSetpoint.state
        turnOnTemp = setpoint  # - 0.2// calculate the turn on/off temperatures
        turnOffTemp = setpoint  # + 0.1
        temp = Temperature.state  # get the current temperature

        if temp >= turnOffTemp:  # {  // determine whether we need to turn on/off the heater
            LogAction.logDebug("Check if Heaters need changing",
                               "HHH SendCommand to {}, Heater OFF", prefix)
            events.sendCommand(Heater, "OFF")
        elif temp < turnOnTemp:
            LogAction.logDebug("Check if Heaters need changing",
                               "HHH SendCommand to {}, Heater ON", prefix)
            events.sendCommand(Heater, "ON")
Ejemplo n.º 17
0
def pReloadCRON(event):
    LogAction.logWarn("force a reload of this file when triggered",
                      "force vit")
    import personal.heating_cron_normal_setpoints
    reload(personal.heating_cron_normal_setpoints)
    import personal.heating_cron_normal_setpoints
Ejemplo n.º 18
0
def kodi_pause_FR(event):
    LogAction.logError("Pause FrontRoom Kodi", "Pause FrontRoom Kodi: {}",
                       event.itemName)
    events.sendCommand("kodiFrontRoom_control", "PAUSE")
Ejemplo n.º 19
0
def heating_cron_morning_2(event):
    temp = ir.getItem("Outside_Temperature").getState().floatValue()
    LogAction.logWarn("PRE check if cold enough to start heating",
                      "PRE outside  temp = {}", temp)
    if (temp < 7.0):
        morning_heating()
Ejemplo n.º 20
0
def kodi_shutdown_BR(event):
    LogAction.logError("Shutdown bedroom Kodi", "Shutdown bedroom Kodi: {}",
                       event.itemName)
    events.sendCommand("kodiBedroom_systemcommand", "Shutdown")
Ejemplo n.º 21
0
def kodi_shutdown_AT(event):
    LogAction.logError("Shutdown Attic Kodi", "Shutdown Attic Kodi: {}",
                       event.itemName)
    events.sendCommand("kodiAttic_systemcommand", "Shutdown")
Ejemplo n.º 22
0
def schedule_binding_restart(
    binding_id,
    binding_name,
    binding_thing_name, 
    delay_seconds,
    reschedule_timer_on_update=False,
    notify_restart=False
):
    """
    Schedule a binding restart if needed (if Thing status is not 'ONLINE')
    
    Arguments:
        binding_id {String} - The binding identifier (e.g. 'org.openhab.binding.xyzzy')
        binding_name {String} - The name of the binding, e.g. 'XYZZY'
        binding_thing_name {String} - The Thing name linked to the binding (e.g. binding:id:x:y:z)
        delay_seconds {Integer} - # seconds to wait before restarting the binding
    Keyword Arguments:
        reschedule_timer_on_update {bool} - Reschedule restart if update received
        notify_restart {bool} - Notify if the binding is scheduled for restarting
    """
    global timers
    global binding_restarts

    if delay_seconds < 0:
        delay_seconds = 0

    # First, check if Thing is already back online
    current_state = str(things.get(ThingUID(binding_thing_name)).status)
    if current_state == "ONLINE":
        if timers.get(binding_id):
            timers[binding_id].cancel()
            timers[binding_id] = None
            LogAction.logInfo(logTitle, u"No need to restart {} ({} back online)".format(binding_name, binding_thing_name))
        return

    if timers.get(binding_id) is None:
        if notify_restart is True:
            NotificationAction.sendBroadcastNotification(u"Restart scheduled for {} in {}s (status={})".format(binding_name, delay_seconds, current_state))
        # Define the call-back that will be executed when the timer expires.
        def cb():
            global logTitle
            current_state = str(things.get(ThingUID(binding_thing_name)).status)
            if current_state == "ONLINE":
                LogAction.logInfo(logTitle, u"No need to restart {} (status={})".format(binding_name, current_state))
                if notify_restart is True:
                    NotificationAction.sendBroadcastNotification(u"Auto restart canceled for {} (status={})".format(binding_name, current_state))
            else:
                LogAction.logInfo(logTitle, u"Will now restart {} (status={})".format(binding_name, current_state))
                # Keep track of binding restarts
                restart_counter = binding_restarts.get(binding_id)
                if restart_counter is None:
                    binding_restarts[binding_id] = 1
                else:
                    binding_restarts[binding_id] = int(restart_counter) + 1

                if notify_restart is True:
                    NotificationAction.sendBroadcastNotification(u"Auto restart of {} (status={})".format(binding_name, current_state))
                # Restart the binding (use the 'openhab-karaf' entry in ssh config file)
                Exec.executeCommandLine("/bin/sh@@-c@@ssh openhab-karaf bundle:restart {}".format(binding_id))
            timers[binding_id] = None

        timers[binding_id] = ScriptExecution.createTimer(DateTime.now().plusSeconds(delay_seconds), cb)

    else:
        if reschedule_timer_on_update is True:
            LogAction.logInfo(logTitle, u"Reschedule '{}' binding restart (status='{}').".format(binding_name, current_state))
            timers.get(binding_id).reschedule(DateTime.now().plusSeconds(delay_seconds))
Ejemplo n.º 23
0
def removeWatchdogItems():
    for item in ir.getItemsByTag("Watchdog"):
        LogAction.logInfo(logTitle, u"Remove Watchdog Item [{}]".format(item.name))
        remove_item(item)
    remove_item(WATCHDOG_GROUP)
Ejemplo n.º 24
0
def scriptLoaded(*args):
    log.info(RULE_NAME + " loaded.")
    LogAction.logInfo("Timer Test", u" " + RULE_NAME + " geladen")
Ejemplo n.º 25
0
def send_heating_presets(event):
    LogAction.logError(
        "monitor_heating_mode",
        "React on message to send target temperatures to zone setpoints: {}",
        event.itemName)
    global offTemp

    events.postUpdate(
        "Heating_UpdateHeaters",
        "OFF")  #! reset update heaters flag ready for next trigger (OFF-ON)
    LogAction.logError("monitor_heating_mode", "MASTER Heating Mode: {}",
                       ir.getItem("masterHeatingMode").state)

    # ! Whats the current MASTER heating mode?
    if ir.getItem("masterHeatingMode").state.toString(
    ) == "auto":  # normal mode is under master control and folows 'normal' rules
        LogAction.logError(
            "monitor_heating_mode",
            "PPPPPPPPPPPP processing case AUTO MASTER Heating Mode: : {}",
            ir.getItem("masterHeatingMode").state.toString())

        # prefix eg FR_, CT_ etc
        for heatingModeItem in ir.getItem("gHeatingModes").members:
            if ir.getItem(heatingModeItem.name).state.toString() == "auto":
                heaterPrefix = heatingModeItem.name[0:heatingModeItem.name.
                                                    rfind('_') + 1]
                ir.getItem(heaterPrefix +
                           "TemperatureSetpoint").state = ir.getItem(
                               heaterPrefix + "Heating_PresetTempNormal").state
                # LogAction.logError("monitor_heating_mode", "TemperatureSetpoint prefix:{}", heaterPrefix)

    elif ir.getItem("masterHeatingMode").state.toString() == "off":
        LogAction.logError(
            "monitor_heating_mode",
            "PPPPPPPPPP    processing case OFF MASTER Heating Mode: :{}",
            ir.getItem("masterHeatingMode").state.toString())

        for item in ir.getItem("gHeatingModes").members:
            events.postUpdate(item, "off")
        for item in ir.getItem("gTemperatureSetpoints").members:
            events.postUpdate(item, offTemp)

    elif ir.getItem("masterHeatingMode").state == "manual":
        LogAction.logError(
            "monitor_heating_mode",
            "PPPPPPPPP processing case MANUAL MASTER Heating Mode: :{}",
            ir.getItem("masterHeatingMode").state.toString())

    else:
        LogAction.logError("monitor_heating_mode", "Heating Mode unknown:{}",
                           ir.getItem("masterHeatingMode").state.toString())
Ejemplo n.º 26
0
def pir02_off_body():
    # pir_light_off.log.error("pir02_occupancy_off body : KT_light_2_Power: OFF ")
    LogAction.logDebug("pir02_occupancy_off",
                       "pir02_occupancy_off body : KT_light_2_Power: OFF ")
    events.sendCommand("KT_light_2_Power", "OFF")
    events.sendCommand("KT_light_3_Power", "OFF")
Ejemplo n.º 27
0
def outside_startup(event):
    LogAction.logError("outside sensor  startup", "outside sensor  startup")
    if items["outsideReboots"] == NULL:
        # items["ousideReboots"] = DecimalType(0)
        events.postUpdate(ir.getItem("outsideReboots"), 0)