diff --git a/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/action/DBQueryActions.java b/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/action/DBQueryActions.java index 04c650cf35e93..db7b9b529b789 100644 --- a/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/action/DBQueryActions.java +++ b/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/action/DBQueryActions.java @@ -26,6 +26,7 @@ import org.openhab.binding.dbquery.internal.domain.ResultRow; import org.openhab.binding.dbquery.internal.error.UnnexpectedCondition; 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.thing.binding.ThingActions; import org.openhab.core.thing.binding.ThingActionsScope; @@ -49,8 +50,10 @@ public class DBQueryActions implements IDBQueryActions, ThingActions { @Override @RuleAction(label = "Execute query", description = "Execute query synchronously (use with care)") - public ActionQueryResult executeQuery(String query, Map parameters, - int timeoutInSeconds) { + public @ActionOutput(label = "Result", type = "org.openhab.binding.dbquery.action.ActionQueryResult") ActionQueryResult executeQuery( + @ActionInput(name = "query") String query, + @ActionInput(name = "parameters") Map parameters, + @ActionInput(name = "timeoutInSeconds") int timeoutInSeconds) { logger.debug("executeQuery from action {} params={}", query, parameters); var currentDatabaseBridgeHandler = databaseBridgeHandler; if (currentDatabaseBridgeHandler != null) { @@ -91,7 +94,7 @@ public void setQueryParameters(@ActionInput(name = "parameters") Map parameters, int timeoutInSeconds) { + return ((DBQueryActions) actions).executeQuery(query, parameters, timeoutInSeconds); + } + + public static void setQueryParameters(ThingActions actions, Map parameters) { + ((DBQueryActions) actions).setQueryParameters(parameters); + } + + public static ActionQueryResult getLastQueryResult(ThingActions actions) { + return ((DBQueryActions) actions).getLastQueryResult(); + } + @Override public void setThingHandler(ThingHandler thingHandler) { if (thingHandler instanceof QueryHandler queryHandler) {