You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example provided by @Lakitna on how to access the bulbs through their names rather than device ID#.
# Like we know en love from the examples
lampList = [dev for dev in devices if dev.has_light_control]
# Define the different group names
groupNameList = ['Alpha', 'Beta']
# Make an empty dict to store our groups
groups = {}
# Iterate all group names
for groupName in groupNameList:
groups[groupName] = []
# Iterate all lamps on the network
for lamp in lampList:
# Check if the group name is a partial of the lamp name. By forcing both to be lowercase the check is case insensitive.
if groupName.lower() in lamp.name.lower():
groups[groupName].append(lamp)
# Output the group hierarchy
print(groups)