예제 #1
0
 def execute(self, module, input):
     global ruleTimeouts
     now = getNow().getMillis()
     last = ruleTimeouts.get("Livingroom_Hue_Color_Backward",0)
     
     if now - last > 1000:
         sendCommand("State_Lightprogram", 0)
예제 #2
0
    def execute(self, module, input):
        sendCommand("Motiondetector_Outdoor_Carport_Switch", OFF)
        sendCommand("Motiondetector_Outdoor_Frontdoor_Switch", OFF)
        sendCommand("Motiondetector_Outdoor_Terrace_Switch", OFF)
        sendCommand("Motiondetector_Outdoor_Garage_Streetside_Switch", OFF)
        sendCommand("Motiondetector_Outdoor_Garage_Gardenside_Switch", ON)

        postUpdate("Scene5", OFF)
예제 #3
0
 def _setCurrentColors(self,data):
     global ruleTimeouts
     ruleTimeouts["Livingroom_Hue_Color_Backward"] = getNow().getMillis()
     
     sendCommand("Light_FF_Livingroom_Hue_Color1",u"{},{},{}".format(data[0][0],data[0][1],data[0][2]))
     sendCommand("Light_FF_Livingroom_Hue_Color2",u"{},{},{}".format(data[1][0],data[1][1],data[1][2]))
     sendCommand("Light_FF_Livingroom_Hue_Color3",u"{},{},{}".format(data[2][0],data[2][1],data[2][2]))
     sendCommand("Light_FF_Livingroom_Hue_Color4",u"{},{},{}".format(data[3][0],data[3][1],data[3][2]))
     sendCommand("Light_FF_Livingroom_Hue_Color5",u"{},{},{}".format(data[4][0],data[4][1],data[4][2]))
예제 #4
0
    def execute(self, module, input):
        if getItemState("TV_Online") == ON:
            if input["command"] == OFF:
                sendCommand("TV_Online", OFF)
        else:
            if input["command"] == ON:
                sendCommand("TV_Online", ON)

        postUpdate("Scene6", OFF)
예제 #5
0
 def execute(self, module, input):
     if getItemState("State_Presence").intValue() == 0 \
             and getItemState("roomba_auto") == ON \
             and getItemState("roomba_status").toString() == "Charging" \
             and getItemState("roomba_batPct").intValue() >= 100 \
             and getItemState("roomba_error") == OFF \
             and getItemState("roomba_full") == OFF:
         if itemLastUpdateOlderThen("roomba_cleaning_state", getNow().minusMinutes(360)) \
                 and itemLastUpdateOlderThen("State_Presence", getNow().minusMinutes(60)):
             sendCommand("roomba_command", "start")
예제 #6
0
    def execute(self, module, input):
        if getItemState("Ventilation_Auto_Mode").intValue() != 1:
            return

        currentLevel = getItemState("Ventilation_Fan_Level").intValue()

        raumTemperatur = getItemState(
            "Temperature_FF_Livingroom").doubleValue()
        zielTemperatur = getItemState(
            "Ventilation_Comfort_Temperature").doubleValue

        presenceSate = getItemState("State_Presence").intValue()

        isTooWarm = raumTemperatur >= zielTemperatur
        coolingPossible = getItemState(
            "Temperature_Garden").doubleValue() < raumTemperatur

        # Sleep
        if presenceSate == 2:
            reducedLevel = 2  # Level 1
            defaultLevel = 2  # Level 1
            coolingLevel = 2  # Level 1
        # Away since 30 minutes
        elif presenceSate == 0 and itemLastUpdateOlderThen(
                "State_Presence",
                getNow().minusMinutes(60)):
            reducedLevel = 1  # Level A
            defaultLevel = 2  # Level 1
            coolingLevel = 3  # Level 2
        else:
            reducedLevel = 2  # Level 1
            defaultLevel = 3  # Level 2
            coolingLevel = 3  # Level 2

        # reducedLevel if it is too warm inside and also outside
        # coolingLevel if it is too warm inside but outside colder then inside
        newLevel = (coolingLevel if coolingPossible else
                    reducedLevel) if isTooWarm else defaultLevel

        if newLevel != currentLevel:
            # Wenn der aktuelle Level Stufe 'A' (also 1) ist, sollte vor einem erneuten umschalten gewartet werden damit ein
            # hin und herschalten vermieden wird. z.B. bei kurzzeitigen Temperaturschwankungen
            if currentLevel == 1:
                waitBeforeChange = 15
            else:
                # must be > 1. Otherwise cangedSince dows not work propperly
                waitBeforeChange = 2

            if itemLastUpdateOlderThen(
                    "Ventilation_Fan_Level",
                    getNow().minusMinutes(waitBeforeChange)):
                global autoChangeInProgress
                autoChangeInProgress = True

                sendCommand("Ventilation_Fan_Level", newLevel)
