Example #1
0
    def load_hardware(self):
        self._dimmer_running = False
        self._device = brightpi.BrightPi()
        self._device.reset()
        self._device.set_gain(5)
        leds = brightpi.LED_WHITE
        if self.get_address().split(',')[-1].lower() == 'ir':
            leds = brightpi.LED_IR

        self._device.set_led_on_off(leds, brightpi.ON)
Example #2
0
 def __init__(self,
              vlist=('ALL_OFF', 'IR_ON', 'VIS_ON', 'ALL_ON'),
              fallbackValue='ALL_OFF',
              enabled=True,
              **kwargs):
     try:
         import brightpi
         bpOK = True
     except ModuleNotFoundError:
         bpOK = False
         errmsg = 'brightpi module not installed'
         enabled = False
         self.bpcontrol = None
     if bpOK:
         try:
             self.bpcontrol = brightpi.BrightPi()
         except OSError:
             self.bpcontrol = None
             bpOK = False
             errmsg = 'brightpi board does not seem to be connected'
             enabled = False
     if not self.bpcontrol is None:
         self.setparams = {
             0: {
                 'leds': brightpi.LED_ALL,
                 'state': 0
             },
             1: {
                 'leds': brightpi.LED_IR,
                 'state': 1
             },
             2: {
                 'leds': brightpi.LED_WHITE,
                 'state': 1
             },
             3: {
                 'leds': brightpi.LED_ALL,
                 'state': 1
             },
         }
     super().__init__(vlist=vlist,
                      fallbackValue=fallbackValue,
                      enabled=enabled,
                      **kwargs)