}
// Static method for Rules DSL backward compatibility
- public static void reboot(@Nullable ThingActions actions) {
- if (actions instanceof BridgeActions) {
- ((BridgeActions) actions).reboot();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of BridgeActions");
- }
+ public static void reboot(ThingActions actions) {
+ ((BridgeActions) actions).reboot();
}
}
return null;
}
- public static @Nullable QuantityType<Angle> getElevation(@Nullable ThingActions actions,
- @Nullable ZonedDateTime date) {
- if (actions instanceof AstroActions) {
- return ((AstroActions) actions).getElevation(date);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AstroActions");
- }
+ public static @Nullable QuantityType<Angle> getElevation(ThingActions actions, @Nullable ZonedDateTime date) {
+ return ((AstroActions) actions).getElevation(date);
}
- public static @Nullable QuantityType<Angle> getAzimuth(@Nullable ThingActions actions,
- @Nullable ZonedDateTime date) {
- if (actions instanceof AstroActions) {
- return ((AstroActions) actions).getAzimuth(date);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AstroActions");
- }
+ public static @Nullable QuantityType<Angle> getAzimuth(ThingActions actions, @Nullable ZonedDateTime date) {
+ return ((AstroActions) actions).getAzimuth(date);
}
- public static @Nullable ZonedDateTime getEventTime(@Nullable ThingActions actions, @Nullable String phaseName,
+ public static @Nullable ZonedDateTime getEventTime(ThingActions actions, @Nullable String phaseName,
@Nullable ZonedDateTime date, @Nullable String moment) {
- if (actions instanceof AstroActions) {
- if (phaseName != null) {
- return ((AstroActions) actions).getEventTime(phaseName, date, moment);
- } else {
- throw new IllegalArgumentException("phaseName can not be null");
- }
+ if (phaseName != null) {
+ return ((AstroActions) actions).getEventTime(phaseName, date, moment);
} else {
- throw new IllegalArgumentException("Actions is not an instance of AstroActions");
+ throw new IllegalArgumentException("phaseName can not be null");
}
}
}
}
}
- public static void start(@Nullable ThingActions actions, int durationMin) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).start(durationMin);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void start(ThingActions actions, int durationMin) {
+ ((AutomowerActions) actions).start(durationMin);
}
@RuleAction(label = "@text/action-pause-label", description = "@text/action-pause-desc")
}
}
- public static void pause(@Nullable ThingActions actions) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).pause();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void pause(ThingActions actions) {
+ ((AutomowerActions) actions).pause();
}
@RuleAction(label = "@text/action-parkuntilnextschedule-label", description = "@text/action-parkuntilnextschedule-desc")
}
}
- public static void parkUntilNextSchedule(@Nullable ThingActions actions) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).parkUntilNextSchedule();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void parkUntilNextSchedule(ThingActions actions) {
+ ((AutomowerActions) actions).parkUntilNextSchedule();
}
@RuleAction(label = "@text/action-parkuntilfurthernotice-label", description = "@text/action-parkuntilfurthernotice-desc")
}
}
- public static void parkUntilFurtherNotice(@Nullable ThingActions actions) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).parkUntilFurtherNotice();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void parkUntilFurtherNotice(ThingActions actions) {
+ ((AutomowerActions) actions).parkUntilFurtherNotice();
}
@RuleAction(label = "@text/action-park-label", description = "@text/action-park-desc")
}
}
- public static void park(@Nullable ThingActions actions, int durationMin) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).park(durationMin);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void park(ThingActions actions, int durationMin) {
+ ((AutomowerActions) actions).park(durationMin);
}
@RuleAction(label = "@text/action-resumeschedule-label", description = "@text/action-resumeschedule-desc")
}
}
- public static void resumeSchedule(@Nullable ThingActions actions) {
- if (actions instanceof AutomowerActions) {
- ((AutomowerActions) actions).resumeSchedule();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
- }
+ public static void resumeSchedule(ThingActions actions) {
+ ((AutomowerActions) actions).resumeSchedule();
}
}
comm-error-mower-not-connected-to-cloud = Automower not connected to the cloud
-action-start-label = Start
-action-start-desc = Starts the automower for a defined amount of time, overriding its schedule
+action-start-label = start the automower
+action-start-desc = Starts the automower for a defined amount of time, overriding its schedule.
-action-pause-label = Pause
-action-pause-desc = Pauses the automower wherever it currently is
+action-pause-label = pause the automower
+action-pause-desc = Pauses the automower wherever it currently is.
-action-parkuntilnextschedule-label = Park until next schedule
-action-parkuntilnextschedule-desc = Parks the automower until the next schedule
+action-parkuntilnextschedule-label = park until the next schedule
+action-parkuntilnextschedule-desc = Parks the automower until the next schedule.
-action-parkuntilfurthernotice-label = Park until further notice
-action-parkuntilfurthernotice-desc = Parks the automower until the schedule is resumed
+action-parkuntilfurthernotice-label = park until further notice
+action-parkuntilfurthernotice-desc = Parks the automower until the schedule is resumed.
-action-park-label = Park
-action-park-desc = Parks the automower for a defined amount of time, overriding its schedule
+action-park-label = park the automower
+action-park-desc = Parks the automower for a defined amount of time, overriding its schedule.
-action-resumeschedule-label = Resume schedule
-action-resumeschedule-desc = Resumes the schedule for the automower
+action-resumeschedule-label = resume the schedule
+action-resumeschedule-desc = Resumes the schedule for the automower.
action-input-duration-label = Duration
action-input-duration-desc = The duration of the automower command in minutes
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")
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);
}
}
# 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.
}
@Test
- public void testSetBoostModeThingActionsIsNull() {
- assertThrows(IllegalArgumentException.class, () -> AVMFritzHeatingActions.setBoostMode(null, Long.valueOf(5L)));
- }
-
- @Test
- public void testSetBoostModeThingActionsIsNotPushoverThingActions() {
- assertThrows(IllegalArgumentException.class,
+ public void testSetBoostModeThingActionsIsNotAVMFritzHeatingActions() {
+ assertThrows(ClassCastException.class,
() -> AVMFritzHeatingActions.setBoostMode(thingActionsStub, Long.valueOf(5L)));
}
}
@Test
- public void testSetWindowOpenModeThingActionsIsNull() {
- assertThrows(IllegalArgumentException.class,
- () -> AVMFritzHeatingActions.setWindowOpenMode(null, Long.valueOf(5L)));
- }
-
- @Test
- public void testSetWindowOpenModeThingActionsIsNotPushoverThingActions() {
- assertThrows(IllegalArgumentException.class,
+ public void testSetWindowOpenModeThingActionsIsNotAVMFritzHeatingActions() {
+ assertThrows(ClassCastException.class,
() -> AVMFritzHeatingActions.setWindowOpenMode(thingActionsStub, Long.valueOf(5L)));
}
}
}
- public static void sendFade(@Nullable ThingActions actions, @Nullable String channels, @Nullable String fade,
+ public static void sendFade(ThingActions actions, @Nullable String channels, @Nullable String fade,
@Nullable Boolean resumeAfter) {
- if (actions instanceof DmxActions) {
- ((DmxActions) actions).sendFade(channels, fade, resumeAfter);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DmxActions");
- }
+ ((DmxActions) actions).sendFade(channels, fade, resumeAfter);
}
@Override
}
}
- public static void restart(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- ((DoorbirdActions) actions).restart();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static void restart(ThingActions actions) {
+ ((DoorbirdActions) actions).restart();
}
@RuleAction(label = "hangup a SIP call", description = "Hangup SIP call.")
}
}
- public static void sipHangup(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- ((DoorbirdActions) actions).sipHangup();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static void sipHangup(ThingActions actions) {
+ ((DoorbirdActions) actions).sipHangup();
}
@RuleAction(label = "get the ring time limit", description = "Get the value of RING_TIME_LIMIT.")
}
}
- public static String getRingTimeLimit(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- return ((DoorbirdActions) actions).getRingTimeLimit();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static String getRingTimeLimit(ThingActions actions) {
+ return ((DoorbirdActions) actions).getRingTimeLimit();
}
@RuleAction(label = "get the call time limit", description = "Get the value of CALL_TIME_LIMIT.")
}
}
- public static String getCallTimeLimit(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- return ((DoorbirdActions) actions).getCallTimeLimit();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static String getCallTimeLimit(ThingActions actions) {
+ return ((DoorbirdActions) actions).getCallTimeLimit();
}
@RuleAction(label = "get the last error code", description = "Get the value of LASTERRORCODE.")
}
}
- public static String getLastErrorCode(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- return ((DoorbirdActions) actions).getLastErrorCode();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static String getLastErrorCode(ThingActions actions) {
+ return ((DoorbirdActions) actions).getLastErrorCode();
}
@RuleAction(label = "get the last error text", description = "Get the value of LASTERRORTEXT.")
}
}
- public static String getLastErrorText(@Nullable ThingActions actions) {
- if (actions instanceof DoorbirdActions) {
- return ((DoorbirdActions) actions).getLastErrorText();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
- }
+ public static String getLastErrorText(ThingActions actions) {
+ return ((DoorbirdActions) actions).getLastErrorText();
}
}
return localHandler.actionPerformFunction(function);
}
- public static boolean acknowledge(@Nullable ThingActions actions, @Nullable String ackRef, @Nullable String ackType,
+ public static boolean acknowledge(ThingActions actions, @Nullable String ackRef, @Nullable String ackType,
@Nullable Boolean remindMeLater) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).acknowledge(ackRef, ackType, remindMeLater);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).acknowledge(ackRef, ackType, remindMeLater);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean controlPlug(@Nullable ThingActions actions, @Nullable String plugName,
- @Nullable String plugState, @Nullable Date startDateTime, @Nullable Date endDateTime,
- @Nullable String holdType, @Nullable Number holdHours) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).controlPlug(plugName, plugState, startDateTime, endDateTime, holdType,
- holdHours);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean controlPlug(ThingActions actions, @Nullable String plugName, @Nullable String plugState,
+ @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
+ @Nullable Number holdHours) {
+ return ((EcobeeActions) actions).controlPlug(plugName, plugState, startDateTime, endDateTime, holdType,
+ holdHours);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean createVacation(@Nullable ThingActions actions, @Nullable String name,
+ public static boolean createVacation(ThingActions actions, @Nullable String name,
@Nullable QuantityType<Temperature> coolHoldTemp, @Nullable QuantityType<Temperature> heatHoldTemp,
@Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String fan,
@Nullable Number fanMinOnTime) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).createVacation(name, coolHoldTemp, heatHoldTemp, startDateTime,
- endDateTime, fan, fanMinOnTime);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).createVacation(name, coolHoldTemp, heatHoldTemp, startDateTime, endDateTime,
+ fan, fanMinOnTime);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean deleteVacation(@Nullable ThingActions actions, @Nullable String name) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).deleteVacation(name);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean deleteVacation(ThingActions actions, @Nullable String name) {
+ return ((EcobeeActions) actions).deleteVacation(name);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean resetPreferences(@Nullable ThingActions actions) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).resetPreferences();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean resetPreferences(ThingActions actions) {
+ return ((EcobeeActions) actions).resetPreferences();
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean resumeProgram(@Nullable ThingActions actions, @Nullable Boolean resumeAll) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).resumeProgram(resumeAll);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean resumeProgram(ThingActions actions, @Nullable Boolean resumeAll) {
+ return ((EcobeeActions) actions).resumeProgram(resumeAll);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean sendMessage(@Nullable ThingActions actions, @Nullable String text) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).sendMessage(text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean sendMessage(ThingActions actions, @Nullable String text) {
+ return ((EcobeeActions) actions).sendMessage(text);
}
/**
return setHold(params, null, null, null, null);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+ public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
@Nullable QuantityType<Temperature> heatHoldTemp) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp);
}
/**
return setHold(params, null, null, null, null);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+ public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
@Nullable QuantityType<Temperature> heatHoldTemp, @Nullable Number holdHours) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdHours);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdHours);
}
/**
return setHold(params, null, null, null, null);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable String holdClimateRef) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(holdClimateRef);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean setHold(ThingActions actions, @Nullable String holdClimateRef) {
+ return ((EcobeeActions) actions).setHold(holdClimateRef);
}
/**
return setHold(params, null, null, null, null);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable String holdClimateRef,
- @Nullable Number holdHours) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(holdClimateRef, holdHours);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean setHold(ThingActions actions, @Nullable String holdClimateRef, @Nullable Number holdHours) {
+ return ((EcobeeActions) actions).setHold(holdClimateRef, holdHours);
}
/**
return setHold(params, holdType, holdHours, startDateTime, endDateTime);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+ public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
@Nullable QuantityType<Temperature> heatHoldTemp, @Nullable String holdClimateRef,
@Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
@Nullable Number holdHours) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdClimateRef, startDateTime,
- endDateTime, holdType, holdHours);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdClimateRef, startDateTime, endDateTime,
+ holdType, holdHours);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean setHold(@Nullable ThingActions actions, @Nullable Map<String, Object> params,
- @Nullable String holdType, @Nullable Number holdHours, @Nullable Date startDateTime,
- @Nullable Date endDateTime) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setHold(params, holdType, holdHours, startDateTime, endDateTime);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean setHold(ThingActions actions, @Nullable Map<String, Object> params, @Nullable String holdType,
+ @Nullable Number holdHours, @Nullable Date startDateTime, @Nullable Date endDateTime) {
+ return ((EcobeeActions) actions).setHold(params, holdType, holdHours, startDateTime, endDateTime);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean setOccupied(@Nullable ThingActions actions, @Nullable Boolean occupied,
- @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
- @Nullable Number holdHours) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).setOccupied(occupied, startDateTime, endDateTime, holdType, holdHours);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static boolean setOccupied(ThingActions actions, @Nullable Boolean occupied, @Nullable Date startDateTime,
+ @Nullable Date endDateTime, @Nullable String holdType, @Nullable Number holdHours) {
+ return ((EcobeeActions) actions).setOccupied(occupied, startDateTime, endDateTime, holdType, holdHours);
}
/**
return localHandler.actionPerformFunction(function);
}
- public static boolean updateSensor(@Nullable ThingActions actions, @Nullable String name, @Nullable String deviceId,
+ public static boolean updateSensor(ThingActions actions, @Nullable String name, @Nullable String deviceId,
@Nullable String sensorId) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).updateSensor(name, deviceId, sensorId);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ return ((EcobeeActions) actions).updateSensor(name, deviceId, sensorId);
}
/**
return localHandler.getAlerts();
}
- public static @Nullable String getAlerts(@Nullable ThingActions actions) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).getAlerts();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static @Nullable String getAlerts(ThingActions actions) {
+ return ((EcobeeActions) actions).getAlerts();
}
/**
return localHandler.getEvents();
}
- public static @Nullable String getEvents(@Nullable ThingActions actions) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).getEvents();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static @Nullable String getEvents(ThingActions actions) {
+ return ((EcobeeActions) actions).getEvents();
}
/**
return localHandler.getClimates();
}
- public static @Nullable String getClimates(@Nullable ThingActions actions) {
- if (actions instanceof EcobeeActions) {
- return ((EcobeeActions) actions).getClimates();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
- }
+ public static @Nullable String getClimates(ThingActions actions) {
+ return ((EcobeeActions) actions).getClimates();
}
}
}
// delegation methods for "legacy" rule support
- public static void sendRcCommand(@Nullable ThingActions actions, String rcButton) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendRcCommand(rcButton);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendInfo(@Nullable ThingActions actions, String info) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendInfo(info);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendInfo(@Nullable ThingActions actions, String info, int timeout) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendInfo(info, timeout);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendWarning(@Nullable ThingActions actions, String warning) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendWarning(warning);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendWarning(@Nullable ThingActions actions, String warning, int timeout) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendWarning(warning, timeout);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendError(@Nullable ThingActions actions, String error) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendError(error);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendError(@Nullable ThingActions actions, String error, int timeout) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendError(error, timeout);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendQuestion(@Nullable ThingActions actions, String text) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendQuestion(text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
- }
-
- public static void sendQuestion(@Nullable ThingActions actions, String text, int timeout) {
- if (actions instanceof Enigma2Actions) {
- ((Enigma2Actions) actions).sendQuestion(text, timeout);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
- }
+ public static void sendRcCommand(ThingActions actions, String rcButton) {
+ ((Enigma2Actions) actions).sendRcCommand(rcButton);
+ }
+
+ public static void sendInfo(ThingActions actions, String info) {
+ ((Enigma2Actions) actions).sendInfo(info);
+ }
+
+ public static void sendInfo(ThingActions actions, String info, int timeout) {
+ ((Enigma2Actions) actions).sendInfo(info, timeout);
+ }
+
+ public static void sendWarning(ThingActions actions, String warning) {
+ ((Enigma2Actions) actions).sendWarning(warning);
+ }
+
+ public static void sendWarning(ThingActions actions, String warning, int timeout) {
+ ((Enigma2Actions) actions).sendWarning(warning, timeout);
+ }
+
+ public static void sendError(ThingActions actions, String error) {
+ ((Enigma2Actions) actions).sendError(error);
+ }
+
+ public static void sendError(ThingActions actions, String error, int timeout) {
+ ((Enigma2Actions) actions).sendError(error, timeout);
+ }
+
+ public static void sendQuestion(ThingActions actions, String text) {
+ ((Enigma2Actions) actions).sendQuestion(text);
+ }
+
+ public static void sendQuestion(ThingActions actions, String text, int timeout) {
+ ((Enigma2Actions) actions).sendQuestion(text, timeout);
}
}
channel-type.enigma2.power.description = Setting the power to on/off.
# actions
-action.enigma2.send-rc-button.label=sendRcCommand
-action.enigma2.send-rc-button.description=Send an Remote Control Command
-action-input.enigma2.rc-button.label=rcButton
-action-input.enigma2.rc-button.description=The Remote Control Button
+action.enigma2.send-rc-button.label=send a remote control command
+action.enigma2.send-rc-button.description=Send a remote control command.
+action-input.enigma2.rc-button.label=Button
+action-input.enigma2.rc-button.description=The remote control button
-action.enigma2.send-info.label=sendInfo
-action.enigma2.send-info.description=Send an info message to the TV screen
-action.enigma2.send-warning.label=sendWarning
-action.enigma2.send-warning.description=Send an warning message to the TV screen
-action.enigma2.send-error.label=sendError
-action.enigma2.send-error.description=Send an error message to the TV screen
-action.enigma2.send-question.label=sendQuestion
-action.enigma2.send-question.description=Send a question message to the TV screen
+action.enigma2.send-info.label=send an info message
+action.enigma2.send-info.description=Send an info message to the TV screen.
+action.enigma2.send-warning.label=send a warning message
+action.enigma2.send-warning.description=Send a warning message to the TV screen.
+action.enigma2.send-error.label=send an error message
+action.enigma2.send-error.description=Send an error message to the TV screen.
+action.enigma2.send-question.label=send a question message
+action.enigma2.send-question.description=Send a question message to the TV screen.
action-input.enigma2.text.label=text
action-input.enigma2.text.description=The message text
action-input.enigma2.timeout.label=timeout
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;
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.openhab.binding.enigma2.internal.Enigma2BindingConstants;
*
* @author Guido Dolfen - Initial contribution
*/
-@SuppressWarnings("null")
@NonNullByDefault
public class Enigma2ActionsTest {
- @Nullable
- private Enigma2Actions enigma2Actions;
- @Nullable
- private Enigma2Handler enigma2Handler;
+ private @NonNullByDefault({}) Enigma2Actions enigma2Actions;
+ private @NonNullByDefault({}) Enigma2Handler enigma2Handler;
public static final String SOME_TEXT = "some Text";
@BeforeEach
verify(enigma2Handler).sendRcCommand("KEY_1");
}
- @Test
- public void testSendRcCommandStaticWithException() {
- assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendRcCommand(null, "KEY_1"));
- }
-
@Test
public void testSendInfoStatic() {
Enigma2Actions.sendInfo(enigma2Actions, SOME_TEXT);
verify(enigma2Handler).sendInfo(10, SOME_TEXT);
}
- @Test
- public void testSendInfoStaticWithException() {
- assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendInfo(null, SOME_TEXT));
- }
-
@Test
public void testSendErrorStatic() {
Enigma2Actions.sendError(enigma2Actions, SOME_TEXT);
verify(enigma2Handler).sendError(10, SOME_TEXT);
}
- @Test
- public void testSendErrorStaticWithException() {
- assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendError(null, SOME_TEXT));
- }
-
@Test
public void testSendWarningStatic() {
Enigma2Actions.sendWarning(enigma2Actions, SOME_TEXT);
verify(enigma2Handler).sendWarning(10, SOME_TEXT);
}
- @Test
- public void testSendWarningStaticWithException() {
- assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendWarning(null, SOME_TEXT));
- }
-
@Test
public void testSendQuestionStatic() {
Enigma2Actions.sendQuestion(enigma2Actions, SOME_TEXT);
Enigma2Actions.sendQuestion(enigma2Actions, SOME_TEXT, 10);
verify(enigma2Handler).sendQuestion(10, SOME_TEXT);
}
-
- @Test
- public void testSendQuestionStaticWithException() {
- assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendQuestion(null, SOME_TEXT));
- }
}
}
}
- public static void resetCounter(@Nullable ThingActions actions, Integer counter) {
- if (actions instanceof Ipx800Actions) {
- ((Ipx800Actions) actions).resetCounter(counter);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Ipx800Actions");
- }
+ public static void resetCounter(ThingActions actions, Integer counter) {
+ ((Ipx800Actions) actions).resetCounter(counter);
}
- public static void reset(@Nullable ThingActions actions, @Nullable Integer placeholder) {
- if (actions instanceof Ipx800Actions) {
- ((Ipx800Actions) actions).reset(placeholder);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of Ipx800Actions");
- }
+ public static void reset(ThingActions actions, @Nullable Integer placeholder) {
+ ((Ipx800Actions) actions).reset(placeholder);
}
}
return handler.getApiConnection();
}
- @RuleAction(label = "Play Input", description = "Play an input from another device")
+ @RuleAction(label = "play an input", description = "Play an input from another device.")
public void playInputFromPlayer(
@ActionInput(name = "source", label = "Source Player", description = "Player used for input") @Nullable Integer sourcePlayer,
@ActionInput(name = "input", label = "Source Input", description = "Input source used") @Nullable String input,
}
}
- public static void playInputFromPlayer(@Nullable ThingActions actions, @Nullable Integer sourcePlayer,
- @Nullable String input, @Nullable Integer destinationPlayer) {
- if (actions instanceof HeosActions) {
- ((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of HeosActions");
- }
+ public static void playInputFromPlayer(ThingActions actions, @Nullable Integer sourcePlayer, @Nullable String input,
+ @Nullable Integer destinationPlayer) {
+ ((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
}
}
logger.debug("send LightAction to {} with {}ms of fadeTime", channel, fadeTime);
}
- public static void fadingLightCommand(@Nullable ThingActions actions, @Nullable String channel,
- @Nullable Command command, @Nullable DecimalType fadeTime) {
- if (actions instanceof LightActions) {
- ((LightActions) actions).fadingLightCommand(channel, command, fadeTime);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LightActions");
- }
+ public static void fadingLightCommand(ThingActions actions, @Nullable String channel, @Nullable Command command,
+ @Nullable DecimalType fadeTime) {
+ ((LightActions) actions).fadingLightCommand(channel, command, fadeTime);
}
}
return handler;
}
- @RuleAction(label = "Record MP4", description = "Record MP4 to a set filename if given, or if filename is null to ipcamera.mp4")
+ @RuleAction(label = "record an MP4", description = "Record MP4 to a set filename if given, or if filename is null to ipcamera.mp4")
public void recordMP4(
@ActionInput(name = "filename", label = "Filename", description = "Name that the recording will have once created, don't include the .mp4.") @Nullable String filename,
@ActionInput(name = "secondsToRecord", label = "Seconds to Record", description = "Enter a number of how many seconds to record.") int secondsToRecord) {
}
}
- public static void recordMP4(@Nullable ThingActions actions, @Nullable String filename, int secondsToRecord) {
- if (actions instanceof IpCameraActions) {
- ((IpCameraActions) actions).recordMP4(filename, secondsToRecord);
- } else {
- throw new IllegalArgumentException("Instance is not a IpCamera class.");
- }
+ public static void recordMP4(ThingActions actions, @Nullable String filename, int secondsToRecord) {
+ ((IpCameraActions) actions).recordMP4(filename, secondsToRecord);
}
- @RuleAction(label = "Record GIF", description = "Record GIF to a set filename if given, or if filename is null to ipcamera.gif")
+ @RuleAction(label = "record a GIF", description = "Record GIF to a set filename if given, or if filename is null to ipcamera.gif")
public void recordGIF(
@ActionInput(name = "filename", label = "Filename", description = "Name that the recording will have once created, don't include the .mp4.") @Nullable String filename,
@ActionInput(name = "secondsToRecord", label = "Seconds to Record", description = "Enter a number of how many seconds to record.") int secondsToRecord) {
}
}
- public static void recordGIF(@Nullable ThingActions actions, @Nullable String filename, int secondsToRecord) {
- if (actions instanceof IpCameraActions) {
- ((IpCameraActions) actions).recordGIF(filename, secondsToRecord);
- } else {
- throw new IllegalArgumentException("Instance is not a IpCamera class.");
- }
+ public static void recordGIF(ThingActions actions, @Nullable String filename, int secondsToRecord) {
+ ((IpCameraActions) actions).recordGIF(filename, secondsToRecord);
}
}
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void sendKCommand(@Nullable ThingActions actions, String kCommand) throws IllegalArgumentException {
- if (actions instanceof KaleidescapeThingActions) {
- ((KaleidescapeThingActions) actions).sendKCommand(kCommand);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of KaleidescapeThingActions");
- }
+ public static void sendKCommand(ThingActions actions, String kCommand) throws IllegalArgumentException {
+ ((KaleidescapeThingActions) actions).sendKCommand(kCommand);
}
@Override
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void hitKey(@Nullable ThingActions actions, @Nullable String table, int key,
- @Nullable String action) {
- if (actions instanceof LcnModuleHandler) {
- ((LcnModuleActions) actions).hitKey(table, key, action);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
- }
+ public static void hitKey(ThingActions actions, @Nullable String table, int key, @Nullable String action) {
+ ((LcnModuleActions) actions).hitKey(table, key, action);
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void flickerOutput(@Nullable ThingActions actions, int output, int depth, int ramp, int count) {
- if (actions instanceof LcnModuleHandler) {
- ((LcnModuleActions) actions).flickerOutput(output, depth, ramp, count);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
- }
+ public static void flickerOutput(ThingActions actions, int output, int depth, int ramp, int count) {
+ ((LcnModuleActions) actions).flickerOutput(output, depth, ramp, count);
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void sendDynamicText(@Nullable ThingActions actions, int row, @Nullable String text) {
- if (actions instanceof LcnModuleHandler) {
- ((LcnModuleActions) actions).sendDynamicText(row, text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
- }
+ public static void sendDynamicText(ThingActions actions, int row, @Nullable String text) {
+ ((LcnModuleActions) actions).sendDynamicText(row, text);
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void startRelayTimer(@Nullable ThingActions actions, int relaynumber, double duration) {
- if (actions instanceof LcnModuleHandler) {
- ((LcnModuleActions) actions).startRelayTimer(relaynumber, duration);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
- }
+ public static void startRelayTimer(ThingActions actions, int relaynumber, double duration) {
+ ((LcnModuleActions) actions).startRelayTimer(relaynumber, duration);
}
private LcnModuleHandler getHandler() throws LcnException {
// delegation methods for "legacy" rule support
- public static void showToast(@Nullable ThingActions actions, String text) throws IOException {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).showToast(text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void showToast(ThingActions actions, String text) throws IOException {
+ ((LGWebOSActions) actions).showToast(text);
}
- public static void showToast(@Nullable ThingActions actions, String icon, String text) throws IOException {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).showToast(icon, text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void showToast(ThingActions actions, String icon, String text) throws IOException {
+ ((LGWebOSActions) actions).showToast(icon, text);
}
- public static void launchBrowser(@Nullable ThingActions actions, String url) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).launchBrowser(url);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void launchBrowser(ThingActions actions, String url) {
+ ((LGWebOSActions) actions).launchBrowser(url);
}
- public static void launchApplication(@Nullable ThingActions actions, String appId) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).launchApplication(appId);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void launchApplication(ThingActions actions, String appId) {
+ ((LGWebOSActions) actions).launchApplication(appId);
}
- public static void launchApplication(@Nullable ThingActions actions, String appId, String param) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).launchApplication(appId, param);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void launchApplication(ThingActions actions, String appId, String param) {
+ ((LGWebOSActions) actions).launchApplication(appId, param);
}
- public static void sendText(@Nullable ThingActions actions, String text) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).sendText(text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void sendText(ThingActions actions, String text) {
+ ((LGWebOSActions) actions).sendText(text);
}
- public static void sendButton(@Nullable ThingActions actions, String button) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).sendButton(button);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void sendButton(ThingActions actions, String button) {
+ ((LGWebOSActions) actions).sendButton(button);
}
- public static void increaseChannel(@Nullable ThingActions actions) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).increaseChannel();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void increaseChannel(ThingActions actions) {
+ ((LGWebOSActions) actions).increaseChannel();
}
- public static void decreaseChannel(@Nullable ThingActions actions) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).decreaseChannel();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void decreaseChannel(ThingActions actions) {
+ ((LGWebOSActions) actions).decreaseChannel();
}
- public static void sendRCButton(@Nullable ThingActions actions, String rcButton) {
- if (actions instanceof LGWebOSActions) {
- ((LGWebOSActions) actions).sendRCButton(rcButton);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
- }
+ public static void sendRCButton(ThingActions actions, String rcButton) {
+ ((LGWebOSActions) actions).sendRCButton(rcButton);
}
}
-actionShowToastLabel=Show Toast
+actionShowToastLabel=show a toast message
actionShowToastDesc=Sends a toast message to a WebOS device with openHAB icon.
actionShowToastInputTextLabel=Text
actionShowToastInputTextDesc=The text to display
-actionShowToastWithIconLabel=Show Toast with Icon
+actionShowToastWithIconLabel=show a toast message with icon
actionShowToastWithIconLabel=Sends a toast message to a WebOS device with custom icon.
actionShowToastInputIconLabel=Icon
actionShowToastInputIconDesc=The URL to the icon to display
-actionLaunchBrowserLabel=Launch Browser
+actionLaunchBrowserLabel=launch the browser
actionLaunchBrowserDesc=Opens the given URL in the TV's browser application.
actionLaunchBrowserInputUrlLabel=URL
actionLaunchBrowserInputUrlDesc=The URL to open
-actionLaunchApplicationLabel=Launch Application
+actionLaunchApplicationLabel=launch an application
actionLaunchApplicationDesc=Opens the application with given Application ID.
actionLaunchApplicationInputAppIDLabel=Application ID
actionLaunchApplicationInputAppIDDesc=The Application ID
-actionLaunchApplicationWithParamsLabel=Launch Application with Parameters
+actionLaunchApplicationWithParamsLabel=launch an application with parameters
actionLaunchApplicationWithParamsDesc=Opens the application with given Application ID and passes additional parameters.
actionLaunchApplicationInputParamsLabel=JSON Parameters
actionLaunchApplicationInputParamsDesc=The parameters to hand over to the application in JSON format
-actionSendTextLabel=Send Text
+actionSendTextLabel=send a text input
actionSendTextDesc=Sends a text input to a WebOS device.
actionSendTextInputTextLabel=Text
actionSendTextInputTextDesc=The text to input
-actionSendButtonLabel=Send Button
+actionSendButtonLabel=send a button press
actionSendButtonDesc=Sends a button press event to a WebOS device.
actionSendButtonInputButtonLabel=Button
actionSendButtonInputButtonDesc=Can be one of UP, DOWN, LEFT, RIGHT, BACK, DELETE, ENTER, HOME, or OK
-actionIncreaseChannelLabel=Channel Up
+actionIncreaseChannelLabel=switch one channel up
actionIncreaseChannelDesc=TV will switch one channel up in the current channel list.
-actionDecreaseChannelLabel=Channel Down
+actionDecreaseChannelLabel=switch one channel down
actionDecreaseChannelDesc=TV will switch one channel down in the current channel list.
-actionSendRCButtonLabel=Remote Control button press
+actionSendRCButtonLabel=simulate remote control button press
actionSendRCButtonDesc=Simulates pressing of a Remote Control Button.
actionSendRCButtonInputTextLabel=Remote Control button name
actionSendRCButtonInputTextDesc=The Remote Control button name to send to the WebOS device.
/**
* Static setLevel method for Rules DSL backward compatibility
*/
- public static void setLevel(@Nullable ThingActions actions, @Nullable Double level, @Nullable Double fadeTime,
+ public static void setLevel(ThingActions actions, @Nullable Double level, @Nullable Double fadeTime,
@Nullable Double delayTime) {
- if (actions instanceof DimmerActions) {
- ((DimmerActions) actions).setLevel(level, fadeTime, delayTime);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of DimmerActions");
- }
+ ((DimmerActions) actions).setLevel(level, fadeTime, delayTime);
}
}
}
}
- public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
@Nullable String text) {
return SendMailActions.sendMail(actions, recipient, subject, text, new ArrayList<>());
}
- public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
@Nullable String text, @Nullable String urlString) {
List<String> urlList = new ArrayList<>();
if (urlString != null) {
return SendMailActions.sendMail(actions, recipient, subject, text, urlList);
}
- public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
@Nullable String text, @Nullable List<String> urlStringList) {
- if (actions instanceof SendMailActions) {
- return ((SendMailActions) actions).sendMail(recipient, subject, text, urlStringList);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of SendMailActions");
- }
+ return ((SendMailActions) actions).sendMail(recipient, subject, text, urlStringList);
}
@RuleAction(label = "send a HTML mail", description = "Sends a HTML mail.")
}
}
- public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
- @Nullable String subject, @Nullable String html) {
+ public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ @Nullable String html) {
return SendMailActions.sendHtmlMail(actions, recipient, subject, html, new ArrayList<>());
}
- public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
- @Nullable String subject, @Nullable String html, @Nullable String urlString) {
+ public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ @Nullable String html, @Nullable String urlString) {
List<String> urlList = new ArrayList<>();
if (urlString != null) {
urlList.add(urlString);
return SendMailActions.sendHtmlMail(actions, recipient, subject, html, urlList);
}
- public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
- @Nullable String subject, @Nullable String html, @Nullable List<String> urlStringList) {
- if (actions instanceof SendMailActions) {
- return ((SendMailActions) actions).sendHtmlMail(recipient, subject, html, urlStringList);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of SendMailActions");
- }
+ public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+ @Nullable String html, @Nullable List<String> urlStringList) {
+ return ((SendMailActions) actions).sendHtmlMail(recipient, subject, html, urlStringList);
}
@Override
return true;
}
- public static boolean backup(@Nullable ThingActions actions) {
- if (actions instanceof MaxCubeActions) {
- return ((MaxCubeActions) actions).backup();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
- }
+ public static boolean backup(ThingActions actions) {
+ return ((MaxCubeActions) actions).backup();
}
@RuleAction(label = "reset the Cube configuration", description = "Resets the MAX! Cube room and device information. Devices will need to be included again!")
return true;
}
- public static boolean reset(@Nullable ThingActions actions) {
- if (actions instanceof MaxCubeActions) {
- return ((MaxCubeActions) actions).resetConfig();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
- }
+ public static boolean reset(ThingActions actions) {
+ return ((MaxCubeActions) actions).resetConfig();
}
@RuleAction(label = "restart the Cube", description = "Restarts the MAX! Cube.")
return true;
}
- public static boolean reboot(@Nullable ThingActions actions) {
- if (actions instanceof MaxCubeActions) {
- return ((MaxCubeActions) actions).reboot();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
- }
+ public static boolean reboot(ThingActions actions) {
+ return ((MaxCubeActions) actions).reboot();
}
}
return true;
}
- public static boolean deleteFromCube(@Nullable ThingActions actions) {
- if (actions instanceof MaxDevicesActions) {
- return ((MaxDevicesActions) actions).deleteFromCube();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MaxDevicesActions");
- }
+ public static boolean deleteFromCube(ThingActions actions) {
+ return ((MaxDevicesActions) actions).deleteFromCube();
}
}
private void triggerSwitch(String variableName) {
try {
- if (this.handler != null) {
- this.handler.writeValue(variableName, "1");
+ if (handler != null) {
+ handler.writeValue(variableName, "1");
}
} catch (HeliosException e) {
logger.warn("Error executing action 'resetFilterChangeTimer': {}", e.getMessage());
}
}
- @RuleAction(label = "Reset filter change timer", description = "Sets the filter change timer back to the configured interval")
+ @RuleAction(label = "reset filter change timer", description = "Sets the filter change timer back to the configured interval.")
public void resetFilterChangeTimer() {
- this.triggerSwitch(HeliosEasyControlsBindingConstants.FILTER_CHANGE_RESET);
+ triggerSwitch(HeliosEasyControlsBindingConstants.FILTER_CHANGE_RESET);
}
- public static void resetFilterChangeTimer(@Nullable ThingActions actions) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).resetFilterChangeTimer();
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void resetFilterChangeTimer(ThingActions actions) {
+ ((HeliosEasyControlsActions) actions).resetFilterChangeTimer();
}
- @RuleAction(label = "Reset error messages", description = "Reset error/warning/info messages")
+ @RuleAction(label = "reset error messages", description = "Reset error/warning/info messages.")
public void resetErrors() {
- this.triggerSwitch(HeliosEasyControlsBindingConstants.RESET_FLAG);
+ triggerSwitch(HeliosEasyControlsBindingConstants.RESET_FLAG);
}
- public static void resetErrors(@Nullable ThingActions actions) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).resetErrors();
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void resetErrors(ThingActions actions) {
+ ((HeliosEasyControlsActions) actions).resetErrors();
}
- @RuleAction(label = "Reset to factory defaults", description = "Reset device to factory defaults")
+ @RuleAction(label = "reset to factory defaults", description = "Reset device to factory defaults.")
public void resetToFactoryDefaults() {
- this.triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_RESET);
+ triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_RESET);
}
- public static void resetToFactoryDefaults(@Nullable ThingActions actions) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).resetToFactoryDefaults();
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void resetToFactoryDefaults(ThingActions actions) {
+ ((HeliosEasyControlsActions) actions).resetToFactoryDefaults();
}
- @RuleAction(label = "Reset individual switching times", description = "Reset individual switching times")
+ @RuleAction(label = "reset individual switching times", description = "Reset individual switching times.")
public void resetSwitchingTimes() {
- this.triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_SETTING_WZU);
+ triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_SETTING_WZU);
}
- public static void resetSwitchingTimes(@Nullable ThingActions actions) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).resetSwitchingTimes();
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void resetSwitchingTimes(ThingActions actions) {
+ ((HeliosEasyControlsActions) actions).resetSwitchingTimes();
}
- @RuleAction(label = "Set system date and time", description = "Sets the device's system date and time based on OH's system date and time")
+ @RuleAction(label = "set system date and time", description = "Sets the device's system date and time based on OH's system date and time.")
public void setSysDateTime() {
HeliosEasyControlsHandler handler = this.handler;
if (handler != null) {
}
}
- public static void setSysDateTime(@Nullable ThingActions actions) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).setSysDateTime();
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void setSysDateTime(ThingActions actions) {
+ ((HeliosEasyControlsActions) actions).setSysDateTime();
}
private void setBypass(boolean from, int day, int month) {
}
}
- @RuleAction(label = "Set the bypass from day and month", description = "Sets the day and month from when the bypass should be active")
+ @RuleAction(label = "set the bypass from day and month", description = "Sets the day and month from when the bypass should be active.")
public void setBypassFrom(
@ActionInput(name = "day", label = "bypass from day", description = "The day from when the bypass should be active") int day,
@ActionInput(name = "month", label = "bypass from month", description = "The month from when the bypass should be active") int month) {
- this.setBypass(true, day, month);
+ setBypass(true, day, month);
}
- public static void setBypassFrom(@Nullable ThingActions actions, int day, int month) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).setBypassFrom(day, month);
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void setBypassFrom(ThingActions actions, int day, int month) {
+ ((HeliosEasyControlsActions) actions).setBypassFrom(day, month);
}
- @RuleAction(label = "Set the bypass to day and month", description = "Sets the day and month until when the bypass should be active")
+ @RuleAction(label = "set the bypass to day and month", description = "Sets the day and month until when the bypass should be active.")
public void setBypassTo(
@ActionInput(name = "day", label = "bypass to day", description = "The day until when the bypass should be active") int day,
@ActionInput(name = "month", label = "bypass to month", description = "The month until when the bypass should be active") int month) {
- this.setBypass(false, day, month);
+ setBypass(false, day, month);
}
- public static void setBypassTo(@Nullable ThingActions actions, int day, int month) {
- if (actions instanceof HeliosEasyControlsActions) {
- ((HeliosEasyControlsActions) actions).setBypassTo(day, month);
- } else {
- throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
- }
+ public static void setBypassTo(ThingActions actions, int day, int month) {
+ ((HeliosEasyControlsActions) actions).setBypassTo(day, month);
}
}
}
}
- public static void sendCommand(@Nullable ThingActions actions, @Nullable String command,
- @Nullable String parameter) {
- if (actions instanceof MPDActions) {
- ((MPDActions) actions).sendCommand(command, parameter);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MPDActions");
- }
+ public static void sendCommand(ThingActions actions, @Nullable String command, @Nullable String parameter) {
+ ((MPDActions) actions).sendCommand(command, parameter);
}
- public static void sendCommand(@Nullable ThingActions actions, @Nullable String command) {
- if (actions instanceof MPDActions) {
- ((MPDActions) actions).sendCommand(command);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MPDActions");
- }
+ public static void sendCommand(ThingActions actions, @Nullable String command) {
+ ((MPDActions) actions).sendCommand(command);
}
}
});
}
- public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value) {
+ public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value) {
publishMQTT(actions, topic, value, null);
}
- public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value,
+ public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value,
@Nullable Boolean retain) {
- if (actions instanceof MQTTActions) {
- ((MQTTActions) actions).publishMQTT(topic, value, retain);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of MQTTActions");
- }
+ ((MQTTActions) actions).publishMQTT(topic, value, retain);
}
}
}
}
- public static void sendWakeOnLanPacket(@Nullable ThingActions actions) {
- if (actions instanceof NetworkActions) {
- ((NetworkActions) actions).sendWakeOnLanPacket();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of NetworkActions");
- }
+ public static void sendWakeOnLanPacket(ThingActions actions) {
+ ((NetworkActions) actions).sendWakeOnLanPacket();
}
}
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void sendNuvoCommand(@Nullable ThingActions actions, String rawCommand) {
- if (actions instanceof NuvoThingActions) {
- ((NuvoThingActions) actions).sendNuvoCommand(rawCommand);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of NuvoThingActions");
- }
+ public static void sendNuvoCommand(ThingActions actions, String rawCommand) {
+ ((NuvoThingActions) actions).sendNuvoCommand(rawCommand);
}
@Override
handler.sendRawCommand(command, value);
}
- public static void sendRawCommand(@Nullable ThingActions actions, @Nullable String command,
- @Nullable String value) {
- if (actions instanceof OnkyoThingActions) {
- ((OnkyoThingActions) actions).sendRawCommand(command, value);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of OnkyoThingActions");
- }
+ public static void sendRawCommand(ThingActions actions, @Nullable String command, @Nullable String value) {
+ ((OnkyoThingActions) actions).sendRawCommand(command, value);
}
@Override
return localHandler.sendPush(recipient, title, message, "note");
}
- public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
- @Nullable String title, @Nullable String message) {
- if (actions instanceof PushbulletActions) {
- return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
- }
+ public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient, @Nullable String title,
+ @Nullable String message) {
+ return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
}
@RuleAction(label = "@text/actionSendPushbulletNoteLabel", description = "@text/actionSendPushbulletNoteDesc")
return localHandler.sendPush(recipient, message, "note");
}
- public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
+ public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient,
@Nullable String message) {
- if (actions instanceof PushbulletActions) {
- return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
- }
+ return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
}
}
binding.pushbullet.description = The Pushbullet binding allows you to send messages to other users of the Pushbullet service.
# action
-actionSendPushbulletNoteLabel = publish an Pushbullet message
+actionSendPushbulletNoteLabel = publish a Pushbullet message
actionSendPushbulletNoteDesc = Publishes a Title to the given Pushbullet Recipient.
actionSendPushbulletNoteInputRecipientLabel = Pushbullet Recipient
}
/** Static alias to support the old DSL rules engine and make the action available there. */
- public static void sendRawCommand(@Nullable ThingActions actions, @Nullable String rawCommand) {
- if (actions instanceof RadioThermostatThingActions) {
- ((RadioThermostatThingActions) actions).sendRawCommand(rawCommand);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of RadioThermostatThingActions");
- }
+ public static void sendRawCommand(ThingActions actions, @Nullable String rawCommand) {
+ ((RadioThermostatThingActions) actions).sendRawCommand(rawCommand);
}
@Override
return result;
}
- public static Map<String, Object> readEvent(@Nullable ThingActions actions, @Nullable Number index) {
- if (actions instanceof SatelEventLogActions) {
- return ((SatelEventLogActions) actions).readEvent(index);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of SatelEventLogActions");
- }
+ public static Map<String, Object> readEvent(ThingActions actions, @Nullable Number index) {
+ return ((SatelEventLogActions) actions).readEvent(index);
}
}
config-status.portEmpty = Serial port of INT-RS must be provided.
# actions
-actionReadEventLabel = Read event
+actionReadEventLabel = read an event
actionReadEventDesc = Reads a single record from the event log.
actionInputIndexLabel = Event index
actionInputIndexDesc = Index of the event to read
// legacy delegate methods
/* APIs without chatId parameter */
- public static boolean sendTelegram(@Nullable ThingActions actions, @Nullable String format,
- @Nullable Object... args) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegram(format, args);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegram(ThingActions actions, @Nullable String format, @Nullable Object... args) {
+ return ((TelegramActions) actions).sendTelegram(format, args);
}
- public static boolean sendTelegramQuery(@Nullable ThingActions actions, @Nullable String message,
- @Nullable String replyId, @Nullable String... buttons) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramQuery(message, replyId, buttons);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramQuery(ThingActions actions, @Nullable String message, @Nullable String replyId,
+ @Nullable String... buttons) {
+ return ((TelegramActions) actions).sendTelegramQuery(message, replyId, buttons);
}
- public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable String photoURL,
- @Nullable String caption) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, null, null);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramPhoto(ThingActions actions, @Nullable String photoURL, @Nullable String caption) {
+ return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, null, null);
}
- public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable String photoURL,
- @Nullable String caption, @Nullable String username, @Nullable String password) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, username, password);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramPhoto(ThingActions actions, @Nullable String photoURL, @Nullable String caption,
+ @Nullable String username, @Nullable String password) {
+ return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, username, password);
}
- public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable String replyId,
- @Nullable String message) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramAnswer(replyId, message);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String replyId, @Nullable String message) {
+ return ((TelegramActions) actions).sendTelegramAnswer(replyId, message);
}
/* APIs with chatId parameter */
- public static boolean sendTelegram(@Nullable ThingActions actions, @Nullable Long chatId, @Nullable String format,
+ public static boolean sendTelegram(ThingActions actions, @Nullable Long chatId, @Nullable String format,
@Nullable Object... args) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegram(chatId, format, args);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ return ((TelegramActions) actions).sendTelegram(chatId, format, args);
}
- public static boolean sendTelegramQuery(@Nullable ThingActions actions, @Nullable Long chatId,
- @Nullable String message, @Nullable String replyId, @Nullable String... buttons) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramQuery(chatId, message, replyId, buttons);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramQuery(ThingActions actions, @Nullable Long chatId, @Nullable String message,
+ @Nullable String replyId, @Nullable String... buttons) {
+ return ((TelegramActions) actions).sendTelegramQuery(chatId, message, replyId, buttons);
}
- public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable Long chatId,
- @Nullable String photoURL, @Nullable String caption) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, null, null);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramPhoto(ThingActions actions, @Nullable Long chatId, @Nullable String photoURL,
+ @Nullable String caption) {
+ return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, null, null);
}
- public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable Long chatId,
- @Nullable String photoURL, @Nullable String caption, @Nullable String username, @Nullable String password) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, username, password);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramPhoto(ThingActions actions, @Nullable Long chatId, @Nullable String photoURL,
+ @Nullable String caption, @Nullable String username, @Nullable String password) {
+ return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, username, password);
}
- public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable Long chatId,
- @Nullable String replyId, @Nullable String message) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramAnswer(chatId, replyId, message);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramAnswer(ThingActions actions, @Nullable Long chatId, @Nullable String replyId,
+ @Nullable String message) {
+ return ((TelegramActions) actions).sendTelegramAnswer(chatId, replyId, message);
}
- public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable String chatId,
- @Nullable String replyId, @Nullable String message) {
- if (actions instanceof TelegramActions) {
- return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
- }
+ public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String chatId, @Nullable String replyId,
+ @Nullable String message) {
+ return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
}
@Override
*
* @author Pavel Gololobov - Initial contribution
*/
-@ThingActionsScope(name = "xmpp")
+@ThingActionsScope(name = "xmppclient")
@NonNullByDefault
public class XMPPActions implements ThingActions {
private static final Logger logger = LoggerFactory.getLogger(XMPPActions.class);
connection.sendMessage(to, text);
}
- public static void publishXMPP(@Nullable ThingActions actions, @Nullable String to, @Nullable String text) {
- if (actions instanceof XMPPActions) {
- ((XMPPActions) actions).publishXMPP(to, text);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of XMPPActions");
- }
+ public static void publishXMPP(ThingActions actions, @Nullable String to, @Nullable String text) {
+ ((XMPPActions) actions).publishXMPP(to, text);
}
}
}
}
- public static void sendIRCode(@Nullable ThingActions actions, @Nullable String irCode) {
- if (actions instanceof YIOremoteDockActions) {
- ((YIOremoteDockActions) actions).sendIRCode(irCode);
- } else {
- throw new IllegalArgumentException("Instance is not an YIOremoteDockActions class.");
- }
+ public static void sendIRCode(ThingActions actions, @Nullable String irCode) {
+ ((YIOremoteDockActions) actions).sendIRCode(irCode);
}
}
*
* @author Mark Hilbush - Initial contribution
*/
-@ThingActionsScope(name = "zm")
+@ThingActionsScope(name = "zoneminder")
@NonNullByDefault
public class ZmActions implements ThingActions {
private final Logger logger = LoggerFactory.getLogger(ZmActions.class);
localHandler.actionTriggerAlarm(duration);
}
- public static void triggerAlarm(@Nullable ThingActions actions, @Nullable Number alarmDuration) {
- if (actions instanceof ZmActions) {
- ((ZmActions) actions).triggerAlarm(alarmDuration);
- } else {
- throw new IllegalArgumentException("Actions is not an instance of ZmActions");
- }
+ public static void triggerAlarm(ThingActions actions, @Nullable Number alarmDuration) {
+ ((ZmActions) actions).triggerAlarm(alarmDuration);
}
/**
localHandler.actionTriggerAlarm();
}
- public static void triggerAlarm(@Nullable ThingActions actions) {
- if (actions instanceof ZmActions) {
- ((ZmActions) actions).triggerAlarm();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of ZmActions");
- }
+ public static void triggerAlarm(ThingActions actions) {
+ ((ZmActions) actions).triggerAlarm();
}
/**
localHandler.actionCancelAlarm();
}
- public static void cancelAlarm(@Nullable ThingActions actions) {
- if (actions instanceof ZmActions) {
- ((ZmActions) actions).cancelAlarm();
- } else {
- throw new IllegalArgumentException("Actions is not an instance of ZmActions");
- }
+ public static void cancelAlarm(ThingActions actions) {
+ ((ZmActions) actions).cancelAlarm();
}
}