예제 #7
0
    def execute(self, module, input):
        if input["event"].getItemName() == "Solar_AC_Power":
            self.updateConsumption(input['event'].getItemState().intValue())
        else:
            if input["event"].getItemName() == "Power_Demand_Active":
                self.powerDemand = input["event"].getItemState().intValue()
                self.powerSupply = getItemState(
                    "Power_Supply_Active").intValue()

                if self.powerDemand != getItemState(
                        "Power_Demand_Active").intValue():
                    self.log.error(
                        "Item demand state differences: {}, item state: {}".
                        format(self.powerDemand,
                               getItemState("Power_Demand_Active").intValue()))
            else:
                self.powerDemand = getItemState(
                    "Power_Demand_Active").intValue()
                self.powerSupply = input["event"].getItemState().intValue()

                if self.powerSupply != getItemState(
                        "Power_Supply_Active").intValue():
                    self.log.error(
                        "Item supply state differences: {}, item state: {}".
                        format(self.powerSupply,
                               getItemState("Power_Supply_Active").intValue()))

            self.currentDemand = self.powerDemand - self.powerSupply

            if getItemState("State_Solar") == ON:
                # solar value update was not successful for a while
                #solarActive = getItemState("State_Solar") == ON
                #if itemLastUpdateOlderThen("Solar_Total_Yield", getNow().minusHours(5) if solarActive else getNow().minusHours(14)):
                if itemLastUpdateOlderThen("Solar_Total_Yield",
                                           getNow().minusHours(24)):
                    self.log.info(
                        u"Solar: ERROR • Values not updated. Fallback to '0' values."
                    )
                    postUpdate("Solar_AC_Power", 0)
                    postUpdateIfChanged("Solar_DC_Power", 0)
                    postUpdateIfChanged("Solar_DC_Current", 0)
                    postUpdateIfChanged("Solar_DC_Voltage", 0)
                    postUpdateIfChanged("Solar_Daily_Yield", 0)

                # triggers solar value update
                sendCommand("Solar_AC_Power", REFRESH)
            else:
                self.updateConsumption(0)

            postUpdateIfChanged("Electricity_Current_Demand",
                                self.currentDemand)
예제 #8
0
    def execute(self, module, input):
        sendCommand("Light_FF_Floor_Ceiling", ON)
        sendCommand("Light_SF_Bathroom_Ceiling", ON)
        sendCommand("Light_SF_Bathroom_Mirror", ON)
        sendCommand("Light_SF_Bedroom_Ceiling", ON)

        postUpdate("Scene2", OFF)
예제 #9
0
    def execute(self, module, input):
        if getItemState("State_Outdoorlights") == ON and getItemState(
                "Motiondetector_Outdoor_Terrace_Switch") == ON:
            global timerMappings
            if timerMappings.get("Light_Outdoor_Terrace") is not None:
                timerMappings["Light_Outdoor_Terrace"].cancel()
            timerMappings["Light_Outdoor_Terrace"] = createTimer(
                timerDuration, self.callback)
            timerMappings["Light_Outdoor_Terrace"].start()

            global ruleTimeouts
            ruleTimeouts["Light_Outdoor"] = getNow().getMillis()

            sendCommand("Light_Outdoor_Terrace", 100)
