def _getCurrentColors(self):
     color1 = getItemState("Light_FF_Livingroom_Hue_Color1").toString().split(",")
     color2 = getItemState("Light_FF_Livingroom_Hue_Color2").toString().split(",")
     color3 = getItemState("Light_FF_Livingroom_Hue_Color3").toString().split(",")
     color4 = getItemState("Light_FF_Livingroom_Hue_Color4").toString().split(",")
     color5 = getItemState("Light_FF_Livingroom_Hue_Color5").toString().split(",")
     return [color1,color2,color3,color4,color5]
    def execute(self, module, input):
        moverStatus = getItemState("MowerStatus").toString()

        if itemLastUpdateOlderThen("MowerWlanSignal",
                                   getNow().minusMinutes(60)):
            if moverStatus != "98":
                postUpdate("MowerStatus", 98)
                postUpdate(
                    "MowerStatusFormatted",
                    Transformation.transform("MAP", "robonect_status.map",
                                             "98"))
        else:
            seconds = getItemState("MowerDuration").intValue()
            hours = seconds / (60 * 60)
            seconds = seconds % (60 * 60)
            minutes = seconds / 60
            #seconds = seconds % 60

            msg = u"{} seit ".format(
                Transformation.transform("MAP", "robonect_status.map",
                                         moverStatus))
            if hours < 10: msg = u"{}0".format(msg)
            msg = u"{}{}:".format(msg, hours)
            if minutes < 10: msg = u"{}0".format(msg)
            msg = u"{}{}:".format(msg, minutes)

            postUpdateIfChanged("MowerStatusFormatted", msg)
Esempio n. 3
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")
Esempio n. 4
0
    def execute(self, module, input):
        msg = u""
        if getItemState("Wind_Garden_Converted").intValue() == 0:
            msg = u"Ruhig"
        else:
            msg = u"{} km/h, {}".format(
                getItemState("Wind_Garden_Converted").format("%.1f"),
                getItemState("Wind_Direction").toString())

        postUpdateIfChanged("Wind_Message", msg)
Esempio n. 5
0
    def execute(self, module, input):
        dailyEnergyDemand = getItemState(
            "Electricity_Current_Daily_Demand").doubleValue()
        dailyEnergySupply = getItemState(
            "Electricity_Current_Daily_Supply").doubleValue()
        dailySolarSupply = getItemState("Solar_Daily_Yield").doubleValue()

        postUpdateIfChanged(
            "Electricity_Current_Daily_Consumption",
            dailyEnergyDemand - dailyEnergySupply + dailySolarSupply)
Esempio n. 6
0
 def execute(self, module, input):
     if getItemState("Auto_Sunprotection") == ON and getItemState("State_Presence").intValue() == 0:
         if getItemState("State_Sunprotection_Livingroom") == ON:
             sendCommand("Shutters_FF_Kitchen", DOWN)
             sendCommand("Shutters_FF_Livingroom_Couch", DOWN)
             if getItemState("Window_FF_Livingroom_Terrace") == CLOSED:
                 sendCommand("Shutters_FF_Livingroom_Terrace", DOWN)
         else:
             sendCommand("Shutters_FF_Kitchen", UP)
             sendCommand("Shutters_FF_Livingroom_Couch", UP)
             sendCommand("Shutters_FF_Livingroom_Terrace", UP)
Esempio n. 7
0
    def execute(self, module, input):
        active = []

        if getItemState("Auto_Rollershutter") == ON:        active.append("R")
        if getItemState("Auto_Sunprotection") == ON:        active.append("S")
        if getItemState("Auto_Lighting") == ON:             active.append("L")
        if getItemState("Auto_Christmas") == ON:            active.append("W")
        if getItemState("Auto_Attic_Light").intValue() > 1: active.append("D")
        if len(active) == 0:                                active.append("Inaktiv")

        msg = ", ".join(active)

        postUpdateIfChanged("AutoStatus", msg)
    def execute(self, module, input):
        if getItemState("Heating_Solar_Pump_State").intValue() == 1:
            msg = "an"
        else:
            msg = "aus"

        msg = msg + ", "

        if getItemState("Heating_Solar_Reheating_State").intValue() == 1:
            msg = msg + "an"
        else:
            msg = msg + "aus"

        postUpdateIfChanged("Heating_Solar_State_Message", msg)
