2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.yioremote.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.automation.annotation.ActionInput;
18 import org.openhab.core.automation.annotation.RuleAction;
19 import org.openhab.core.thing.binding.ThingActions;
20 import org.openhab.core.thing.binding.ThingActionsScope;
21 import org.openhab.core.thing.binding.ThingHandler;
24 * The {@link YIOremoteDockActions} is responsible for handling the action commands
27 * @author Michael Loercher - Initial contribution
29 @ThingActionsScope(name = "yioremote")
31 public class YIOremoteDockActions implements ThingActions {
32 private @Nullable YIOremoteDockHandler dockHandler;
35 public void setThingHandler(@Nullable ThingHandler yiremotedockhandler) {
36 dockHandler = (YIOremoteDockHandler) yiremotedockhandler;
40 public @Nullable ThingHandler getThingHandler() {
44 @RuleAction(label = "@text/actionLabel", description = "@text/actionDesc")
45 public void sendIRCode(
46 @ActionInput(name = "IRCode", label = "@text/actionInputTopicLabel", description = "@text/actionInputTopicDesc") @Nullable String irCode) {
47 YIOremoteDockHandler dockHandlerLocal = dockHandler;
48 if (dockHandlerLocal != null) {
49 dockHandlerLocal.sendIRCode(irCode);
53 public static void sendIRCode(ThingActions actions, @Nullable String irCode) {
54 ((YIOremoteDockActions) actions).sendIRCode(irCode);