]> git.basschouten.com Git - openhab-addons.git/blob
33de99da299d5cb95bda9a089e7a6be43c4f90d6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mielecloud.internal.handler.channel;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.mielecloud.internal.webservice.api.ActionsState;
17 import org.openhab.core.library.types.OnOffType;
18 import org.openhab.core.types.State;
19
20 /**
21  * Wrapper for {@link ActionsState} handling the type conversion to {@link State} for directly filling channels.
22  *
23  * @author Björn Lange - Initial Contribution
24  */
25 @NonNullByDefault
26 public final class ActionsChannelState {
27     private final ActionsState actions;
28
29     public ActionsChannelState(ActionsState actions) {
30         this.actions = actions;
31     }
32
33     public State getRemoteControlCanBeSwitchedOn() {
34         return OnOffType.from(actions.canBeSwitchedOn());
35     }
36
37     public State getRemoteControlCanBeSwitchedOff() {
38         return OnOffType.from(actions.canBeSwitchedOff());
39     }
40
41     public State getLightCanBeControlled() {
42         return OnOffType.from(actions.canControlLight());
43     }
44
45     public State getSuperCoolCanBeControlled() {
46         return OnOffType.from(actions.canContolSupercooling());
47     }
48
49     public State getSuperFreezeCanBeControlled() {
50         return OnOffType.from(actions.canControlSuperfreezing());
51     }
52
53     public State getRemoteControlCanBeStarted() {
54         return OnOffType.from(actions.canBeStarted());
55     }
56
57     public State getRemoteControlCanBeStopped() {
58         return OnOffType.from(actions.canBeStopped());
59     }
60
61     public State getRemoteControlCanBePaused() {
62         return OnOffType.from(actions.canBePaused());
63     }
64
65     public State getRemoteControlCanSetProgramActive() {
66         return OnOffType.from(actions.canSetActiveProgramId());
67     }
68 }