mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
* [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
4d3dd96a67
commit
be0b3cf5b9
@ -128,25 +128,43 @@ public class StationHandler extends BaseThingHandler {
|
||||
*/
|
||||
public void updateData(LittleStation station) {
|
||||
logger.debug("Update Tankerkoenig data '{}'", getThing().getUID());
|
||||
if (IS_NUMERIC_PATTERN.matcher(station.getDiesel()).matches()) {
|
||||
DecimalType diesel = new DecimalType(station.getDiesel());
|
||||
updateState(CHANNEL_DIESEL, diesel);
|
||||
if (station.isOpen() == true) {
|
||||
logger.debug("Checked Station is open! '{}'", getThing().getUID());
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -293,11 +293,11 @@ public class WebserviceHandler extends BaseBridgeHandler {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (foundIt) {
|
||||
start = open;
|
||||
ende = close;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundIt) {
|
||||
start = open;
|
||||
ende = close;
|
||||
break;
|
||||
}
|
||||
i = i + 1;
|
||||
} while (i < o.length);
|
||||
|
Loading…
Reference in New Issue
Block a user