]> git.basschouten.com Git - openhab-addons.git/blob
0adb1f040290c5d7cc2f42ddab3ed8d4f8f5ae34
[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.ThingStatusDetail;
29 import org.openhab.core.types.State;
30
31 /**
32  * The {@link ShellyThingInterface} implements the interface for Shelly Manager to access the thing handler
33  *
34  * @author Markus Michels - Initial contribution
35  */
36 @NonNullByDefault
37 public interface ShellyThingInterface {
38
39     public ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
40
41     public double getChannelDouble(String group, String channel);
42
43     public boolean updateChannel(String group, String channel, State value);
44
45     public boolean updateChannel(String channelId, State value, boolean force);
46
47     public void setThingOnline();
48
49     public void setThingOffline(ThingStatusDetail detail, String messageKey);
50
51     public boolean requestUpdates(int requestCount, boolean refreshSettings);
52
53     public void triggerUpdateFromCoap();
54
55     public void reinitializeThing();
56
57     public void restartWatchdog();
58
59     public void publishState(String channelId, State value);
60
61     public boolean areChannelsCreated();
62
63     public State getChannelValue(String group, String channel);
64
65     public boolean updateInputs(ShellySettingsStatus status);
66
67     public void updateChannelDefinitions(Map<String, Channel> dynChannels);
68
69     public void postEvent(String event, boolean force);
70
71     public void triggerChannel(String group, String channelID, String event);
72
73     public void triggerButton(String group, int idx, String value);
74
75     public ShellyDeviceStats getStats();
76
77     public void resetStats();
78
79     public Thing getThing();
80
81     public String getThingName();
82
83     public ShellyThingConfiguration getThingConfig();
84
85     public HttpClient getHttpClient();
86
87     public String getProperty(String key);
88
89     public void updateProperties(String key, String value);
90
91     public boolean updateWakeupReason(@Nullable List<Object> valueArray);
92
93     public ShellyApiInterface getApi();
94
95     public ShellyDeviceProfile getProfile();
96
97     public long getScheduledUpdates();
98
99     public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
100
101     public boolean checkRepresentation(String key);
102 }