Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Oct 22, 2023
1 parent 71ffcb9 commit 90c54a9
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ class ItemsControlsProviderService : ControlsProviderService() {
}
val topic = event.getString("topic")
val topicPath = topic.split('/')
/* Possible formats:
* - openhab/items/<item>/statechanged
* - openhab/items/<group item>/<item>/statechanged
* When an update for a group is sent, there's also one for the individual item.
* Therefore always take the element on index two.
*/
if (topicPath.size !in intArrayOf(4, 5)) {
// Possible formats:
// - openhab/items/<item>/statechanged
// - openhab/items/<group item>/<item>/statechanged
// When an update for a group is sent, there's also one for the individual item.
// Therefore always take the element on index two.
if (topicPath.size !in 4..5) {
throw JSONException("Unexpected topic path $topic")
}
val item = allItems[topicPath[2]]
Expand Down

0 comments on commit 90c54a9

Please sign in to comment.