Esempio n. 9
0
    def execute(self, module, input):
        now = getNow()

        currentSupply = getItemState("Electricity_Total_Supply").doubleValue()
        currentYield = getItemState("Solar_Total_Yield").doubleValue()

        # Tagesverbrauch
        startSupply = getHistoricItemState(
            "Electricity_Total_Supply",
            now.withTimeAtStartOfDay()).doubleValue()
        startYield = getHistoricItemState(
            "Solar_Total_Yield", now.withTimeAtStartOfDay()).doubleValue()

        # sometimes solar converter is providing wrong value. Mostly if he is inactive in the night
        if currentYield > 1000000000 or startYield > 1000000000:
            self.log.error(
                u"Wrong Solar Value: currentYield is {}, startYield is {}".
                format(currentYield, startYield))
            return

        totalSupply = currentSupply - startSupply
        totalYield = currentYield - startYield
        dailyConsumption = totalYield - totalSupply

        postUpdateIfChanged("Solar_Daily_Yield", totalYield)

        #self.log.info(u"A {} {}".format(currentSupply,currentYield))
        #self.log.info(u"B {} {}".format(startSupply,startYield))
        #self.log.info(u"C {} {}".format(totalSupply,totalYield))

        postUpdateIfChanged("Solar_Daily_Consumption", dailyConsumption)

        # Jahresverbrauch
        startSupply = getHistoricItemState(
            "Electricity_Total_Supply",
            now.withDate(now.getYear(), 1,
                         1).withTimeAtStartOfDay()).doubleValue()
        startYield = getHistoricItemState(
            "Solar_Total_Yield",
            now.withDate(now.getYear(), 1,
                         1).withTimeAtStartOfDay()).doubleValue()

        totalSupply = currentSupply - startSupply
        totalYield = currentYield - startYield
        annualConsumption = totalYield - totalSupply

        #self.log.info(u"D {} {}".format(startSupply,startYield))
        #self.log.info(u"E {}".format(annualConsumption))

        postUpdateIfChanged("Solar_Annual_Consumption", annualConsumption)
Esempio n. 10
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)
Esempio n. 11
0
    def execute(self, module, input):
        active = []

        if getItemState("Watering_Circuits") == ON:
            active.append(u"Bewässerung")

        if getItemState("Motiondetector_Outdoor_Switch") != ON:
            active.append(u"Beleuchtung")

        if len(active) == 0:
            active.append(u"Alles normal")

        msg = ", ".join(active)

        postUpdateIfChanged("GardenStatus", msg)
Esempio n. 12
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
Esempio n. 13
0
    def updateInfoMessage(self,
                          infoItem,
                          temperatureItem,
                          humidityItem,
                          temperatureTargetItem=None):
        msg = u""
        if temperatureTargetItem is not None:
            msg = u"{}({}°C) ".format(
                msg,
                getItemState(temperatureTargetItem).format("%.1f"))

        msg = u"{}{}°C, ".format(msg,
                                 getItemState(temperatureItem).format("%.1f"))
        msg = u"{}{}%".format(msg, getItemState(humidityItem).format("%.1f"))

        postUpdateIfChanged(infoItem, msg)
 def callbackFaded(self,step,data):
     if getItemState("State_Lightprogram").intValue() == 0:
         return
         
     color1, color2, color3, color4, color5 = data
     
     if step == self.fadingSteps:
         newColor1 = color2
         newColor2 = color3
         newColor3 = color4
         newColor4 = color5
         newColor5 = color1
     else:
         currentColor1, currentColor2, currentColor3, currentColor4 , currentColor5 = self._getCurrentColors()
         
         newColor1 = self._fade( step, color1, color2, currentColor1 )
         newColor2 = self._fade( step, color2, color3, currentColor2 )
         newColor3 = self._fade( step, color3, color4, currentColor3 )
         newColor4 = self._fade( step, color4, color5, currentColor4 )
         newColor5 = self._fade( step, color5, color1, currentColor5 )
         
     self.log.info(u"{} - 1 {}, from {} => {}".format(step,newColor1,color1, color2))
     self.log.info(u"{} - 2 {}, from {} => {}".format(step,newColor2,color2, color3))
     self.log.info(u"{} - 3 {}, from {} => {}".format(step,newColor3,color3, color4))
     self.log.info(u"{} - 4 {}, from {} => {}".format(step,newColor4,color4, color5))
     self.log.info(u"{} - 5 {}, from {} => {}".format(step,newColor5,color5, color1))
     
     self._setCurrentColors([newColor1,newColor2,newColor3,newColor4,newColor5])
     
     if step < self.fadingSteps:
         self.timer = createTimer(self.timeout, self.callbackFaded, [step + 1, data] )
         self.timer.start()
     else:
         self.timer = createTimer(self.timeout, self.callbackFaded, [1, self._getCurrentColors() ] )
         self.timer.start()