예제 #10
0
 def execute(self, module, input):
     if input["event"].getItemName() == "Door_FF_Floor":
         if self.isArriving:
             if getItemState("State_Outdoorlights") == ON:
                 sendCommand("Light_FF_Floor_Ceiling", ON)
             self.isArriving = False
     # 10 minutes matches the max time ranges used by presence detection to ping phones => see pingdevice thing configuration
     # it can happen that State_Presence changes after Door_FF_Floor was opened
     elif itemLastUpdateOlderThen("Door_FF_Floor",
                                  getNow().minusMinutes(10)):
         self.isArriving = input["event"].getItemState().intValue(
         ) == 1 and input["oldState"].intValue() == 0
         if self.isArriving:
             self.arrivingTimer = createTimer(60, self.arrivingCallback)
             self.arrivingTimer.start()
예제 #11
0
    def callback(self, entry):
        global timerMappings
        if getItemState(entry[1]) == ON:
            if getItemState(entry[2]) == OPEN:
                timerMappings[entry[0]] = createTimer(timerDuration,
                                                      self.callback, [entry])
                timerMappings[entry[0]].start()
            else:
                global ruleTimeouts
                ruleTimeouts["Light_Outdoor"] = getNow().getMillis()

                sendCommand(entry[0], OFF)
                timerMappings[entry[0]] = None
        else:
            timerMappings[entry[0]] = None
예제 #12
0
    def execute(self, module, input):
        itemName = input['event'].getItemName()

        entry = manualMappings[self.triggerMappings[itemName]]
        if getItemState("State_Outdoorlights") == ON and getItemState(
                entry[1]) == ON:
            if timerMappings.get(entry[0]) is not None:
                timerMappings[entry[0]].cancel()
            timerMappings[entry[0]] = createTimer(timerDuration, self.callback,
                                                  [entry])
            timerMappings[entry[0]].start()

            global ruleTimeouts
            ruleTimeouts["Light_Outdoor"] = getNow().getMillis()

            sendCommand(entry[0], ON)
예제 #13
0
    def callback(self):
        global timerMappings
        if getItemState("Motiondetector_Outdoor_Terrace_Switch") == ON:
            if getItemState(
                    "Motiondetector_Outdoor_Terrace1") == OPEN or getItemState(
                        "Motiondetector_Outdoor_Terrace2") == OPEN:
                timerMappings["Light_Outdoor_Terrace"] = createTimer(
                    timerDuration, self.callback)
                timerMappings["Light_Outdoor_Terrace"].start()
            else:
                global ruleTimeouts
                ruleTimeouts["Light_Outdoor"] = getNow().getMillis()

                sendCommand("Light_Outdoor_Terrace", 0)
                timerMappings["Light_Outdoor_Terrace"] = None
        else:
            timerMappings["Light_Outdoor_Terrace"] = None
예제 #14
0
 def callback(self):
     if getItemState("State_Lightprogram").intValue() == 0:
         return
     
     color1 = getItemState("Light_FF_Livingroom_Hue_Color1")
     color2 = getItemState("Light_FF_Livingroom_Hue_Color2")
     color3 = getItemState("Light_FF_Livingroom_Hue_Color3")
     color4 = getItemState("Light_FF_Livingroom_Hue_Color4")
     color5 = getItemState("Light_FF_Livingroom_Hue_Color5")
         
     global ruleTimeouts
     ruleTimeouts["Livingroom_Hue_Color_Backward"] = getNow().getMillis()
 
     sendCommand("Light_FF_Livingroom_Hue_Color1",color2)
     sendCommand("Light_FF_Livingroom_Hue_Color2",color3)
     sendCommand("Light_FF_Livingroom_Hue_Color3",color4)
     sendCommand("Light_FF_Livingroom_Hue_Color4",color5)
     sendCommand("Light_FF_Livingroom_Hue_Color5",color1)
                 
     self.timer = createTimer(self.timeout, self.callback )
     self.timer.start()
