def __out_start_bagno(self, pin): if(self.__increase_bagno): print("si incremento bagno") self.__counter_bagno=self.__counter_bagno+1 self.sensori["counter_bagno"]=self.__counter_bagno if self.__counter_bagno==1: gpio.output(self.__led["bagno"], 1) self.__increase_bagno=False else: print("decremento bagno?") self.__decrease_bagno=True
def __luci_set(self, pin): for x in self.keys: if self.__button[x]==pin: key=x break pin=self.__led[key] status=gpio.input(pin) if key=="salotto": stat=gpio.input(2) gpio.output(2, not stat) gpio.output(pin, not status)
def __out_start_salotto(self, pin): if(self.__increase_salotto): print("si incremento salotto") self.__counter_salotto=self.__counter_salotto+1 self.sensori["counter_salotto"]=self.__counter_salotto if self.__counter_salotto==1: gpio.output(self.__led["salotto"], 0) gpio.output(2,1) self.__increase_salotto=False else: print("decremento salotto?") self.__decrease_salotto=True
def __in_start_bagno(self, pin): if(self.__decrease_bagno): if self.__counter_bagno>0: print("si decremento bagno") self.__counter_bagno=self.__counter_bagno-1 self.sensori["counter_bagno"]=self.__counter_bagno if self.__counter_bagno==0: gpio.output(self.__led["bagno"], 0) else: print("sono gia' a zero, ho contato male") self.__decrease_bagno=False else: print("incremento bagno?") self.__increase_bagno=True
def __in_start_salotto(self, pin): if(self.__decrease_salotto): if self.__counter_salotto>0: print("si decremento salotto") self.__counter_salotto=self.__counter_salotto-1 self.sensori["counter_salotto"]=self.__counter_salotto if self.__counter_salotto==0: gpio.output(self.__led["salotto"], 1) gpio.output(2,0) else: print("sono gia' a zero, ho contato male") self.__decrease_salotto=False else: print("incremento salotto?") self.__increase_salotto=True
def spegni_luce(self, parent, stanza): pin=self.__led[stanza] if stanza=="salotto": s=gpio.input(2) gpio.output(2, 0) gpio.output(pin, 1) else: gpio.output(pin, 0)