Esempio n. 15
0
def getHistoricReference(log, itemName, valueTime, outdatetTime, messureTime,
                         intervalTime):
    endTime = getItemLastUpdate(itemName)
    endTimestampInMillis = endTime.getMillis()

    nowInMillis = getNow().getMillis()

    if endTimestampInMillis < nowInMillis - (outdatetTime * 1000):
        log.info(u"No consumption. Last value is too old.")
        return 0

    minMessuredTimestampInMillis = nowInMillis - (messureTime * 1000)

    endValue = getItemState(itemName).doubleValue()

    startTimestampInMillis = endTimestampInMillis
    startValue = 0

    currentTime = DateTime(startTimestampInMillis - 1)

    itemCount = 0

    while True:
        itemCount = itemCount + 1

        historicEntry = getHistoricItemEntry(itemName, currentTime)

        startValue = historicEntry.getState().doubleValue()

        _millis = historicEntry.getTimestamp().getTime()

        # current item is older then the allowed timeRange
        if _millis < minMessuredTimestampInMillis:
            log.info(u"Consumption time limit exceeded")
            startTimestampInMillis = startTimestampInMillis - (intervalTime *
                                                               1000)
            if _millis > startTimestampInMillis:
                startTimestampInMillis = _millis
            break
        # 2 items are enough to calculate with
        elif itemCount >= 2:
            log.info(u"Consumption max item count exceeded")
            startTimestampInMillis = _millis
            break
        else:
            startTimestampInMillis = _millis
            currentTime = DateTime(startTimestampInMillis - 1)

    durationInSeconds = round(
        float(endTimestampInMillis - startTimestampInMillis) / 1000.0)
    value = ((endValue - startValue) / durationInSeconds) * valueTime
    if value < 0:
        value = 0

    startTime = DateTime(startTimestampInMillis)
    log.info(u"Consumption {} messured from {} ({}) to {} ({})".format(
        value, startValue, dateTimeFormatter.print(startTime), endValue,
        dateTimeFormatter.print(endTime)))

    return value
Esempio n. 16
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)
    def callbackProgress(self):
        if self.progressTimer is not None and self.currentProgressMsg != getItemState(
                "Watering_Program_State").toString():
            self.log.info("Cancel Watering Progress Zombie Timer")
            self.cleanProgressTimer()
            return

        msg, remaining = self.findStep()

        if remaining <= 0:
            self.cleanProgressTimer()
            return

        remainingInMinutes = int(math.floor(round(remaining / 1000.0) / 60.0))

        if remainingInMinutes > 0:
            msg = u"{} noch {} min".format(msg, remainingInMinutes)
        else:
            msg = u"{} gleich fertig".format(msg)

        self.currentProgressMsg = msg
        postUpdate("Watering_Program_State", self.currentProgressMsg)

        self.progressTimer = createTimer(60.0, self.callbackProgress)
        self.progressTimer.start()
Esempio n. 18
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
 def execute(self, module, input):
     # only possible if we are sleeping
     if getItemState("State_Presence").intValue() == 2:
         # sometimes the "Lights_FF" state switches back and forth for a couple of milliseconds when set "Lights_FF" state to OFF
         if itemLastUpdateOlderThen("State_Presence",
                                    getNow().minusSeconds(5)):
             postUpdate("State_Presence", 1)
             sendNotification(u"System", u"Guten Morgen")
