diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderBindingConstants.java b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaBindingConstants.java similarity index 89% rename from bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderBindingConstants.java rename to bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaBindingConstants.java index af93142945391..f5eb64a5c5d31 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderBindingConstants.java +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaBindingConstants.java @@ -17,13 +17,13 @@ import org.openhab.core.thing.ThingTypeUID; /** - * The {@link GrundfosAlphaReaderBindingConstants} class defines common constants, which are + * The {@link GrundfosAlphaBindingConstants} class defines common constants, which are * used across the whole binding. * * @author Markus Heberling - Initial contribution */ @NonNullByDefault -public class GrundfosAlphaReaderBindingConstants { +public class GrundfosAlphaBindingConstants { // List of all Thing Type UIDs public static final ThingTypeUID THING_TYPE_MI401 = new ThingTypeUID(BluetoothBindingConstants.BINDING_ID, "mi401"); diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderDiscoveryParticipant.java b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaDiscoveryParticipant.java similarity index 90% rename from bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderDiscoveryParticipant.java rename to bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaDiscoveryParticipant.java index e0a871bfd515a..f8d83893d6069 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaDiscoveryParticipant.java @@ -39,12 +39,12 @@ */ @NonNullByDefault @Component -public class GrundfosAlphaReaderDiscoveryParticipant implements BluetoothDiscoveryParticipant { - private final Logger logger = LoggerFactory.getLogger(GrundfosAlphaReaderDiscoveryParticipant.class); +public class GrundfosAlphaDiscoveryParticipant implements BluetoothDiscoveryParticipant { + private final Logger logger = LoggerFactory.getLogger(GrundfosAlphaDiscoveryParticipant.class); @Override public Set getSupportedThingTypeUIDs() { - return Collections.singleton(GrundfosAlphaReaderBindingConstants.THING_TYPE_MI401); + return Collections.singleton(GrundfosAlphaBindingConstants.THING_TYPE_MI401); } @Override @@ -60,7 +60,7 @@ public boolean requiresConnection(BluetoothDiscoveryDevice device) { logger.debug("Discovered device {} with manufacturerId {} and name {}", device.getAddress(), manufacturerId, name); if ("MI401".equals(name)) { - return new ThingUID(GrundfosAlphaReaderBindingConstants.THING_TYPE_MI401, device.getAdapter().getUID(), + return new ThingUID(GrundfosAlphaBindingConstants.THING_TYPE_MI401, device.getAdapter().getUID(), device.getAddress().toString().toLowerCase().replace(":", "")); } return null; diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandler.java b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandler.java similarity index 89% rename from bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandler.java rename to bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandler.java index 115cdee0c1ba1..ac77c4dcf851f 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandler.java +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandler.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.bluetooth.grundfosalpha.internal; -import static org.openhab.binding.bluetooth.grundfosalpha.internal.GrundfosAlphaReaderBindingConstants.*; +import static org.openhab.binding.bluetooth.grundfosalpha.internal.GrundfosAlphaBindingConstants.*; import javax.measure.quantity.Dimensionless; import javax.measure.quantity.Length; @@ -31,17 +31,17 @@ import org.slf4j.LoggerFactory; /** - * The {@link GrundfosAlphaReaderHandler} is responsible for handling commands, which are + * The {@link GrundfosAlphaHandler} is responsible for handling commands, which are * sent to one of the channels. * * @author Markus Heberling - Initial contribution */ @NonNullByDefault -public class GrundfosAlphaReaderHandler extends BeaconBluetoothHandler implements BluetoothDeviceListener { +public class GrundfosAlphaHandler extends BeaconBluetoothHandler implements BluetoothDeviceListener { - private final Logger logger = LoggerFactory.getLogger(GrundfosAlphaReaderHandler.class); + private final Logger logger = LoggerFactory.getLogger(GrundfosAlphaHandler.class); - public GrundfosAlphaReaderHandler(Thing thing) { + public GrundfosAlphaHandler(Thing thing) { super(thing); } diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerFactory.java b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerFactory.java similarity index 85% rename from bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerFactory.java rename to bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerFactory.java index f9f1dc64555f7..ac0983bb9c3ed 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerFactory.java +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerFactory.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.bluetooth.grundfosalpha.internal; -import static org.openhab.binding.bluetooth.grundfosalpha.internal.GrundfosAlphaReaderBindingConstants.*; +import static org.openhab.binding.bluetooth.grundfosalpha.internal.GrundfosAlphaBindingConstants.*; import java.util.Set; @@ -26,14 +26,14 @@ import org.osgi.service.component.annotations.Component; /** - * The {@link GrundfosAlphaReaderHandlerFactory} is responsible for creating things and thing + * The {@link GrundfosAlphaHandlerFactory} is responsible for creating things and thing * handlers. * * @author Markus Heberling - Initial contribution */ @NonNullByDefault @Component(configurationPid = "binding.bluetooth.grundfosalpha", service = ThingHandlerFactory.class) -public class GrundfosAlphaReaderHandlerFactory extends BaseThingHandlerFactory { +public class GrundfosAlphaHandlerFactory extends BaseThingHandlerFactory { private static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_MI401); @@ -47,7 +47,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (THING_TYPE_MI401.equals(thingTypeUID)) { - return new GrundfosAlphaReaderHandler(thing); + return new GrundfosAlphaHandler(thing); } return null; diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/resources/OH-INF/i18n/grundfosalpha.properties b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/resources/OH-INF/i18n/grundfosalpha.properties index ae10e387d17cb..a2ff149f4f801 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/resources/OH-INF/i18n/grundfosalpha.properties +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/main/resources/OH-INF/i18n/grundfosalpha.properties @@ -1,7 +1,7 @@ # add-on addon.grundfosalpha.name = GrundfosAlpha Binding -addon.grundfosalpha.description = This is the binding for GrundfosAlpha. +addon.grundfosalpha.description = This is the binding for Grundfos Alpha circulator pumps. # thing types @@ -18,6 +18,6 @@ thing-type.config.bluetooth.mi401.address.description = Bluetooth address in XX: channel-type.grundfosalpha.grundfos-flow.label = Current Flow channel-type.grundfosalpha.grundfos-flow.description = Current flow channel-type.grundfosalpha.grundfos-head.label = Current Head -channel-type.grundfosalpha.grundfos-head.description = Current Head +channel-type.grundfosalpha.grundfos-head.description = Current head channel-type.grundfosalpha.grundfos-temperature.label = Current Pump Temperature channel-type.grundfosalpha.grundfos-temperature.description = Current pump temperature diff --git a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerTest.java b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerTest.java similarity index 84% rename from bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerTest.java rename to bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerTest.java index 1d1a0e1f3b7f0..840450a86d83e 100644 --- a/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaReaderHandlerTest.java +++ b/bundles/org.openhab.binding.bluetooth.grundfosalpha/src/test/java/org/openhab/binding/bluetooth/grundfosalpha/internal/GrundfosAlphaHandlerTest.java @@ -34,12 +34,12 @@ import org.openhab.core.util.HexUtils; /** - * Test the {@link GrundfosAlphaReaderHandler}. + * Test the {@link GrundfosAlphaHandler}. * * @author Markus Heberling - Initial contribution */ @ExtendWith(MockitoExtension.class) -class GrundfosAlphaReaderHandlerTest { +class GrundfosAlphaHandlerTest { private @Mock Thing thingMock; @@ -50,7 +50,7 @@ public void testMessageType0xf1() { byte[] data = HexUtils.hexToBytes("15f130017a5113030300994109589916613003004005"); final BluetoothScanNotification scanNotification = new BluetoothScanNotification(); scanNotification.setManufacturerData(data); - final GrundfosAlphaReaderHandler handler = new GrundfosAlphaReaderHandler(thingMock); + final GrundfosAlphaHandler handler = new GrundfosAlphaHandler(thingMock); handler.setCallback(callback); handler.onScanRecordReceived(scanNotification); @@ -62,29 +62,28 @@ public void testMessageType0xf1() { @Test public void testMessageType0xf2() { - when(thingMock.getUID()) - .thenReturn(new ThingUID(GrundfosAlphaReaderBindingConstants.THING_TYPE_MI401, "dummy")); + when(thingMock.getUID()).thenReturn(new ThingUID(GrundfosAlphaBindingConstants.THING_TYPE_MI401, "dummy")); byte[] data = HexUtils.hexToBytes("14f23001650305065419b9180f011f007c1878170d"); final BluetoothScanNotification scanNotification = new BluetoothScanNotification(); scanNotification.setManufacturerData(data); - final GrundfosAlphaReaderHandler handler = new GrundfosAlphaReaderHandler(thingMock); + final GrundfosAlphaHandler handler = new GrundfosAlphaHandler(thingMock); handler.setCallback(callback); handler.onScanRecordReceived(scanNotification); verify(callback).statusUpdated(thingMock, new ThingStatusInfo(ThingStatus.ONLINE, ThingStatusDetail.NONE, null)); verify(callback).stateUpdated( - new ChannelUID(thingMock.getUID(), GrundfosAlphaReaderBindingConstants.CHANNEL_TYPE_BATTERY_LEVEL), + new ChannelUID(thingMock.getUID(), GrundfosAlphaBindingConstants.CHANNEL_TYPE_BATTERY_LEVEL), new QuantityType<>(75, Units.PERCENT)); verify(callback).stateUpdated( - new ChannelUID(thingMock.getUID(), GrundfosAlphaReaderBindingConstants.CHANNEL_TYPE_FLOW_RATE), + new ChannelUID(thingMock.getUID(), GrundfosAlphaBindingConstants.CHANNEL_TYPE_FLOW_RATE), new QuantityType<>(0.98939496, Units.CUBICMETRE_PER_HOUR)); verify(callback).stateUpdated( - new ChannelUID(thingMock.getUID(), GrundfosAlphaReaderBindingConstants.CHANNEL_TYPE_PUMP_HEAD), + new ChannelUID(thingMock.getUID(), GrundfosAlphaBindingConstants.CHANNEL_TYPE_PUMP_HEAD), new QuantityType<>(1.9315165, SIUnits.METRE)); verify(callback).stateUpdated( - new ChannelUID(thingMock.getUID(), GrundfosAlphaReaderBindingConstants.CHANNEL_TYPE_PUMP_TEMPERATUR), + new ChannelUID(thingMock.getUID(), GrundfosAlphaBindingConstants.CHANNEL_TYPE_PUMP_TEMPERATUR), new QuantityType<>(31, SIUnits.CELSIUS)); verifyNoMoreInteractions(callback);