Thing actions: add type in @ActionInput for generic class (#17501)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lolodomo 2024-10-05 14:49:18 +02:00 committed by Ciprian Pascu
parent 832ba7e3ea
commit 3be45b9c8d
6 changed files with 17 additions and 17 deletions

View File

@ -152,8 +152,8 @@ public class EcobeeActions implements ThingActions {
@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,
@ -276,8 +276,8 @@ public class EcobeeActions implements ThingActions {
*/
@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");
}
@ -297,8 +297,8 @@ public class EcobeeActions implements ThingActions {
*/
@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");
@ -372,8 +372,8 @@ public class EcobeeActions implements ThingActions {
*/
@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,

View File

@ -138,7 +138,7 @@ public class FroniusSymoInverterActions implements ThingActions {
@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);
@ -149,7 +149,7 @@ public class FroniusSymoInverterActions implements ThingActions {
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);

View File

@ -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;
@ -166,7 +166,7 @@ public class SendMailActions implements ThingActions {
@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;

View File

@ -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) {

View File

@ -177,7 +177,8 @@ public class UniFiSiteActions implements ThingActions {
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) {

View File

@ -56,8 +56,8 @@ public class WarmupActions implements ThingActions {
@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) {