Exemple #1
0
 def switch(self, to):
     if to != self.status:
         get_device(self.comm).switch(self, to)
         if to:
             self.log("switched on")
         else:
             self.log("switched off")
     self.status = to
Exemple #2
0
 def switch(self, to):
     if to != self.status:
         get_device(self.comm).switch(self, to)
         if to:
             self.log("switched on")
         else:
             self.log("switched off")
     self.status = to
Exemple #3
0
    def execute(self, action, target=None):

        if action == "switch":
            device = get_device(target)
            device.switch(not device.get_status())
            get_logger().event("core", "manually switched '%s' to '%s'" % (device.name, ("on" if device.get_status() else "off")))

        if action == "dim":
            device = get_device(target)
            device.dim()

        if action == "undim":
            device = get_device(target)
            device.undim()

        if action == "toggle_ai":
            self.context.update("ai", not self.context.get("ai"))
Exemple #4
0
    def execute(self, action, target=None):

        if action == "switch":
            device = get_device(target)
            device.switch(not device.get_status())
            get_logger().event(
                "core", "manually switched '%s' to '%s'" %
                (device.name, ("on" if device.get_status() else "off")))

        if action == "dim":
            device = get_device(target)
            device.dim()

        if action == "undim":
            device = get_device(target)
            device.undim()

        if action == "toggle_ai":
            self.context.update("ai", not self.context.get("ai"))
Exemple #5
0
 def undim(self):
     get_device(self.comm).undim(self)
Exemple #6
0
 def dim(self):
     get_device(self.comm).dim(self)
Exemple #7
0
    def check(self):
        sensor = get_device(self.device)
        if not sensor.motion:
           return False

        return time.time() < (sensor.motion + self.timeout)
Exemple #8
0
 def check(self):
     return get_device(self.device).get_status() == self.status
Exemple #9
0
 def log(self, msg):
     super(Alarm, self).log(msg)
     if self.notify:
         get_device(self.notify).notify(msg)
Exemple #10
0
    def check(self):
        sensor = get_device(self.device)
        if not sensor.motion:
            return False

        return time.time() < (sensor.motion + self.timeout)
Exemple #11
0
 def check(self):
     return get_device(self.device).get_status() == self.status
Exemple #12
0
 def undim(self):
     get_device(self.comm).undim(self)
Exemple #13
0
 def dim(self):
     get_device(self.comm).dim(self)
Exemple #14
0
    def execute(self):
        logging.debug("executing action switch '%s' on device '%s' to '%s'" % (self.__class__.__name__,
                                                                               self.device,
                                                                               self.switch))

        get_device(self.device).switch(self.switch)