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.freeboxos.internal.action;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.freeboxos.internal.handler.ActivePlayerHandler;
17 import org.openhab.binding.freeboxos.internal.handler.PlayerHandler;
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.osgi.service.component.annotations.Component;
22 import org.osgi.service.component.annotations.ServiceScope;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
27 * The {ActivePlayerActions} class is responsible to call corresponding actions on Freebox Player with API
29 * @author Gaƫl L'hopital - Initial contribution
31 @Component(scope = ServiceScope.PROTOTYPE, service = ActivePlayerActions.class)
32 @ThingActionsScope(name = "freeboxos")
34 public class ActivePlayerActions extends PlayerActions {
35 private final Logger logger = LoggerFactory.getLogger(ActivePlayerActions.class);
37 @RuleAction(label = "reboot freebox player", description = "Reboots the Freebox Player")
38 public void reboot() {
39 logger.debug("Player reboot called");
40 PlayerHandler localHandler = this.handler;
41 if (localHandler instanceof ActivePlayerHandler apHandler) {
44 logger.warn("Freebox Player Action service ThingHandler is null");
48 public static void reboot(ThingActions actions) {
49 ((ActivePlayerActions) actions).reboot();