Esempio n. 20
0
    def execute(self, module, input):
        state = getItemState("PlantSensorInfo").toString()

        if state != "Feucht genug" and state != "Nicht aktiv":
            msg = state
        else:
            msg = u"Alles normal"

        postUpdateIfChanged("SensorInfo", msg)
Esempio n. 21
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)
 def execute(self, module, input):
     start = getHistoricItemState(
         "Heating_Solar_Hours",
         getNow().withTimeAtStartOfDay()).intValue()
     aktuell = getItemState("Heating_Solar_Hours").intValue()
     if start > 0 and aktuell > 0:
         differenz = aktuell - start
         msg = u"{} h, {} h".format(differenz, aktuell)
         postUpdateIfChanged("Heating_Solar_Hours_Message", msg)
    def findStep(self):
        duration = getItemState(
            "Watering_Program_Duration").intValue() * 60.0 * 1000.0

        remaining = 0
        activeStep = None

        if getItemState("Watering_Circuits") == OFF:
            for loop in circuits:
                #self.log.info("start " + loop[0][0])
                sendCommand(loop[0][0], ON)
            activeStep = circuits[0][0]
            remaining = (duration * activeStep[2])
        else:
            activeIndex = -1
            for i in range(len(circuits[0])):
                step = circuits[0][i]
                if getItemState(step[0]) == ON:
                    activeIndex = i
                    activeStep = step
                    break

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

                remaining = (duration * activeStep[2]) - runtime

                if remaining <= 0:
                    activeIndex += 1
                    if activeIndex < len(circuits[0]):
                        #self.log.info("next " + circuits[0][activeIndex][0])
                        sendCommand(circuits[0][activeIndex][0], ON)
                        sendCommand(activeStep[0], OFF)
                        activeStep = circuits[0][activeIndex]
                        remaining = (duration * activeStep[2])
                    else:
                        activeStep = None
                        #self.log.info("finish")
                        self.disableAllCircuits()
                        postUpdate("Watering_Program_Start", OFF)

        return [activeStep[1] if activeStep != None else u"", remaining]
 def execute(self, module, input):
     start = getHistoricItemState(
         "Heating_Burner_Starts",
         getNow().withTimeAtStartOfDay()).intValue()
     aktuell = getItemState("Heating_Burner_Starts").intValue()
     if start > 0 and aktuell > 0:
         differenz = aktuell - start
         postUpdate("Heating_Burner_Starts_Current_Daily", differenz)
         msg = u"{}, {}".format(differenz, aktuell)
         postUpdateIfChanged("Heating_Burner_Starts_Message", msg)
Esempio n. 25
0
    def execute(self, module, input):
        group = "Fehler"
        active = []

        if getItemState("roomba_status").toString() == "Stuck" or getItemState(
                "roomba_full") == ON:
            active.append("Roomba")

        if getItemState("MowerStatus").intValue() == 7 or getItemState(
                "MowerStatus").intValue() == 8:
            active.append("Mower")

        if len(active) == 0:
            active.append("Alles normal")
            group = "Info"

        msg = ", ".join(active)

        if postUpdateIfChanged("RoboterStatus", msg):
            sendNotification("Roboter " + group, msg)
