group & light detection
This commit is contained in:
parent
51fb4d41db
commit
381882eda9
54
lights_module.py
Normal file
54
lights_module.py
Normal file
@ -0,0 +1,54 @@
|
||||
import phue
|
||||
from phue import Bridge
|
||||
|
||||
import credentials
|
||||
import config
|
||||
|
||||
class Lights_Modules():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def main(self):
|
||||
print("Starting up Lights_Modules....")
|
||||
b = Bridge('192.168.191.146')
|
||||
b.connect
|
||||
|
||||
b.get_api()
|
||||
|
||||
light_list = b.lights
|
||||
group_list:list = []
|
||||
groups = b.get_group()
|
||||
groupCount = 0
|
||||
|
||||
print("\n -Listing Lights...")
|
||||
for l in light_list:
|
||||
print(l.name)
|
||||
print("\n -Counting Groups...")
|
||||
for g in groups:
|
||||
print(g)
|
||||
groupCount = int(g)
|
||||
|
||||
|
||||
for gc in range(groupCount):
|
||||
try:
|
||||
#print(gc)
|
||||
group = b.get_group(gc ,'name')
|
||||
print(group)
|
||||
#group_list.append(group)
|
||||
print(" --done adding")
|
||||
except:
|
||||
print(" --adding failed")
|
||||
|
||||
|
||||
print("\n finished doing the thing")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
testModule = Lights_Modules()
|
||||
|
||||
credentials_manager = credentials.Credentials_Module()
|
||||
credentials_manager.load_credentials()
|
||||
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||
#testModule.discordCredential = credentials_manager.find_Discord_Credential(config.credentialsNickname)
|
||||
|
||||
testModule.main()
|
||||
Loading…
Reference in New Issue
Block a user