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;
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()) {
}
@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()) {
}
@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()) {
}
@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);
}
@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);
}
}
- 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);
}