mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-26 15:21:41 +01:00
Fix handling of multiple sprinklers (#16630)
Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
parent
5cf2a99fe3
commit
815ada9afc
@ -321,11 +321,11 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler {
|
|||||||
List<OrbitBhyveDevice> devices = getDevices();
|
List<OrbitBhyveDevice> devices = getDevices();
|
||||||
for (Thing th : getThing().getThings()) {
|
for (Thing th : getThing().getThings()) {
|
||||||
if (th.isEnabled()) {
|
if (th.isEnabled()) {
|
||||||
String deviceId = th.getUID().getId();
|
|
||||||
ThingHandler handler = th.getHandler();
|
ThingHandler handler = th.getHandler();
|
||||||
if (handler instanceof OrbitBhyveSprinklerHandler sprinklerHandler) {
|
if (handler instanceof OrbitBhyveSprinklerHandler sprinklerHandler) {
|
||||||
|
String deviceId = sprinklerHandler.getSprinklerId();
|
||||||
for (OrbitBhyveDevice device : devices) {
|
for (OrbitBhyveDevice device : devices) {
|
||||||
if (deviceId.equals(th.getUID().getId())) {
|
if (deviceId.equals(device.getId())) {
|
||||||
updateDeviceStatus(device, sprinklerHandler);
|
updateDeviceStatus(device, sprinklerHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,9 +345,9 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler {
|
|||||||
|
|
||||||
private void updateDeviceStatus(String deviceId) {
|
private void updateDeviceStatus(String deviceId) {
|
||||||
for (Thing th : getThing().getThings()) {
|
for (Thing th : getThing().getThings()) {
|
||||||
if (deviceId.equals(th.getUID().getId())) {
|
ThingHandler handler = th.getHandler();
|
||||||
ThingHandler handler = th.getHandler();
|
if (handler instanceof OrbitBhyveSprinklerHandler sprinklerHandler) {
|
||||||
if (handler instanceof OrbitBhyveSprinklerHandler sprinklerHandler) {
|
if (deviceId.equals(sprinklerHandler.getSprinklerId())) {
|
||||||
OrbitBhyveDevice device = getDevice(deviceId);
|
OrbitBhyveDevice device = getDevice(deviceId);
|
||||||
updateDeviceStatus(device, sprinklerHandler);
|
updateDeviceStatus(device, sprinklerHandler);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class OrbitBhyveSprinklerHandler extends BaseThingHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSprinklerId() {
|
public String getSprinklerId() {
|
||||||
return getThing().getConfiguration().get("id") != null ? getThing().getConfiguration().get("id").toString()
|
return getThing().getConfiguration().get("id") != null ? getThing().getConfiguration().get("id").toString()
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user