]> git.basschouten.com Git - openhab-addons.git/blob
b7a28f9fbb2b504fa90192dd406adc55642403c5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.shelly.internal.handler;
14
15 import java.util.List;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.eclipse.jetty.client.HttpClient;
21 import org.openhab.binding.shelly.internal.api.ShellyApiException;
22 import org.openhab.binding.shelly.internal.api.ShellyApiInterface;
23 import org.openhab.binding.shelly.internal.api.ShellyDeviceProfile;
24 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsStatus;
25 import org.openhab.binding.shelly.internal.config.ShellyThingConfiguration;
26 import org.openhab.core.thing.Channel;
27 import org.openhab.core.thing.Thing;
28 import org.openhab.core.thing.ThingStatus;
29 import org.openhab.core.thing.ThingStatusDetail;
30 import org.openhab.core.thing.type.ChannelTypeUID;
31 import org.openhab.core.types.State;
32 import org.openhab.core.types.StateOption;
33
34 /**
35  * The {@link ShellyThingInterface} implements the interface for Shelly Manager to access the thing handler
36  *
37  * @author Markus Michels - Initial contribution
38  */
39 @NonNullByDefault
40 public interface ShellyThingInterface {
41
42     public ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
43
44     public List<StateOption> getStateOptions(ChannelTypeUID uid);
45
46     public double getChannelDouble(String group, String channel);
47
48     public boolean updateChannel(String group, String channel, State value);
49
50     public boolean updateChannel(String channelId, State value, boolean force);
51
52     public void setThingOnline();
53
54     public void setThingOffline(ThingStatusDetail detail, String messageKey);
55
56     public ThingStatus getThingStatus();
57
58     public ThingStatusDetail getThingStatusDetail();
59
60     public boolean isThingOnline();
61
62     public boolean requestUpdates(int requestCount, boolean refreshSettings);
63
64     public void triggerUpdateFromCoap();
65
66     public void reinitializeThing();
67
68     public void restartWatchdog();
69
70     public void publishState(String channelId, State value);
71
72     public boolean areChannelsCreated();
73
74     public State getChannelValue(String group, String channel);
75
76     public boolean updateInputs(ShellySettingsStatus status);
77
78     public void updateChannelDefinitions(Map<String, Channel> dynChannels);
79
80     public void postEvent(String event, boolean force);
81
82     public void triggerChannel(String group, String channelID, String event);
83
84     public void triggerButton(String group, int idx, String value);
85
86     public ShellyDeviceStats getStats();
87
88     public void resetStats();
89
90     public Thing getThing();
91
92     public String getThingName();
93
94     public ShellyThingConfiguration getThingConfig();
95
96     public HttpClient getHttpClient();
97
98     public String getProperty(String key);
99
100     public void updateProperties(String key, String value);
101
102     public boolean updateWakeupReason(@Nullable List<Object> valueArray);
103
104     public ShellyApiInterface getApi();
105
106     public ShellyDeviceProfile getProfile();
107
108     public long getScheduledUpdates();
109
110     public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
111
112     public boolean checkRepresentation(String key);
113 }