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