Esempio n. 26
0
    def execute(self, module, input):
        msg = u"Nicht aktiv"

        if getItemState("Auto_Attic_Light").intValue() != 1:
            soilMoistSensor1 = getItemState("SoilMoistSensor1").intValue() if getItemState("SoilMoistSensor1Enabled") == ON else 1000
            soilMoistSensor2 = getItemState("SoilMoistSensor2").intValue() if getItemState("SoilMoistSensor2Enabled") == ON else 1000
            soilMoistSensor3 = getItemState("SoilMoistSensor3").intValue() if getItemState("SoilMoistSensor3Enabled") == ON else 1000
            soilMoistSensor4 = getItemState("SoilMoistSensor4").intValue() if getItemState("SoilMoistSensor4Enabled") == ON else 1000

            if soilMoistSensor1 < 380 or soilMoistSensor2 < 380 or soilMoistSensor3 < 380 or soilMoistSensor4 < 380:
                msg = u"Jetzt Giessen"
            elif soilMoistSensor1 < 400 or soilMoistSensor2 < 400 or soilMoistSensor3 < 400 or soilMoistSensor4 < 400:
                msg = u"Giessen"
            else:
                msg = u"Feucht genug"

        postUpdateIfChanged("PlantSensorInfo", msg)
    def execute(self, module, input):
        group = u"Fehler"
        active = []

        if getItemState("Ventilation_Filter_Error_I").intValue() > 0 \
                or getItemState("Ventilation_Filter_Error_E").intValue() > 0 \
                or getItemState("Ventilation_Error_Message").toString() != "Ok":
            active.append(u"Lüftung")

        if getItemState("Heating_Common_Fault").intValue() > 0:
            active.append(u"Heizung")

        if getItemState("State_Server").intValue() > 1:
            active.append(u"Server")

        refDate = getNow().minusMinutes(1440)  # last 24 hours

        if itemLastUpdateOlderThen("Temperature_FF_Livingroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_Boxroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_Guestroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_GuestWC", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_Floor", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_Utilityroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_FF_Garage", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Bedroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Dressingroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Child1", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Child2", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Bathroom", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Floor", refDate) \
                or itemLastUpdateOlderThen("Temperature_SF_Attic", refDate):
            active.append("Sensors")

        if len(active) == 0:
            active.append(u"Alles normal")
            group = u"Info"

        msg = u", ".join(active)

        if postUpdateIfChanged("MainStatus", msg):
            sendNotification(group, msg)
Esempio n. 28
0
    def execute(self, module, input):
        active = []

        Ventilation_Filter_Error_I_State = getItemState("Ventilation_Filter_Error_I").intValue()
        Ventilation_Filter_Error_E_State = getItemState("Ventilation_Filter_Error_E").intValue()
        if Ventilation_Filter_Error_I_State == 1 or Ventilation_Filter_Error_E_State == 1:
            value = u"Filter: "
            if Ventilation_Filter_Error_I_State == 1: value = u"{}I".format(value)
            if Ventilation_Filter_Error_I_State == 1 and Ventilation_Filter_Error_E_State == 1: value = u"{} & ".format(value)
            if Ventilation_Filter_Error_E_State == 1: value = u"{}E".format(value)
            active.append(value)

        if getItemState("Ventilation_Error_Message").toString() != "Ok":
            active.append(u"Error: {}".format( getItemState("Ventilation_Error_Message").toString() ))

        if len(active) == 0:
            active.append(u"Alles in Ordnung")

        msg = ", ".join(active)

        postUpdateIfChanged("Ventilation_State_Message", msg)
    def execute(self, module, input):
        itemName = input['event'].getItemName()
        itemState = input['event'].getItemState()

        sendNotification(u"{}".format(itemName), u"{}".format(itemState))

        holgerPhone = itemState if itemName == "State_Holger_Presence" else getItemState(
            "State_Holger_Presence")
        sandraPhone = itemState if itemName == "State_Sandra_Presence" else getItemState(
            "State_Sandra_Presence")

        if holgerPhone == ON or sandraPhone == ON:
            # only possible if we are away
            if getItemState("State_Presence").intValue() == 0:
                postUpdate("State_Presence", 1)
                sendNotification(u"Tür", u"Willkommen")
        else:
            # only possible if we are present and not sleeping
            if getItemState("State_Presence").intValue() == 1:
                postUpdate("State_Presence", 0)
                lightMsg = u" - LICHT an" if getItemState(
                    "Lights_Indoor") != OFF else u""
                windowMsg = u" - FENSTER offen" if getItemState(
                    "Openingcontacts") != CLOSED else u""

                sendNotification(
                    u"Tür", u"Auf Wiedersehen{}{}".format(lightMsg, windowMsg))
Esempio n. 30
0
    def execute(self, module, input):
        msg = ""
        cleaning_state = OFF

        if getItemState("roomba_online") == OFF:
            msg = "Offline"
        else:
            status = getItemState("roomba_status").toString()

            if status == "Running":
                msg = "Reinigt"
                cleaning_state = ON
            elif status == "Charging":
                msg = "In Ladestation"
            elif status == "Stuck":
                msg = u"Hängt fest"
            else:
                msg = status

        postUpdateIfChanged("roomba_StatusFormatted", msg)

        postUpdateIfChanged("roomba_cleaning_state", cleaning_state)