예제 #15
0
    def execute(self, module, input):
        hour = getNow().getHourOfDay()

        state = getItemState("Auto_Attic_Light").intValue()

        if state == 2:
            if hour == 5:
                sendCommand("Socket_Attic", ON)
            elif hour == 23:
                sendCommand("Socket_Attic", OFF)
        elif state == 3:
            if hour == 8:
                sendCommand("Socket_Attic", ON)
            elif hour == 20:
                sendCommand("Socket_Attic", OFF)
예제 #16
0
    def execute(self, module, input):

        now = getNow().getMillis()

        currentACPower = getItemState("Solar_AC_Power").intValue()

        currentPowerLimitation = getItemState(
            "Solar_Power_Limitation").intValue()

        currentConsumptionValue = getItemState(
            "Electricity_Current_Consumption").intValue()
        # must be called to fill history stack
        avgConsumptionValue = self.getAvgConsumption(now,
                                                     currentConsumptionValue)

        if currentACPower > 0:
            possiblePowerLimitation = self.getPossibleLimitation(
                currentConsumptionValue)
            possibleAvgPowerLimitation = self.getPossibleLimitation(
                avgConsumptionValue)

            self.log.info(
                u"currentLimit: {}%, currentConsumption: {}W, avgConsumption: {}W, possibleLimit: {}%, possibleAvgLimit: {}%, stack: {}, li: {}"
                .format(currentPowerLimitation, currentConsumptionValue,
                        avgConsumptionValue,
                        possiblePowerLimitation, possibleAvgPowerLimitation,
                        len(self.stack), (now - self.lastLimitationIncrease)))

            if possiblePowerLimitation >= currentPowerLimitation:
                self.lastLimitationIncrease = now
                if possiblePowerLimitation > currentPowerLimitation:
                    sendCommand("Solar_Power_Limitation",
                                possiblePowerLimitation)
                    self.log.info(
                        u"Increase power limitation from {}% to {}%".format(
                            currentPowerLimitation, possiblePowerLimitation))
                    return
            elif now - self.lastLimitationIncrease > maxTimeSlot:
                if possibleAvgPowerLimitation < currentPowerLimitation:
                    sendCommand("Solar_Power_Limitation",
                                possibleAvgPowerLimitation)
                    self.log.info(
                        u"Decrease power limitation from {}% to {}%".format(
                            currentPowerLimitation,
                            possibleAvgPowerLimitation))
                    return

            if len(input) == 0 and itemLastUpdateOlderThen(
                    "Solar_Power_Limitation",
                    getNow().minusMinutes(4)):
                sendCommand("Solar_Power_Limitation", currentPowerLimitation)
                self.log.info(u"Refresh power limitation of {}%".format(
                    currentPowerLimitation))
        elif currentPowerLimitation != 100:
            postUpdate("Solar_Power_Limitation", 100)
            self.log.info(u"Shutdown power limitation")
예제 #17
0
    def findStep(self):
        duration = getItemState(
            "Watering_Program_Duration").intValue() * 60.0 * 1000.0

        remaining = 0
        info = u""

        if getItemState("Watering_Circuits") == OFF:
            for group in circuits:
                #self.log.info("start " + loop[0][0])
                isActive = False
                for circuit in group[2]:
                    if getItemState(circuit + "_Auto") == ON:
                        sendCommand(circuit, ON)
                        isActive = True
                if isActive:
                    remaining = (duration * group[0])
                    info = group[1]
                    break

        else:
            activeIndex = -1
            activeGroup = None
            for i in range(len(circuits)):
                group = circuits[i]

                if getItemState(group[2][0]) == ON:
                    activeIndex = i
                    activeGroup = group
                    break

            if activeGroup != None:
                runtime = getNow().getMillis() - getItemLastUpdate(
                    activeGroup[2][0]).getMillis()

                remaining = (duration * activeGroup[0]) - runtime
                if remaining <= 0:
                    activeIndex += 1
                    if activeIndex < len(circuits):
                        for circuit in circuits[activeIndex][2]:
                            sendCommand(circuit, ON)
                        for circuit in activeGroup[2]:
                            sendCommand(circuit, OFF)

                        activeGroup = circuits[activeIndex]

                        remaining = (duration * activeGroup[0])
                        info = activeGroup[1]
                    else:
                        self.disableAllCircuits()
                        postUpdate("Watering_Program_Start", OFF)
                else:
                    info = activeGroup[1]

        return [info, remaining]
