Skip to content

Commit

Permalink
[jeelink] adapt to core StringUtils (openhab#15771)
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
  • Loading branch information
lsiepel authored and austvik committed Mar 27, 2024
1 parent dfc00ab commit 0b6205e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.binding.jeelink.internal.RollingAveragePublisher;
import org.openhab.binding.jeelink.internal.RollingReadingAverage;
import org.openhab.binding.jeelink.internal.config.LaCrosseTemperatureSensorConfig;
import org.openhab.binding.jeelink.internal.util.StringUtils;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
Expand All @@ -38,6 +38,7 @@
import org.openhab.core.thing.binding.builder.ChannelBuilder;
import org.openhab.core.thing.binding.builder.ThingBuilder;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -93,7 +94,8 @@ private void createMissingChannels(int channelNo) {
missingChannels.add(ChannelBuilder
.create(new ChannelUID(getThing().getUID(), channelName + idSuffix), "Number")
.withType(new ChannelTypeUID(getThing().getThingTypeUID().getBindingId(), channelName))
.withLabel(StringUtils.capitalize(channelName + labelSuffix)).build());
.withLabel(Objects.requireNonNull(StringUtils.capitalize(channelName + labelSuffix)))
.build());
}
}
missingChannels.addAll(getThing().getChannels());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Objects;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.binding.jeelink.internal.util.StringUtils;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.Units;
Expand All @@ -31,6 +31,7 @@
import org.openhab.core.thing.binding.builder.ChannelBuilder;
import org.openhab.core.thing.binding.builder.ThingBuilder;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -78,7 +79,8 @@ public void publish(LgwReading reading) {
.create(new ChannelUID(getThing().getUID(), HUMIDITY_CHANNEL), "Number:Humidity")
.withType(new ChannelTypeUID(getThing().getThingTypeUID().getBindingId(),
HUMIDITY_CHANNEL))
.withLabel(StringUtils.capitalize(HUMIDITY_CHANNEL)).build());
.withLabel(Objects.requireNonNull(StringUtils.capitalize(HUMIDITY_CHANNEL)))
.build());
updateThing(thingBuilder.build());

hasHumidityChannel = true;
Expand All @@ -94,7 +96,8 @@ public void publish(LgwReading reading) {
.create(new ChannelUID(getThing().getUID(), PRESSURE_CHANNEL), "Number:Pressure")
.withType(new ChannelTypeUID(getThing().getThingTypeUID().getBindingId(),
PRESSURE_CHANNEL))
.withLabel(StringUtils.capitalize(PRESSURE_CHANNEL)).build());
.withLabel(Objects.requireNonNull(StringUtils.capitalize(PRESSURE_CHANNEL)))
.build());
updateThing(thingBuilder.build());

hasPressureChannel = true;
Expand Down

This file was deleted.

0 comments on commit 0b6205e

Please sign in to comment.