]> git.basschouten.com Git - openhab-addons.git/blob
b6359bfa6dc26d06a9d9bdf4c8a07d416ed5b05f
[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.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 @Nullable 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, Object... arguments);
55
56     public String getThingType();
57
58     public ThingStatus getThingStatus();
59
60     public ThingStatusDetail getThingStatusDetail();
61
62     public boolean isThingOnline();
63
64     public boolean requestUpdates(int requestCount, boolean refreshSettings);
65
66     public void triggerUpdateFromCoap();
67
68     public void reinitializeThing();
69
70     public void restartWatchdog();
71
72     public void publishState(String channelId, State value);
73
74     public boolean areChannelsCreated();
75
76     public State getChannelValue(String group, String channel);
77
78     public boolean updateInputs(ShellySettingsStatus status);
79
80     public void updateChannelDefinitions(Map<String, Channel> dynChannels);
81
82     public void postEvent(String event, boolean force);
83
84     public void triggerChannel(String group, String channelID, String event);
85
86     public void triggerButton(String group, int idx, String value);
87
88     public ShellyDeviceStats getStats();
89
90     public void resetStats();
91
92     public Thing getThing();
93
94     public String getThingName();
95
96     public ShellyThingConfiguration getThingConfig();
97
98     public HttpClient getHttpClient();
99
100     public String getProperty(String key);
101
102     public void updateProperties(String key, String value);
103
104     public boolean updateWakeupReason(@Nullable List<Object> valueArray);
105
106     public ShellyApiInterface getApi();
107
108     public ShellyDeviceProfile getProfile();
109
110     public long getScheduledUpdates();
111
112     public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
113
114     public boolean checkRepresentation(String key);
115
116     public void incProtMessages();
117
118     public void incProtErrors();
119 }