-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhue_config.py
More file actions
24 lines (18 loc) · 750 Bytes
/
hue_config.py
File metadata and controls
24 lines (18 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
import dbus
systembus = dbus.SystemBus()
o_manager = dbus.Interface(systembus.get_object('org.bluez', '/'), 'org.freedesktop.DBus.ObjectManager')
m_objects = o_manager.GetManagedObjects()
lamp_dict = {}
for obj_paths, obj_dict in m_objects.items():
if "org.bluez.Device1" in obj_dict.keys():
for interface, properties in obj_dict.items():
if "Hue Lamp" in properties.values():
for property, value in properties.items():
if property == "Address":
v = str(value)
x = v.replace(":", "_")
if property == "Alias":
y = str(value)
lamp_dict[x] = y
lamp_dict