예제 #18
0
    def execute(self, module, input):
        sendCommand("Light_FF_Livingroom_Hue_Brightness", 60)

        states = [OFF, PercentType.ZERO]

        for child in getItem("Lights_FF").getAllMembers():
            if child.getState() not in states and child.getName(
            ) != "Light_FF_Livingroom_Hue_Brightness":
                sendCommand(child, OFF)

        for child in getItem("Lights_SF").getAllMembers():
            if child.getState() not in states:
                sendCommand(child, OFF)

        postUpdate("Scene1", OFF)
예제 #19
0
    def execute(self, module, input):
        state = getItemState("roomba_passes").toString()

        if state == "auto":
            sendCommand("roomba_noAutoPasses", OFF)
            time.sleep(2)
            sendCommand("roomba_twoPass", OFF)
        elif state == "one":
            sendCommand("roomba_noAutoPasses", ON)
            time.sleep(2)
            sendCommand("roomba_twoPass", OFF)
        elif state == "two":
            sendCommand("roomba_noAutoPasses", OFF)
            time.sleep(2)
            sendCommand("roomba_twoPass", ON)
예제 #20
0
    def execute(self, module, input):
        sendCommand("Light_FF_Floor_Hue_Brightness", 60)
        sendCommand("Light_SF_Bathroom_Ceiling", ON)
        sendCommand("Light_SF_Bathroom_Mirror", ON)
        sendCommand("Light_SF_Bedroom_Right", ON)

        states = [OFF, PercentType.ZERO]

        for child in getItem("Lights_FF").getAllMembers():
            if child.getState() not in states and child.getName(
            ) != "Light_FF_Floor_Hue_Brightness":
                sendCommand(child, OFF)

        #for child in getItem("Lights_SF").getAllMembers():
        #    if child.getState() not in states and child.getName() not in ["Light_SF_Bathroom_Mirror", "Light_SF_Bedroom_Right"]:
        #        sendCommand(child, OFF)

        sendCommand("Scene6", ON)
        postUpdate("Scene3", OFF)
예제 #21
0
    def execute(self, module, input):
        state = getItemState("roomba_boost").toString()

        if state == "eco":
            sendCommand("roomba_carpetBoost", OFF)
            time.sleep(2)
            sendCommand("roomba_vacHigh", OFF)
        elif state == "auto":
            sendCommand("roomba_carpetBoost", ON)
            time.sleep(2)
            sendCommand("roomba_vacHigh", OFF)
        elif state == "performance":
            sendCommand("roomba_carpetBoost", OFF)
            time.sleep(2)
            sendCommand("roomba_vacHigh", ON)
예제 #22
0
 def execute(self, module, input):
     if input["newState"] == OPEN:
         sendCommand("Socket_Livingroom_Bassbox", ON)
     else:
         sendCommand("Socket_Livingroom_Bassbox", OFF)
예제 #23
0
 def execute(self, module, input):
     if getItemState("State_Solar") == ON:
         # triggers solar value update
         sendCommand("Solar_Total_Yield", REFRESH)
예제 #24
0
 def execute(self, module, input):
     if input["event"].getItemCommand() == ON:
         sendCommand("TV_KEY_POWER_ON", ON)
     else:
         pass
예제 #25
0
    def execute(self, module, input):
        global ruleTimeouts
        ruleTimeouts["Livingroom_Hue_Color_Backward"] = getNow().getMillis()

        command = input['event'].getItemCommand()
        
        colors = command.toString().split(",")
        red = round(float(colors[0]))
        green = round(float(colors[1]))
        blue = round(float(colors[1]))
        
        command = u"{},{},{}".format(red,green,blue)
        
        sendCommand("Light_FF_Livingroom_Hue_Color1", command)
        sendCommand("Light_FF_Livingroom_Hue_Color2", command)
        sendCommand("Light_FF_Livingroom_Hue_Color3", command)
        sendCommand("Light_FF_Livingroom_Hue_Color4", command)
        sendCommand("Light_FF_Livingroom_Hue_Color5", command)
        
        sendCommand("State_Lightprogram", 0)
