diff --git a/bundles/org.openhab.binding.avmfritz/README.md b/bundles/org.openhab.binding.avmfritz/README.md index e16cb272e..13191f37a 100644 --- a/bundles/org.openhab.binding.avmfritz/README.md +++ b/bundles/org.openhab.binding.avmfritz/README.md @@ -141,7 +141,7 @@ If correct credentials are set in the bridge configuration, connected AHA device - `port` (optional, 1 to 65535), no default (derived from protocol: 80 or 443) - `password` (optional for call monitoring, but mandatory for AHA features), no default (depends on FRITZ!Box security configuration) - `user` (optional), no default (depends on FRITZ!Box security configuration) -- `pollingInterval` (optional, 5 to 60), default 15 (in seconds) +- `pollingInterval` (optional, 1 to 60), default 15 (in seconds) - `asyncTimeout` (optional, 1000 to 60000), default 10000 (in milliseconds) - `syncTimeout` (optional, 500 to 15000), default 2000 (in milliseconds) @@ -152,7 +152,7 @@ If correct credentials are set in the bridge configuration, connected AHA device - `protocol` (optional, "http" or "https"), default "http" - `port` (optional, 1 to 65535), no default (derived from protocol: 80 or 443) - `password` (optional), no default (depends on FRITZ!Powerline security configuration) -- `pollingInterval` (optional, 5 to 60), default 15 (in seconds) +- `pollingInterval` (optional, 1 to 60), default 15 (in seconds) - `asyncTimeout` (optional, 1000 to 60000), default 10000 (in milliseconds) - `syncTimeout` (optional, 500 to 15000), default 2000 (in milliseconds) diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseBridgeHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseBridgeHandler.java index b1950aca1..82e27925a 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseBridgeHandler.java +++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseBridgeHandler.java @@ -79,7 +79,7 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler { /** * Refresh interval which is used to poll values from the FRITZ!Box web interface (optional, defaults to 15 s) */ - private long refreshInterval = 15; + private long pollingInterval = 15; /** * Interface object for querying the FRITZ!Box web interface @@ -131,10 +131,10 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler { "The 'ipAddress' parameter must be configured."); configValid = false; } - refreshInterval = config.pollingInterval; - if (refreshInterval < 5) { + pollingInterval = config.pollingInterval; + if (pollingInterval < 1) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "The 'pollingInterval' parameter must be greater then at least 5 seconds."); + "The 'pollingInterval' parameter must be greater than or equals to 1 second."); configValid = false; } @@ -203,8 +203,8 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler { protected void startPolling() { ScheduledFuture localPollingJob = pollingJob; if (localPollingJob == null || localPollingJob.isCancelled()) { - logger.debug("Start polling job at interval {}s", refreshInterval); - pollingJob = scheduler.scheduleWithFixedDelay(this::poll, INITIAL_DELAY, refreshInterval, TimeUnit.SECONDS); + logger.debug("Start polling job at interval {}s", pollingInterval); + pollingJob = scheduler.scheduleWithFixedDelay(this::poll, INITIAL_DELAY, pollingInterval, TimeUnit.SECONDS); } } diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java index b553a714b..c8b9c7830 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java +++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java @@ -335,8 +335,19 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen private ChannelTypeUID createChannelTypeUID(String channelId) { int pos = channelId.indexOf(ChannelUID.CHANNEL_GROUP_SEPARATOR); String id = pos > -1 ? channelId.substring(pos + 1) : channelId; - return CHANNEL_BATTERY.equals(id) ? DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID() - : new ChannelTypeUID(BINDING_ID, id); + final ChannelTypeUID channelTypeUID; + switch (id) { + case CHANNEL_BATTERY: + channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID(); + break; + case CHANNEL_VOLTAGE: + channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_ELECTRIC_VOLTAGE.getUID(); + break; + default: + channelTypeUID = new ChannelTypeUID(BINDING_ID, id); + break; + } + return channelTypeUID; } /** @@ -347,9 +358,9 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen private void createChannel(String channelId) { ThingHandlerCallback callback = getCallback(); if (callback != null) { - ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId); - ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId); - Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build(); + final ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId); + final ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId); + final Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build(); updateThing(editThing().withoutChannel(channelUID).withChannel(channel).build()); } } diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/Powerline546EHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/Powerline546EHandler.java index 5b2ca3989..01106f3c5 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/Powerline546EHandler.java +++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/Powerline546EHandler.java @@ -187,6 +187,28 @@ public class Powerline546EHandler extends AVMFritzBaseBridgeHandler implements F } } + /** + * Creates a {@link ChannelTypeUID} from the given channel id. + * + * @param channelId ID of the channel type UID to be created. + * @return the channel type UID + */ + private ChannelTypeUID createChannelTypeUID(String channelId) { + final ChannelTypeUID channelTypeUID; + switch (channelId) { + case CHANNEL_BATTERY: + channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID(); + break; + case CHANNEL_VOLTAGE: + channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_ELECTRIC_VOLTAGE.getUID(); + break; + default: + channelTypeUID = new ChannelTypeUID(BINDING_ID, channelId); + break; + } + return channelTypeUID; + } + /** * Creates new channels for the thing. * @@ -195,11 +217,9 @@ public class Powerline546EHandler extends AVMFritzBaseBridgeHandler implements F private void createChannel(String channelId) { ThingHandlerCallback callback = getCallback(); if (callback != null) { - ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId); - ChannelTypeUID channelTypeUID = CHANNEL_BATTERY.equals(channelId) - ? DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID() - : new ChannelTypeUID(BINDING_ID, channelId); - Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build(); + final ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId); + final ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId); + final Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build(); updateThing(editThing().withoutChannel(channelUID).withChannel(channel).build()); } } diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/config/config.xml index 9cad0c865..156481e2f 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/config/config.xml +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/config/config.xml @@ -45,7 +45,7 @@ Password to access the FRITZ!Box. - + Interval polling the FRITZ!Box (in seconds). 15 @@ -104,7 +104,7 @@ Password to access the FRITZ!Powerline. - + Interval polling the FRITZ!Powerline (in seconds). 15 diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties index e019b0873..aec742bf3 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties @@ -7,16 +7,32 @@ addon.avmfritz.description = This is the binding for AVM FRITZ! devices. thing-type.avmfritz.Comet_DECT.label = Comet DECT thing-type.avmfritz.Comet_DECT.description = Comet DECT heating thermostat. +thing-type.avmfritz.Comet_DECT.channel.actual_temp.label = Current Temperature +thing-type.avmfritz.Comet_DECT.channel.actual_temp.description = Current measured temperature. thing-type.avmfritz.FRITZ_DECT_200.label = FRITZ!DECT 200 thing-type.avmfritz.FRITZ_DECT_200.description = FRITZ!DECT200 switchable outlet. +thing-type.avmfritz.FRITZ_DECT_200.channel.energy.label = Energy Consumption +thing-type.avmfritz.FRITZ_DECT_200.channel.energy.description = Accumulated energy consumption. +thing-type.avmfritz.FRITZ_DECT_200.channel.power.label = Power +thing-type.avmfritz.FRITZ_DECT_200.channel.power.description = Current power consumption. thing-type.avmfritz.FRITZ_DECT_210.label = FRITZ!DECT 210 thing-type.avmfritz.FRITZ_DECT_210.description = FRITZ!DECT210 switchable outlet. +thing-type.avmfritz.FRITZ_DECT_210.channel.energy.label = Energy Consumption +thing-type.avmfritz.FRITZ_DECT_210.channel.energy.description = Accumulated energy consumption. +thing-type.avmfritz.FRITZ_DECT_210.channel.power.label = Power +thing-type.avmfritz.FRITZ_DECT_210.channel.power.description = Current power consumption. thing-type.avmfritz.FRITZ_DECT_300.label = FRITZ!DECT 300 thing-type.avmfritz.FRITZ_DECT_300.description = FRITZ!DECT 300 heating thermostat. +thing-type.avmfritz.FRITZ_DECT_300.channel.actual_temp.label = Current Temperature +thing-type.avmfritz.FRITZ_DECT_300.channel.actual_temp.description = Current measured temperature. thing-type.avmfritz.FRITZ_DECT_301.label = FRITZ!DECT 301 thing-type.avmfritz.FRITZ_DECT_301.description = FRITZ!DECT 301 heating thermostat. +thing-type.avmfritz.FRITZ_DECT_301.channel.actual_temp.label = Current Temperature +thing-type.avmfritz.FRITZ_DECT_301.channel.actual_temp.description = Current measured temperature. thing-type.avmfritz.FRITZ_DECT_302.label = FRITZ!DECT 302 thing-type.avmfritz.FRITZ_DECT_302.description = FRITZ!DECT 302 heating thermostat. +thing-type.avmfritz.FRITZ_DECT_302.channel.actual_temp.label = Current Temperature +thing-type.avmfritz.FRITZ_DECT_302.channel.actual_temp.description = Current measured temperature. thing-type.avmfritz.FRITZ_DECT_400.label = FRITZ!DECT 400 thing-type.avmfritz.FRITZ_DECT_400.description = FRITZ!DECT400 switch. thing-type.avmfritz.FRITZ_DECT_400.channel.press.label = Button Press @@ -33,12 +49,26 @@ thing-type.avmfritz.FRITZ_DECT_Repeater_100.label = FRITZ!DECT Repeater 100 thing-type.avmfritz.FRITZ_DECT_Repeater_100.description = FRITZ!DECT Repeater 100 DECT repeater. thing-type.avmfritz.FRITZ_GROUP_HEATING.label = Heating Group thing-type.avmfritz.FRITZ_GROUP_HEATING.description = Group for heating thermostats. +thing-type.avmfritz.FRITZ_GROUP_HEATING.channel.actual_temp.label = Current Temperature +thing-type.avmfritz.FRITZ_GROUP_HEATING.channel.actual_temp.description = Current measured temperature. thing-type.avmfritz.FRITZ_GROUP_SWITCH.label = Switch Group thing-type.avmfritz.FRITZ_GROUP_SWITCH.description = Group for switchable outlets and power meters. +thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.energy.label = Energy Consumption +thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.energy.description = Accumulated energy consumption. +thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.power.label = Power +thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.power.description = Current power consumption. thing-type.avmfritz.FRITZ_Powerline_546E.label = FRITZ!Powerline 546E thing-type.avmfritz.FRITZ_Powerline_546E.description = FRITZ!Powerline 546E with switchable outlet. +thing-type.avmfritz.FRITZ_Powerline_546E.channel.energy.label = Energy Consumption +thing-type.avmfritz.FRITZ_Powerline_546E.channel.energy.description = Accumulated energy consumption. +thing-type.avmfritz.FRITZ_Powerline_546E.channel.power.label = Power +thing-type.avmfritz.FRITZ_Powerline_546E.channel.power.description = Current power consumption. thing-type.avmfritz.FRITZ_Powerline_546E_Solo.label = FRITZ!Powerline 546E thing-type.avmfritz.FRITZ_Powerline_546E_Solo.description = A FRITZ!Powerline 546E with switchable outlet in stand-alone mode. +thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.energy.label = Energy Consumption +thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.energy.description = Accumulated energy consumption. +thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.power.label = Power +thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.power.description = Current power consumption. thing-type.avmfritz.HAN_FUN_BLINDS.label = HAN-FUN Blinds thing-type.avmfritz.HAN_FUN_BLINDS.description = HAN-FUN blinds (e.g. RolloTron DECT 1213) thing-type.avmfritz.HAN_FUN_COLOR_BULB.label = HAN-FUN Color Light @@ -123,8 +153,6 @@ channel-group-type.avmfritz.sensors.label = Sensor Data channel-type.avmfritz.active_call.label = Active Call channel-type.avmfritz.active_call.description = Details about active call. -channel-type.avmfritz.actual_temp.label = Current Temperature -channel-type.avmfritz.actual_temp.description = Current measured temperature. channel-type.avmfritz.apply_template.label = Apply Template channel-type.avmfritz.apply_template.description = Apply template for device(s). channel-type.avmfritz.call_state.label = Call State @@ -137,16 +165,10 @@ channel-type.avmfritz.comfort_temp.label = Comfort Temperature channel-type.avmfritz.comfort_temp.description = Thermostat Comfort temperature. channel-type.avmfritz.contact_state.label = Contact State channel-type.avmfritz.contact_state.description = Contact state information (OPEN/CLOSED). -channel-type.avmfritz.obstruction_alarm.label = Obstruction Alarm -channel-type.avmfritz.obstruction_alarm.description = Obstruction alarm of the blinds. The blinds were stopped and moved a bit in the opposite direction. -channel-type.avmfritz.temperature_alarm.label = Temperature Alarm -channel-type.avmfritz.temperature_alarm.description = Temperature alarm of the blinds. Indicates overheating of the motor. channel-type.avmfritz.device_locked.label = Locked (manual) channel-type.avmfritz.device_locked.description = Device is locked for switching by pressing the button on the device. channel-type.avmfritz.eco_temp.label = Eco Temperature channel-type.avmfritz.eco_temp.description = Thermostat Eco temperature. -channel-type.avmfritz.energy.label = Energy Consumption -channel-type.avmfritz.energy.description = Accumulated energy consumption. channel-type.avmfritz.humidity.label = Current Humidity channel-type.avmfritz.humidity.description = Current measured humidity. channel-type.avmfritz.incoming_call.label = Incoming Call @@ -166,12 +188,12 @@ channel-type.avmfritz.next_change.description = Next change of Setpoint Temperat channel-type.avmfritz.next_change.state.pattern = %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS channel-type.avmfritz.next_temp.label = Next Setpoint Temperature channel-type.avmfritz.next_temp.description = Next Setpoint Temperature. +channel-type.avmfritz.obstruction_alarm.label = Obstruction Alarm +channel-type.avmfritz.obstruction_alarm.description = Obstruction alarm of the blinds. The blinds were stopped and moved a bit in the opposite direction. channel-type.avmfritz.outgoing_call.label = Outgoing Call channel-type.avmfritz.outgoing_call.description = Details about outgoing call. channel-type.avmfritz.outlet.label = Outlet channel-type.avmfritz.outlet.description = Switched outlet (ON/OFF). -channel-type.avmfritz.power.label = Power -channel-type.avmfritz.power.description = Current power consumption. channel-type.avmfritz.radiator_mode.label = Radiator Mode channel-type.avmfritz.radiator_mode.description = States the mode of the radiator (ON/OFF/COMFORT/ECO/BOOST/WINDOW_OPEN). channel-type.avmfritz.radiator_mode.state.option.ON = On @@ -186,8 +208,8 @@ channel-type.avmfritz.set_temp.label = Setpoint Temperature channel-type.avmfritz.set_temp.description = Thermostat Setpoint temperature. channel-type.avmfritz.temperature.label = Current Temperature channel-type.avmfritz.temperature.description = Current measured temperature. -channel-type.avmfritz.voltage.label = Voltage -channel-type.avmfritz.voltage.description = Current voltage. +channel-type.avmfritz.temperature_alarm.label = Temperature Alarm +channel-type.avmfritz.temperature_alarm.description = Temperature alarm of the blinds. Indicates overheating of the motor. # channel types config diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml index a3aa44053..c019b633e 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml @@ -31,11 +31,21 @@ - - + + + Accumulated energy consumption. + + + + Current power consumption. + + + 1 + + ipAddress diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/channel-types.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/channel-types.xml index 69543c6c8..d16c8e528 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/channel-types.xml +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/channel-types.xml @@ -11,18 +11,21 @@ Details about incoming call. + Call Details about outgoing call. + Call Details about active call. + String @@ -36,6 +39,7 @@ + String @@ -48,6 +52,7 @@ String States the mode of the device (MANUAL/AUTOMATIC/VACATION). + Heating @@ -107,6 +112,10 @@ Current measured temperature. Temperature + + Measurement + Temperature + @@ -117,46 +126,22 @@ Current measured humidity. Humidity + + Measurement + Humidity + - - Number:Energy - - Accumulated energy consumption. - Energy - - - - - Number:Power - - Current power consumption. - Energy - - - - - Number:ElectricPotential - - Current voltage. - Energy - - - Switch Switched outlet (ON/OFF). PowerOutlet - - - - Number:Temperature - - Current measured temperature. - Temperature - + + Switch + Power + @@ -164,6 +149,10 @@ Thermostat Setpoint temperature. Heating + + Setpoint + Temperature + diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml index 00c37e435..26d8691be 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml @@ -91,7 +91,10 @@ - + + + Current measured temperature. + @@ -101,6 +104,10 @@ + + 1 + + ain @@ -120,7 +127,10 @@ - + + + Current measured temperature. + @@ -130,6 +140,10 @@ + + 1 + + ain @@ -149,7 +163,10 @@ - + + + Current measured temperature. + @@ -159,6 +176,10 @@ + + 1 + + ain @@ -178,7 +199,10 @@ - + + + Current measured temperature. + @@ -188,6 +212,10 @@ + + 1 + + ain @@ -207,11 +235,21 @@ - - + + + Accumulated energy consumption. + + + + Current power consumption. + + + 1 + + ain @@ -231,11 +269,21 @@ - - + + + Accumulated energy consumption. + + + + Current power consumption. + + + 1 + + ain @@ -255,11 +303,21 @@ - - + + + Accumulated energy consumption. + + + + Current power consumption. + + + 1 + + ain @@ -410,7 +468,10 @@ - + + + Current measured temperature. + @@ -420,6 +481,10 @@ + + 1 + + ain @@ -438,11 +503,21 @@ - - + + + Accumulated energy consumption. + + + + Current power consumption. + + + 1 + + ain diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 000000000..21263d92c --- /dev/null +++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,116 @@ + + + + + + + system:electrical-energy + + + system:electrical-power + + + system:electrical-voltage + + + + + + + + system:electrical-energy + + + system:electrical-power + + + system:electrical-voltage + + + + + + + + system:electrical-energy + + + system:electrical-power + + + system:electrical-voltage + + + + + + + + system:electrical-energy + + + system:electrical-power + + + system:electrical-voltage + + + + + + + + system:indoor-temperature + + + + + + + + system:indoor-temperature + + + + + + + + system:indoor-temperature + + + + + + + + system:indoor-temperature + + + + + + + + system:indoor-temperature + + + + + + + + system:electrical-energy + + + system:electrical-power + + + system:electrical-voltage + + + + + diff --git a/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java b/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java index e00ded159..815c3b644 100644 --- a/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java +++ b/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java @@ -14,6 +14,8 @@ package org.openhab.binding.avmfritz.internal.actions; import static org.junit.jupiter.api.Assertions.assertThrows; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -29,6 +31,7 @@ import org.openhab.core.thing.binding.ThingHandler; * @author Christoph Weitkamp - Initial contribution */ @ExtendWith(MockitoExtension.class) +@NonNullByDefault public class AVMFritzHeatingActionsTest { private final ThingActions thingActionsStub = new ThingActions() { @@ -37,14 +40,14 @@ public class AVMFritzHeatingActionsTest { } @Override - public ThingHandler getThingHandler() { + public @Nullable ThingHandler getThingHandler() { return null; } }; - private @Mock AVMFritzHeatingActionsHandler heatingActionsHandler; + private @Mock @NonNullByDefault({}) AVMFritzHeatingActionsHandler heatingActionsHandlerMock; - private AVMFritzHeatingActions heatingActions; + private @NonNullByDefault({}) AVMFritzHeatingActions heatingActions; @BeforeEach public void setUp() { @@ -65,13 +68,13 @@ public class AVMFritzHeatingActionsTest { @Test public void testSetBoostModeDurationNull() { - heatingActions.setThingHandler(heatingActionsHandler); + heatingActions.setThingHandler(heatingActionsHandlerMock); assertThrows(IllegalArgumentException.class, () -> AVMFritzHeatingActions.setBoostMode(heatingActions, null)); } @Test public void testSetBoostMode() { - heatingActions.setThingHandler(heatingActionsHandler); + heatingActions.setThingHandler(heatingActionsHandlerMock); AVMFritzHeatingActions.setBoostMode(heatingActions, Long.valueOf(5L)); } @@ -89,14 +92,14 @@ public class AVMFritzHeatingActionsTest { @Test public void testSetWindowOpenModeDurationNull() { - heatingActions.setThingHandler(heatingActionsHandler); + heatingActions.setThingHandler(heatingActionsHandlerMock); assertThrows(IllegalArgumentException.class, () -> AVMFritzHeatingActions.setWindowOpenMode(heatingActions, null)); } @Test public void testSetWindowOpenMode() { - heatingActions.setThingHandler(heatingActionsHandler); + heatingActions.setThingHandler(heatingActionsHandlerMock); AVMFritzHeatingActions.setWindowOpenMode(heatingActions, Long.valueOf(5L)); } }