]> git.basschouten.com Git - openhab-addons.git/commitdiff
[solarforecast] Add missing @ActionOutput annotation (#17506)
authorlolodomo <lg.hc@free.fr>
Fri, 4 Oct 2024 19:48:14 +0000 (21:48 +0200)
committerGitHub <noreply@github.com>
Fri, 4 Oct 2024 19:48:14 +0000 (21:48 +0200)
* [solarforecast] Add missing @ActionOutput annotation

Related to #17504

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.solarforecast/README.md
bundles/org.openhab.binding.solarforecast/src/main/java/org/openhab/binding/solarforecast/internal/actions/SolarForecastActions.java

index 2cfbd214fea87fc9b4f9a82d1c044fad7cd8d0d7..cea845e0b57b1673bfee14ad3cee04f0f6ba693c 100644 (file)
@@ -197,7 +197,7 @@ Check log or catch exceptions for error handling
 - `IllegalArgumentException` thrown in case of problems with call arguments
 - `SolarForecastException` thrown in case of problems with timestamp and available forecast data
 
-### `getDay`
+### `getEnergyOfDay`
 
 | Parameter | Type          | Description                                                                                |
 |-----------|---------------|--------------------------------------------------------------------------------------------|
@@ -310,7 +310,7 @@ rule "Tomorrow Forecast Calculation"
         Item ForecastSolarHome_Today received update
     then
         val solarforecastActions = getActions("solarforecast","solarforecast:fs-site:homeSite")
-        val energyState = solarforecastActions.getDay(LocalDate.now.plusDays(1))
+        val energyState = solarforecastActions.getEnergyOfDay(LocalDate.now.plusDays(1))
         logInfo("SF Tests","{}",energyState)
         ForecastSolarHome_Tomorrow.postUpdate(energyState)
 end
index 43ca9be321a6880cced0016bd10c6f50cfde36f9..d80177d85cf18211b0fbe8deb30db367539fd608 100644 (file)
@@ -26,13 +26,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.solarforecast.internal.utils.Utils;
 import org.openhab.core.automation.annotation.ActionInput;
+import org.openhab.core.automation.annotation.ActionOutput;
 import org.openhab.core.automation.annotation.RuleAction;
 import org.openhab.core.library.types.QuantityType;
 import org.openhab.core.library.unit.Units;
 import org.openhab.core.thing.binding.ThingActions;
 import org.openhab.core.thing.binding.ThingActionsScope;
 import org.openhab.core.thing.binding.ThingHandler;
-import org.openhab.core.types.State;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,9 +48,9 @@ public class SolarForecastActions implements ThingActions {
     private Optional<ThingHandler> thingHandler = Optional.empty();
 
     @RuleAction(label = "@text/actionDayLabel", description = "@text/actionDayDesc")
-    public QuantityType<Energy> getDay(
+    public @ActionOutput(name = "getEnergyOfDay", type = "QuantityType<Energy>") QuantityType<Energy> getEnergyOfDay(
             @ActionInput(name = "localDate", label = "@text/actionInputDayLabel", description = "@text/actionInputDayDesc") LocalDate localDate,
-            String... args) {
+            @ActionInput(name = "args") String... args) {
         if (thingHandler.isPresent()) {
             List<SolarForecast> l = ((SolarForecastProvider) thingHandler.get()).getSolarForecasts();
             if (!l.isEmpty()) {
@@ -78,9 +78,9 @@ public class SolarForecastActions implements ThingActions {
     }
 
     @RuleAction(label = "@text/actionPowerLabel", description = "@text/actionPowerDesc")
-    public QuantityType<Power> getPower(
+    public @ActionOutput(name = "getPower", type = "QuantityType<Power>") QuantityType<Power> getPower(
             @ActionInput(name = "timestamp", label = "@text/actionInputDateTimeLabel", description = "@text/actionInputDateTimeDesc") Instant timestamp,
-            String... args) {
+            @ActionInput(name = "args") String... args) {
         if (thingHandler.isPresent()) {
             List<SolarForecast> l = ((SolarForecastProvider) thingHandler.get()).getSolarForecasts();
             if (!l.isEmpty()) {
@@ -108,10 +108,10 @@ public class SolarForecastActions implements ThingActions {
     }
 
     @RuleAction(label = "@text/actionEnergyLabel", description = "@text/actionEnergyDesc")
-    public QuantityType<Energy> getEnergy(
+    public @ActionOutput(name = "getEnergy", type = "QuantityType<Energy>") QuantityType<Energy> getEnergy(
             @ActionInput(name = "start", label = "@text/actionInputDateTimeBeginLabel", description = "@text/actionInputDateTimeBeginDesc") Instant start,
             @ActionInput(name = "end", label = "@text/actionInputDateTimeEndLabel", description = "@text/actionInputDateTimeEndDesc") Instant end,
-            String... args) {
+            @ActionInput(name = "args") String... args) {
         if (thingHandler.isPresent()) {
             List<SolarForecast> l = ((SolarForecastProvider) thingHandler.get()).getSolarForecasts();
             if (!l.isEmpty()) {
@@ -139,7 +139,7 @@ public class SolarForecastActions implements ThingActions {
     }
 
     @RuleAction(label = "@text/actionForecastBeginLabel", description = "@text/actionForecastBeginDesc")
-    public Instant getForecastBegin() {
+    public @ActionOutput(name = "getForecastBegin", type = "java.time.Instant") Instant getForecastBegin() {
         if (thingHandler.isPresent()) {
             List<SolarForecast> forecastObjectList = ((SolarForecastProvider) thingHandler.get()).getSolarForecasts();
             return Utils.getCommonStartTime(forecastObjectList);
@@ -150,7 +150,7 @@ public class SolarForecastActions implements ThingActions {
     }
 
     @RuleAction(label = "@text/actionForecastEndLabel", description = "@text/actionForecastEndDesc")
-    public Instant getForecastEnd() {
+    public @ActionOutput(name = "getForecastEnd", type = "java.time.Instant") Instant getForecastEnd() {
         if (thingHandler.isPresent()) {
             List<SolarForecast> forecastObjectList = ((SolarForecastProvider) thingHandler.get()).getSolarForecasts();
             return Utils.getCommonEndTime(forecastObjectList);
@@ -172,15 +172,15 @@ public class SolarForecastActions implements ThingActions {
         }
     }
 
-    public static State getDay(ThingActions actions, LocalDate ld, String... args) {
-        return ((SolarForecastActions) actions).getDay(ld, args);
+    public static QuantityType<Energy> getEnergyOfDay(ThingActions actions, LocalDate ld, String... args) {
+        return ((SolarForecastActions) actions).getEnergyOfDay(ld, args);
     }
 
-    public static State getPower(ThingActions actions, Instant dateTime, String... args) {
+    public static QuantityType<Power> getPower(ThingActions actions, Instant dateTime, String... args) {
         return ((SolarForecastActions) actions).getPower(dateTime, args);
     }
 
-    public static State getEnergy(ThingActions actions, Instant begin, Instant end, String... args) {
+    public static QuantityType<Energy> getEnergy(ThingActions actions, Instant begin, Instant end, String... args) {
         return ((SolarForecastActions) actions).getEnergy(begin, end, args);
     }