コード例 #1
0
ファイル: smart_device.py プロジェクト: swiknaba/liquidctl
 def parse_led_info(msg):
     channel_count = msg[14]
     offset = 15  # offset of first channel/first accessory
     for c in range(channel_count):
         for a in range(HUE2_MAX_ACCESSORIES_IN_CHANNEL):
             accessory_id = msg[offset + c * HUE2_MAX_ACCESSORIES_IN_CHANNEL + a]
             if accessory_id == 0:
                 break
             status.append((f'LED {c + 1} accessory {a + 1}',
                            Hue2Accessory(accessory_id), ''))
コード例 #2
0
ファイル: kraken3.py プロジェクト: liquidctl/liquidctl
 def find(channel, accessory):
     offset = 15  # offset of first channel/first accessory
     acc_id = msg[offset + channel * HUE2_MAX_ACCESSORIES_IN_CHANNEL + accessory]
     return Hue2Accessory(acc_id) if acc_id else None