Пример #1
0
 def set_mode(self, mode):
     CommandMode.validate(mode)
     group = self.group
     if group is None:
         group = Group('fake', 'fake', [self])
     for device in group.devices:
         commands.add(device, CommandMode(mode))
Пример #2
0
 def set_temperature(self, temperature):
     CommandTemperature.validate(temperature)
     group = self.group
     if group is None:
         group = Group('fake', 'fake', [self])
     for device in group.devices:
         commands.add(device, CommandTemperature(temperature))
Пример #3
0
 def request_missing_settings(self):
     try:
         layout = self.settings['ff']
         if layout is not None:
             for field in get_eeprom_layout(int('0x' + layout, 16)):
                 if not field['idx'] in self.settings or self.settings[field['idx']] == '':
                     commands.add(self, CommandGetSetting(field['idx']))
     except KeyError:
         commands.add(self, CommandGetSetting('ff'))
Пример #4
0
 def request_settings(self):
     try:
         layout = self.settings['ff']
         if layout is not None:
             self.reset_settings()
             for field in get_eeprom_layout(int('0x' + layout, 16)):
                 commands.add(self, CommandGetSetting(field['idx']))
     except KeyError:
         ''' no setting ff in device.settings '''
         pass
Пример #5
0
 def request_missing_timers(self):
     for d, day in enumerate(self.timers):
         for s, slot in enumerate(day):
             if slot == '':
                 commands.add(self, CommandGetTimer(d, s))
Пример #6
0
 def send_timer(self, day, value):
     if CommandSetTimer.valid(day, value):
         commands.add(self, CommandSetTimer(day, value))
Пример #7
0
 def request_timers(self):
     commands.add(self, CommandGetSetting('22'))
     for day in range(8):
         for slot in range(8):
             commands.add(self, CommandGetTimer(day, slot))
Пример #8
0
 def send_setting(self, idx, value):
     settings = self.settings
     if CommandSetSetting.valid(settings['ff'], idx, value):
         commands.add(self, CommandSetSetting(idx, value))
Пример #9
0
 def reboot_device(self):
     commands.add(self, CommandReboot())
Пример #10
0
 def update_stats(self):
     if self.available == self.AVAILABLE_OFFLINE:
         self.available = self.AVAILABLE_ONLINE
         self.time = int(time.time())
     commands.add(self, CommandStatus())