@@ -198,12 +198,15 @@ public class Lights : ListBox {
198198 }
199199 }
200200
201- // append found lights in json-response to internal list of lights
202- Light found_light = new Light (
203- light_id, name, hue, sat, bri, lswitch, reachable, bridge,
204- this
205- );
206- lights. append(found_light);
201+ // append found lights in json-response to internal list of
202+ // lights
203+ if (light_id != 0 ) {
204+ Light found_light = new Light (
205+ light_id, name, hue, sat, bri, lswitch, reachable, bridge,
206+ this
207+ );
208+ lights. append(found_light);
209+ }
207210 }
208211 }
209212 catch (Error e) {
@@ -283,12 +286,20 @@ public class Lights : ListBox {
283286 foreach (string command in command_obj. get_members()) {
284287 if (command == " address" ) {
285288 address = command_obj. get_string_member(command);
289+
290+ // test
291+ // address = "";
292+
286293 debug(" [Lights.schedules_received] address = '"
287294 + address + " '" );
288295 parts_of_address = address. split(" /" );
289- if (parts_of_address[3 ] == " lights" ) {
290- light_id = int . parse(parts_of_address[4 ]);
291- }
296+
297+ int parts = parts_of_address. length;
298+ if (parts > 0 ) {
299+ if (parts_of_address[3 ] == " lights" ) {
300+ light_id = int . parse(parts_of_address[4 ]);
301+ }
302+ }
292303 debug(" [Lights.schedules_received] light_id = '"
293304 + light_id. to_string() + " '" );
294305 }
@@ -312,11 +323,13 @@ public class Lights : ListBox {
312323 }
313324 }
314325
315- // insert found schedules to temporary schedules list
316- Schedule s = new Schedule (schedule_id, name, light_id, time,
317- bri, sat, status, app, bridge
318- );
319- schedule_list. append(s);
326+ // insert found schedules of lights to temporary schedules list
327+ if (light_id != 0 ) {
328+ Schedule s = new Schedule (schedule_id, name, light_id, time,
329+ bri, sat, status, app, bridge
330+ );
331+ schedule_list. append(s);
332+ }
320333 }
321334 }
322335 catch (Error e) {
0 commit comments