diff --git a/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt b/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt index e97d33693d..ecdadff663 100644 --- a/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt +++ b/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt @@ -97,7 +97,13 @@ class ItemsControlsProviderService : ControlsProviderService() { } val topic = event.getString("topic") val topicPath = topic.split('/') - if (topicPath.size != 4) { + /* Possible formats: + * - openhab/items//statechanged + * - openhab/items///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)) { throw JSONException("Unexpected topic path $topic") } val item = allItems[topicPath[2]]