* [Tankerkoenig] Update StationHandler Incooperated check for 'null' iot to prevent NullPointerExceptions. * [Tankerkoenig] Updated WebserviceHandler Fixed false parsing of OpeningTimes. * Applied a spotless check Signed-off-by: Jürgen Baginski <opus42@gmx.de> Signed-off-by: Jürgen Baginski <opus42@gmx.de>
This commit is contained in:
parent
a3d33fa60b
commit
f8fd06e4b7
@ -128,25 +128,43 @@ public class StationHandler extends BaseThingHandler {
|
|||||||
*/
|
*/
|
||||||
public void updateData(LittleStation station) {
|
public void updateData(LittleStation station) {
|
||||||
logger.debug("Update Tankerkoenig data '{}'", getThing().getUID());
|
logger.debug("Update Tankerkoenig data '{}'", getThing().getUID());
|
||||||
if (IS_NUMERIC_PATTERN.matcher(station.getDiesel()).matches()) {
|
if (station.isOpen() == true) {
|
||||||
DecimalType diesel = new DecimalType(station.getDiesel());
|
logger.debug("Checked Station is open! '{}'", getThing().getUID());
|
||||||
updateState(CHANNEL_DIESEL, diesel);
|
updateState(CHANNEL_STATION_OPEN, OpenClosedType.OPEN);
|
||||||
|
if (station.getDiesel() != null) {
|
||||||
|
if (IS_NUMERIC_PATTERN.matcher(station.getDiesel()).matches()) {
|
||||||
|
DecimalType diesel = new DecimalType(station.getDiesel());
|
||||||
|
updateState(CHANNEL_DIESEL, diesel);
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_DIESEL, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_DIESEL, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
|
if (station.getE10() != null) {
|
||||||
|
if (IS_NUMERIC_PATTERN.matcher(station.getE10()).matches()) {
|
||||||
|
DecimalType e10 = new DecimalType(station.getE10());
|
||||||
|
updateState(CHANNEL_E10, e10);
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_E10, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_E10, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
|
if (station.getE10() != null) {
|
||||||
|
if (IS_NUMERIC_PATTERN.matcher(station.getE5()).matches()) {
|
||||||
|
DecimalType e5 = new DecimalType(station.getE5());
|
||||||
|
updateState(CHANNEL_E5, e5);
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_E5, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_E5, UnDefType.UNDEF);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
updateState(CHANNEL_DIESEL, UnDefType.UNDEF);
|
logger.debug("Checked Station is closed!");
|
||||||
|
updateState(CHANNEL_STATION_OPEN, OpenClosedType.CLOSED);
|
||||||
}
|
}
|
||||||
if (IS_NUMERIC_PATTERN.matcher(station.getE10()).matches()) {
|
|
||||||
DecimalType e10 = new DecimalType(station.getE10());
|
|
||||||
updateState(CHANNEL_E10, e10);
|
|
||||||
} else {
|
|
||||||
updateState(CHANNEL_E10, UnDefType.UNDEF);
|
|
||||||
}
|
|
||||||
if (IS_NUMERIC_PATTERN.matcher(station.getE5()).matches()) {
|
|
||||||
DecimalType e5 = new DecimalType(station.getE5());
|
|
||||||
updateState(CHANNEL_E5, e5);
|
|
||||||
} else {
|
|
||||||
updateState(CHANNEL_E5, UnDefType.UNDEF);
|
|
||||||
}
|
|
||||||
updateState(CHANNEL_STATION_OPEN, (station.isOpen() ? OpenClosedType.OPEN : OpenClosedType.CLOSED));
|
|
||||||
updateStatus(ThingStatus.ONLINE);
|
updateStatus(ThingStatus.ONLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -293,11 +293,11 @@ public class WebserviceHandler extends BaseBridgeHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (foundIt) {
|
}
|
||||||
start = open;
|
if (foundIt) {
|
||||||
ende = close;
|
start = open;
|
||||||
break;
|
ende = close;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
} while (i < o.length);
|
} while (i < o.length);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user