File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,6 @@ def load_full_state(timeout=3):
42
42
43
43
data = r .json ()
44
44
45
- # Create icon for light
46
- for lid , light_data in data ['lights' ].iteritems ():
47
- create_light_icon (lid , light_data )
48
-
49
45
workflow .store_data ('full_state' , data )
50
46
51
47
@@ -97,13 +93,21 @@ def get_lights(from_cache=False):
97
93
98
94
data = workflow .stored_data ('full_state' )
99
95
lights = data ['lights' ]
96
+
100
97
# Filter only lights that have a on/off state
101
98
# This prevents issues with Deconz and Homekit hue bridges which set their config on a light
102
- return {
99
+ filtered_lights = {
103
100
lid : light for lid , light in lights .iteritems ()
104
101
if 'state' in lights [lid ] and 'on' in lights [lid ]['state' ]
105
102
}
106
103
104
+ if not from_cache :
105
+ # Create icon for lights
106
+ for lid , light_data in filtered_lights .iteritems ():
107
+ create_light_icon (lid , light_data )
108
+
109
+ return filtered_lights
110
+
107
111
108
112
def get_groups ():
109
113
data = workflow .stored_data ('full_state' )
You can’t perform that action at this time.
0 commit comments