Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing stateDescriptionProvider in Group items #3144

Merged
merged 3 commits into from
Nov 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.i18n.UnitProvider;
import org.openhab.core.items.events.ItemEventFactory;
import org.openhab.core.service.CommandDescriptionService;
import org.openhab.core.service.StateDescriptionService;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
import org.slf4j.Logger;
Expand Down Expand Up @@ -225,14 +227,6 @@ public void removeAllMembers() {
members.clear();
}

@Override
public void setUnitProvider(@Nullable UnitProvider unitProvider) {
super.setUnitProvider(unitProvider);
if (baseItem != null && baseItem instanceof GenericItem) {
((GenericItem) baseItem).setUnitProvider(unitProvider);
}
}

/**
* The accepted data types of a group item is the same as of the underlying base item.
* If none is defined, the intersection of all sets of accepted data types of all group
Expand Down Expand Up @@ -395,6 +389,30 @@ public void setState(State state) {
notifyListeners(oldState, state);
}

@Override
public void setStateDescriptionService(@Nullable StateDescriptionService stateDescriptionService) {
super.setStateDescriptionService(stateDescriptionService);
if (baseItem instanceof GenericItem) {
((GenericItem) baseItem).setStateDescriptionService(stateDescriptionService);
}
}

@Override
public void setCommandDescriptionService(@Nullable CommandDescriptionService commandDescriptionService) {
super.setCommandDescriptionService(commandDescriptionService);
if (baseItem instanceof GenericItem) {
((GenericItem) baseItem).setCommandDescriptionService(commandDescriptionService);
}
}

@Override
public void setUnitProvider(@Nullable UnitProvider unitProvider) {
super.setUnitProvider(unitProvider);
if (baseItem instanceof GenericItem) {
((GenericItem) baseItem).setUnitProvider(unitProvider);
}
}

private void sendGroupStateChangedEvent(String memberName, State newState, State oldState) {
if (eventPublisher != null) {
eventPublisher
Expand Down