Rework ThingActions (#8755)

* Remove duplication by making use of default Java generated exceptions
* Make ThingActions labels/descriptions more consistent

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-10-15 10:53:53 +02:00
committed by GitHub
parent aef1d10f40
commit 978e122e00
40 changed files with 305 additions and 785 deletions

View File

@@ -55,12 +55,8 @@ public class AVMFritzHeatingActions implements ThingActions {
actionsHandler.setBoostMode(duration.longValue());
}
public static void setBoostMode(@Nullable ThingActions actions, @Nullable Long duration) {
if (actions instanceof AVMFritzHeatingActions) {
((AVMFritzHeatingActions) actions).setBoostMode(duration);
} else {
throw new IllegalArgumentException("Actions is not an instance of AVMFritzHeatingActions");
}
public static void setBoostMode(ThingActions actions, @Nullable Long duration) {
((AVMFritzHeatingActions) actions).setBoostMode(duration);
}
@RuleAction(label = "@text/setWindowOpenModeActionLabel", description = "@text/setWindowOpenModeActionDescription")
@@ -76,11 +72,7 @@ public class AVMFritzHeatingActions implements ThingActions {
actionsHandler.setWindowOpenMode(duration.longValue());
}
public static void setWindowOpenMode(@Nullable ThingActions actions, @Nullable Long duration) {
if (actions instanceof AVMFritzHeatingActions) {
((AVMFritzHeatingActions) actions).setWindowOpenMode(duration);
} else {
throw new IllegalArgumentException("Actions is not an instance of AVMFritzHeatingActions");
}
public static void setWindowOpenMode(ThingActions actions, @Nullable Long duration) {
((AVMFritzHeatingActions) actions).setWindowOpenMode(duration);
}
}

View File

@@ -1,10 +1,10 @@
# thing actions
setBoostModeModeActionLabel = Set Boost Mode
setBoostModeModeActionLabel = set the Boost mode
setBoostModeActionDescription = Activates the Boost mode of the heating thermostat.
setBoostModeDurationInputLabel = Duration
setBoostModeDurationInputDescription = Duration in seconds, min. 1, max. 86400, 0 for deactivation.
setWindowOpenModeActionLabel = Set Window Open Mode
setWindowOpenModeActionLabel = set the Window Open mode
setWindowOpenModeActionDescription = Activates the Window Open mode of the heating thermostat.
setWindowOpenModeDurationInputLabel = Duration
setWindowOpenModeDurationInputDescription = Duration in seconds, min. 1, max. 86400, 0 for deactivation.