예제 #26
0
 def execute(self, module, input):
     sendCommand("State_Lightprogram", 0)
예제 #27
0
 def execute(self, module, input):
     sendCommand("Scene4", ON)
예제 #28
0
 def execute(self, module, input):
     if getItemState("Light_SF_Bedroom_Right_Hue_Brightness").intValue() == 0:
         sendCommand("Light_SF_Bedroom_Right_Hue_Brightness",100)
     else:
         sendCommand("Light_SF_Bedroom_Right_Hue_Brightness",0)
예제 #29
0
    def controlHeating( self, now, currentOperatingMode, isHeatingRequested ):

        # 0 - Abschalten
        # 1 - Nur WW
        # 2 - Heizen mit WW
        # 3 - Reduziert
        # 4 - Normal
        
        if self.activeHeatingOperatingMode == -1:
            self.activeHeatingOperatingMode = currentOperatingMode
        
        forceRetry = self.activeHeatingOperatingMode != currentOperatingMode
        forceRetryMsg = u" • RETRY {} {}".format(self.activeHeatingOperatingMode,currentOperatingMode) if forceRetry else u""
        delayedMsg = u""
        
        currentOperatingModeUpdate = getItemLastUpdate("Heating_Operating_Mode")
        lastUpdateBeforeInMinutes = int( math.floor( ( now.getMillis() - currentOperatingModeUpdate.getMillis() ) / 1000.0 / 60.0 ) )
        lastHeatingChangeFormatted = OFFSET_FORMATTER.print(currentOperatingModeUpdate)
        lastUpdateBeforeFormatted = lastUpdateBeforeInMinutes if lastUpdateBeforeInMinutes < 60 else '{:02d}:{:02d}'.format(*divmod(lastUpdateBeforeInMinutes, 60));
        
        self.log.info(u"Active  : {} since {} • {} min. ago".format(Transformation.transform("MAP", "heating_de.map", str(currentOperatingMode) ),lastHeatingChangeFormatted,lastUpdateBeforeFormatted) )
        
        # Nur WW
        if currentOperatingMode == 1:
            # Temperatur sollte seit XX min nicht OK sein und 'Nur WW' sollte mindestens XX min aktiv sein um 'flattern' zu vermeiden
            if isHeatingRequested:
                isRunningLongEnough = itemLastUpdateOlderThen("Heating_Operating_Mode", now.minusMinutes(Heating.MIN_ONLY_WW_TIME))
                
                if forceRetry or isRunningLongEnough:
                    self.activeHeatingOperatingMode = 2
                    sendCommand("Heating_Operating_Mode", self.activeHeatingOperatingMode)
                else:
                    runtimeToGo = Heating.MIN_ONLY_WW_TIME - int( round( ( now.getMillis() - currentOperatingModeUpdate.getMillis() ) / 1000.0 / 60.0 ) )
                    delayedMsg = u" in {} min.".format(runtimeToGo)

                self.log.info(u"Switch  : Heizen mit WW{}{}".format(delayedMsg,forceRetryMsg))

        # Heizen mit WW
        elif currentOperatingMode == 2:
            currentPowerState = getItemState("Heating_Power").intValue()
            
            if currentPowerState == 0 and lastUpdateBeforeInMinutes < 1:
                self.log.info(u"Delayed : Give the heating system more time to react")
                return
        
            # Wenn Heizkreispumpe auf 0 dann ist Heizen zur Zeit komplett deaktiviert (zu warm draussen) oder Brauchwasser wird aufgeheizt
            #if Heating_Circuit_Pump_Speed.state > 0:
            # Temperatur sollte seit XX min OK sein und Brenner sollte entweder nicht laufen oder mindestens XX min am Stück gelaufen sein
            if not isHeatingRequested:
                isRunningLongEnough = itemLastUpdateOlderThen("Heating_Operating_Mode",now.minusMinutes(Heating.MIN_HEATING_TIME))
                
                if currentPowerState == 0 or forceRetry or isRunningLongEnough:
                    self.activeHeatingOperatingMode = 1
                    sendCommand("Heating_Operating_Mode",self.activeHeatingOperatingMode)
                else:
                    runtimeToGo = Heating.MIN_HEATING_TIME - int( round( ( now.getMillis() - currentOperatingModeUpdate.getMillis() ) / 1000.0 / 60.0 ) )
                    delayedMsg = u" in {} min.".format(runtimeToGo)

                self.log.info(u"Switch  : Nur WW{}{}".format(delayedMsg,forceRetryMsg))
                  
            # Brenner läuft nicht
            elif currentPowerState == 0:
                forceReducedMsg = None
                
                # TODO maybe check Heating_Temperature_Wather_Storage if the temerature is increasing => hint that water heating is active
                # TODO also if Heating_Power is going from 0 to 65 and one minute later from 65 to 0 is a hint for a unsuccessful start
                
                # No burner starts since a while
                if itemLastUpdateOlderThen("Heating_Power",now.minusMinutes(5)) and itemLastUpdateOlderThen("Heating_Operating_Mode",now.minusMinutes(5)):
                    forceReducedMsg = u" • No burner starts"
                else:
                    burnerStarts = self.getBurnerStarts(now)
                
                    if burnerStarts > 1:
                        forceReducedMsg = u" • Too many burner starts"
                        
                if forceReducedMsg != None:
                    self.activeHeatingOperatingMode = 3
                   
                    sendCommand("Heating_Operating_Mode",self.activeHeatingOperatingMode)
                    self.log.info(u"Switch  : Reduziert{}{}".format(forceReducedMsg,forceRetryMsg))
        
        # Reduziert
        elif currentOperatingMode == 3:
            # Wenn Temperatur seit XX min OK ist und der brenner sowieso aus ist kann gleich in 'Nur WW' gewechselt werden
            if not isHeatingRequested:
                self.activeHeatingOperatingMode = 1
                sendCommand("Heating_Operating_Mode",self.activeHeatingOperatingMode)
                self.log.info(u"Switch  : Nur WW because heating is not needed anymore{}".format(forceRetryMsg))
            else:
                lastReducedRuntime = self.getLastReductionTime( currentOperatingModeUpdate )
                if lastReducedRuntime > 0:
                    targetReducedTime = int( round(lastReducedRuntime * 2.0 / 1000.0 / 60.0, 0) )
                    if targetReducedTime > Heating.MAX_REDUCTION_TIME:
                        targetReducedTime = Heating.MAX_REDUCTION_TIME
                    elif targetReducedTime < Heating.MIN_REDUCED_TIME:
                        # SHOULD NEVER HAPPEN !!!
                        self.log.error(u"MIN_REDUCED_TIME less then allowed. Was {}".format(targetReducedTime))
                        targetReducedTime = Heating.MIN_REDUCED_TIME
                else:
                    targetReducedTime = Heating.MIN_REDUCED_TIME
                                
                #self.log.info(u"E {}".format(targetReducedTime))
                    
                # Dauernd reduziert läuft seit mindestens XX Minuten
                if forceRetry or itemLastUpdateOlderThen("Heating_Operating_Mode",now.minusMinutes(targetReducedTime) ):
                    self.activeHeatingOperatingMode = 2
                    sendCommand("Heating_Operating_Mode",self.activeHeatingOperatingMode)
                elif not forceRetry:
                    runtimeToGo = targetReducedTime - int( round( ( now.getMillis() - currentOperatingModeUpdate.getMillis() ) / 1000.0 / 60.0 ) )
                    delayedMsg = u" in {} min.".format(runtimeToGo)
                    
                self.log.info(u"Switch  : Heizen mit WW{}{}".format(delayedMsg,forceRetryMsg))
예제 #30
0
 def disableAllCircuits(self):
     for child in getGroupMember("Watering_Circuits"):
         sendCommand(child, OFF)
     postUpdate("Watering_Program_State", u"läuft nicht")