File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
drivers/SmartThings/sonos/src Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ local _update_subscriptions_helper = function(
7878 local unique_key , bad_key_part = utils .sonos_unique_key (householdId , playerId )
7979 if not unique_key then
8080 local err_msg = string.format (" Invalid Sonos Unique Key Part: %s" , bad_key_part )
81- reply_tx :send (table.pack (nil , err_msg ))
81+ if reply_tx then
82+ reply_tx :send (table.pack (nil , err_msg ))
83+ else
84+ log .warn (string.format (" Update Subscriptions Error: %s" , err_msg ))
85+ end
8286 return
8387 end
8488 Router .send_message_to_player (unique_key , payload , reply_tx )
Original file line number Diff line number Diff line change 183183function SonosState :update_device_record_group_info (household , group , device )
184184 local player_id = device :get_field (PlayerFields .PLAYER_ID )
185185 local group_role
186- if player_id == group .coordinatorId then
187- if # household .groups [group .id ].playerIds > 1 then
186+ if (player_id and group and group .id and group .coordinatorId ) and player_id == group .coordinatorId then
187+ local player_ids_list = household .groups [group .id ].playerIds or {}
188+ if # player_ids_list > 1 then
188189 group_role = " primary"
189190 else
190191 group_role = " ungrouped"
248249--- @param household_id HouseholdId
249250--- @param device SonosDevice
250251function SonosState :update_device_record_from_state (household_id , device )
251- local current_mapping = _STATE .device_record_map [device .id ]
252+ local current_mapping = _STATE .device_record_map [device .id ] or {}
252253 local household = _STATE .households :get_or_init (household_id )
253254 self :update_device_record_group_info (household , current_mapping .group , device )
254255end
You can’t perform that action at this time.
0 commit comments