Skip to content

Commit

Permalink
Expire group item states (openhab#2009)
Browse files Browse the repository at this point in the history
Fixes openhab#1989

Signed-off-by: Stefan Triller <github@stefantriller.de>
GitOrigin-RevId: caaf1c7
  • Loading branch information
t2000 authored and splatch committed Jul 11, 2023
1 parent f1410ac commit 7fa64ba
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.openhab.core.items.Metadata;
import org.openhab.core.items.MetadataKey;
import org.openhab.core.items.MetadataRegistry;
import org.openhab.core.items.events.GroupItemStateChangedEvent;
import org.openhab.core.items.events.ItemCommandEvent;
import org.openhab.core.items.events.ItemEventFactory;
import org.openhab.core.items.events.ItemStateEvent;
Expand Down Expand Up @@ -71,7 +72,8 @@ public class ExpireManager implements EventSubscriber, RegistryChangeListener<It
protected static final String METADATA_NAMESPACE = "expire";
protected static final String PROPERTY_ENABLED = "enabled";

private static final Set<String> SUBSCRIBED_EVENT_TYPES = Set.of(ItemStateEvent.TYPE, ItemCommandEvent.TYPE);
private static final Set<String> SUBSCRIBED_EVENT_TYPES = Set.of(ItemStateEvent.TYPE, ItemCommandEvent.TYPE,
GroupItemStateChangedEvent.TYPE);

private final Logger logger = LoggerFactory.getLogger(ExpireManager.class);

Expand Down Expand Up @@ -242,6 +244,9 @@ public void receive(Event event) {
} else if (event instanceof ItemCommandEvent) {
ItemCommandEvent icEvent = (ItemCommandEvent) event;
processEvent(icEvent.getItemName(), icEvent.getItemCommand());
} else if (event instanceof GroupItemStateChangedEvent) {
GroupItemStateChangedEvent gcEvent = (GroupItemStateChangedEvent) event;
processEvent(gcEvent.getItemName(), gcEvent.getItemState());
}
}

Expand Down

0 comments on commit 7fa64ba

Please sign in to comment.