Skip to content

Commit

Permalink
Thing actions: add type in @ActionInput for generic class
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo committed Oct 3, 2024
1 parent 856d526 commit 94ab43e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public static boolean controlPlug(ThingActions actions, @Nullable String plugNam
@RuleAction(label = "create a vacation", description = "The create vacation function creates a vacation event on the thermostat.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean createVacation(
@ActionInput(name = "name", description = "The vacation event name. It must be unique.") @Nullable String name,
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool vacation hold.") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat vacation hold.") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool vacation hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat vacation hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "startDateTime", description = "(opt) The start date/time in thermostat time.") @Nullable Date startDateTime,
@ActionInput(name = "endDateTime", description = "(opt) The end date in thermostat time.") @Nullable Date endDateTime,
@ActionInput(name = "fan", description = "(opt) The fan mode during the vacation. Values: auto, on Default: auto") @Nullable String fan,
Expand Down Expand Up @@ -276,8 +276,8 @@ public static boolean sendMessage(ThingActions actions, @Nullable String text) {
*/
@RuleAction(label = "set the thermostat into hold", description = "The set hold function sets the thermostat into a hold with the specified temperatures.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean setHold(
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool hold.") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat hold.") @Nullable QuantityType<Temperature> heatHoldTemp) {
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> heatHoldTemp) {
if (coolHoldTemp == null || heatHoldTemp == null) {
throw new IllegalArgumentException("hold temperatures cannot be null");
}
Expand All @@ -297,8 +297,8 @@ public static boolean setHold(ThingActions actions, @Nullable QuantityType<Tempe
*/
@RuleAction(label = "set the thermostat into hold", description = "The set hold function sets the thermostat into a hold for the specified number of hours.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean setHold(
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool hold.") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat hold.") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "coolHoldTemp", description = "The temperature at which to set the cool hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "The temperature at which to set the heat hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "holdHours", description = "The number of hours for the hold.") @Nullable Number holdHours) {
if (coolHoldTemp == null || heatHoldTemp == null) {
throw new IllegalArgumentException("hold temperatures cannot be null");
Expand Down Expand Up @@ -372,8 +372,8 @@ public static boolean setHold(ThingActions actions, @Nullable String holdClimate
*/
@RuleAction(label = "set the thermostat into hold", description = "The set hold function sets the thermostat into a hold with the specified temperature or climate ref.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean setHold(
@ActionInput(name = "coolHoldTemp", description = "(opt) The temperature at which to set the cool hold.") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "(opt) The temperature at which to set the heat hold.") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "coolHoldTemp", description = "(opt) The temperature at which to set the cool hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> coolHoldTemp,
@ActionInput(name = "heatHoldTemp", description = "(opt) The temperature at which to set the heat hold.", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> heatHoldTemp,
@ActionInput(name = "holdClimateRef", description = "(opt) The Climate to use as reference for setting the coolHoldTemp, heatHoldTemp and fan settings for this hold. If this value is passed the coolHoldTemp and heatHoldTemp are not required.") @Nullable String holdClimateRef,
@ActionInput(name = "startDateTime", description = "(opt) The start date in thermostat time.") @Nullable Date startDateTime,
@ActionInput(name = "endDateTime", description = "(opt) The end date in thermostat time.") @Nullable Date endDateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void addHoldBatteryChargeSchedule(ZonedDateTime from, ZonedDateTime until

@RuleAction(label = "@text/actions.force-battery-charging.label", description = "@text/actions.force-battery-charging.description")
public void forceBatteryCharging(
@ActionInput(name = "power", label = "@text/actions.power.label", description = "@text/actions.power.label") QuantityType<Power> power) {
@ActionInput(name = "power", label = "@text/actions.power.label", description = "@text/actions.power.label", type = "QuantityType<Power>") QuantityType<Power> power) {
FroniusSymoInverterHandler handler = this.handler;
if (handler != null) {
handler.forceBatteryCharging(power);
Expand All @@ -149,7 +149,7 @@ public void forceBatteryCharging(
public void addForcedBatteryChargingSchedule(
@ActionInput(name = "from", label = "@text/actions.from.label", description = "@text/actions.from.description") LocalTime from,
@ActionInput(name = "until", label = "@text/actions.until.label", description = "@text/actions.until.description") LocalTime until,
@ActionInput(name = "power", label = "@text/actions.power.label", description = "@text/actions.power.label") QuantityType<Power> power) {
@ActionInput(name = "power", label = "@text/actions.power.label", description = "@text/actions.power.label", type = "QuantityType<Power>") QuantityType<Power> power) {
FroniusSymoInverterHandler handler = this.handler;
if (handler != null) {
handler.addForcedBatteryChargingSchedule(from, until, power);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class SendMailActions implements ThingActions {
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendMailWithAttachments(
@ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text,
@ActionInput(name = "urlList") @Nullable List<String> urlList) {
@ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) {
if (recipient == null) {
logger.warn("Cannot send mail as recipient is missing.");
return false;
Expand Down Expand Up @@ -166,7 +166,7 @@ public static boolean sendMailWithAttachments(ThingActions actions, @Nullable St
@ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject,
@ActionInput(name = "htmlContent") @Nullable String htmlContent,
@ActionInput(name = "urlList") @Nullable List<String> urlList) {
@ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) {
if (recipient == null) {
logger.warn("Cannot send mail as recipient is missing.");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public class TPLinkSmartHomeActions implements ThingActions, ThingHandlerService
private @Nullable SmartHomeHandler handler;

@RuleAction(label = "@text/actions.tplinksmarthome.send.label", description = "@text/actions.tplinksmarthome.send.description")
@ActionOutput(name = "response", label = "@text/actions.tplinksmarthome.send.response.label", description = "@text/actions.tplinksmarthome.send.response.description", type = "java.lang.String")
public String send(
public @ActionOutput(name = "response", label = "@text/actions.tplinksmarthome.send.response.label", description = "@text/actions.tplinksmarthome.send.response.description", type = "java.lang.String") String send(
@ActionInput(name = "command", label = "@text/actions.tplinksmarthome.send.command.label", description = "@text/actions.tplinksmarthome.send.command.description", type = "java.lang.String", required = true) final String command)
throws IOException {
if (handler instanceof SmartHomeHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public static boolean generateVouchers(ThingActions actions, @Nullable Integer c
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean revokeVouchers(
/* @formatter:off */
@ActionInput(name = "voucherCodes", label = "@text/action.unifi.vouchersInputVoucherCodes.label",
description = "@text/action.unifi.vouchersInputVoucherCodes.description") List<String> voucherCodes) {
description = "@text/action.unifi.vouchersInputVoucherCodes.description",
type = "List<String>") List<String> voucherCodes) {
/* @formatter:on */
UniFiSiteThingHandler handler = this.handler;
if (handler == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void setThingHandler(@Nullable ThingHandler handler) {

@RuleAction(label = "override", description = "Overrides the thermostat state for a specified time")
public void setOverride(
@ActionInput(name = "temperature", label = "Temperature") @Nullable QuantityType<Temperature> temperature,
@ActionInput(name = "duration", label = "Duration") @Nullable QuantityType<Time> duration) {
@ActionInput(name = "temperature", label = "Temperature", type = "QuantityType<Temperature>") @Nullable QuantityType<Temperature> temperature,
@ActionInput(name = "duration", label = "Duration", type = "QuantityType<Time>") @Nullable QuantityType<Time> duration) {
logger.debug("setOverride action called");
RoomHandler handler = this.handler;
if (handler != null && temperature != null && duration != null) {
Expand Down

0 comments on commit 94ab43e

Please sign in to comment.