mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Avoid ClassCastExceptions (#12960)
Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
parent
4182595c19
commit
9e3ee5b294
@ -56,6 +56,7 @@ import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.ConfigStatusBridgeHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerService;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.slf4j.Logger;
|
||||
@ -314,10 +315,12 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler {
|
||||
for (Thing th : getThing().getThings()) {
|
||||
if (th.isEnabled()) {
|
||||
String deviceId = th.getUID().getId();
|
||||
OrbitBhyveSprinklerHandler handler = (OrbitBhyveSprinklerHandler) th.getHandler();
|
||||
for (OrbitBhyveDevice device : devices) {
|
||||
if (deviceId.equals(th.getUID().getId())) {
|
||||
updateDeviceStatus(device, handler);
|
||||
ThingHandler handler = th.getHandler();
|
||||
if (handler instanceof OrbitBhyveSprinklerHandler) {
|
||||
for (OrbitBhyveDevice device : devices) {
|
||||
if (deviceId.equals(th.getUID().getId())) {
|
||||
updateDeviceStatus(device, (OrbitBhyveSprinklerHandler) handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -336,9 +339,11 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler {
|
||||
private void updateDeviceStatus(String deviceId) {
|
||||
for (Thing th : getThing().getThings()) {
|
||||
if (deviceId.equals(th.getUID().getId())) {
|
||||
OrbitBhyveSprinklerHandler handler = (OrbitBhyveSprinklerHandler) th.getHandler();
|
||||
OrbitBhyveDevice device = getDevice(deviceId);
|
||||
updateDeviceStatus(device, handler);
|
||||
ThingHandler handler = th.getHandler();
|
||||
if (handler instanceof OrbitBhyveSprinklerHandler) {
|
||||
OrbitBhyveDevice device = getDevice(deviceId);
|
||||
updateDeviceStatus(device, (OrbitBhyveSprinklerHandler) handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -346,9 +351,9 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler {
|
||||
private void updateDeviceProgramStatus(OrbitBhyveProgram program) {
|
||||
for (Thing th : getThing().getThings()) {
|
||||
if (program.getDeviceId().equals(th.getUID().getId())) {
|
||||
OrbitBhyveSprinklerHandler handler = (OrbitBhyveSprinklerHandler) th.getHandler();
|
||||
if (handler != null) {
|
||||
handler.updateProgram(program);
|
||||
ThingHandler handler = th.getHandler();
|
||||
if (handler instanceof OrbitBhyveSprinklerHandler) {
|
||||
((OrbitBhyveSprinklerHandler) handler).updateProgram(program);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user