[powermax] Ignore disabled things (#12684)

* [powermax] Ignore disabled things

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-05-05 19:59:59 +02:00 committed by GitHub
parent 4180eac57c
commit bfca6d2201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,7 @@ import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.thing.binding.BaseBridgeHandler; import org.openhab.core.thing.binding.BaseBridgeHandler;
import org.openhab.core.thing.binding.ThingHandler;
import org.openhab.core.thing.binding.ThingHandlerService; import org.openhab.core.thing.binding.ThingHandlerService;
import org.openhab.core.types.Command; import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType; import org.openhab.core.types.RefreshType;
@ -623,25 +624,27 @@ public class PowermaxBridgeHandler extends BaseBridgeHandler implements Powermax
} }
for (Thing thing : getThing().getThings()) { for (Thing thing : getThing().getThings()) {
if (thing.getHandler() != null) { if (!thing.isEnabled()) {
PowermaxThingHandler handler = (PowermaxThingHandler) thing.getHandler(); continue;
if (handler != null) { }
if (thing.getThingTypeUID().equals(THING_TYPE_ZONE)) { ThingHandler thingHandler = thing.getHandler();
// All of the zone state objects will have the same list of values. if (thingHandler instanceof PowermaxThingHandler) {
// The use of getZone(1) here is just to get any PowermaxZoneState PowermaxThingHandler handler = (PowermaxThingHandler) thingHandler;
// and use it to get the list of zone channels. if (thing.getThingTypeUID().equals(THING_TYPE_ZONE)) {
// All of the zone state objects will have the same list of values.
// The use of getZone(1) here is just to get any PowermaxZoneState
// and use it to get the list of zone channels.
for (Value<?> value : state.getZone(1).getValues()) { for (Value<?> value : state.getZone(1).getValues()) {
String channelId = value.getChannel(); String channelId = value.getChannel();
if ((channel == null) || channel.equals(channelId)) { if ((channel == null) || channel.equals(channelId)) {
handler.updateChannelFromAlarmState(channelId, state); handler.updateChannelFromAlarmState(channelId, state);
}
}
} else if (thing.getThingTypeUID().equals(THING_TYPE_X10)) {
if ((channel == null) || channel.equals(X10_STATUS)) {
handler.updateChannelFromAlarmState(X10_STATUS, state);
} }
} }
} else if (thing.getThingTypeUID().equals(THING_TYPE_X10)) {
if ((channel == null) || channel.equals(X10_STATUS)) {
handler.updateChannelFromAlarmState(X10_STATUS, state);
}
} }
} }
} }