2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.shelly.internal.handler;
15 import java.util.List;
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;
35 * The {@link ShellyThingInterface} implements the interface for Shelly Manager to access the thing handler
37 * @author Markus Michels - Initial contribution
40 public interface ShellyThingInterface {
42 public ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
44 public @Nullable List<StateOption> getStateOptions(ChannelTypeUID uid);
46 public double getChannelDouble(String group, String channel);
48 public boolean updateChannel(String group, String channel, State value);
50 public boolean updateChannel(String channelId, State value, boolean force);
52 public void setThingOnline();
54 public void setThingOffline(ThingStatusDetail detail, String messageKey, Object... arguments);
56 public String getThingType();
58 public ThingStatus getThingStatus();
60 public ThingStatusDetail getThingStatusDetail();
62 public boolean isThingOnline();
64 public boolean requestUpdates(int requestCount, boolean refreshSettings);
66 public void triggerUpdateFromCoap();
68 public void reinitializeThing();
70 public void restartWatchdog();
72 public void publishState(String channelId, State value);
74 public boolean areChannelsCreated();
76 public State getChannelValue(String group, String channel);
78 public boolean updateInputs(ShellySettingsStatus status);
80 public void updateChannelDefinitions(Map<String, Channel> dynChannels);
82 public void postEvent(String event, boolean force);
84 public void triggerChannel(String group, String channelID, String event);
86 public void triggerButton(String group, int idx, String value);
88 public ShellyDeviceStats getStats();
90 public void resetStats();
92 public Thing getThing();
94 public String getThingName();
96 public ShellyThingConfiguration getThingConfig();
98 public HttpClient getHttpClient();
100 public String getProperty(String key);
102 public void updateProperties(String key, String value);
104 public boolean updateWakeupReason(@Nullable List<Object> valueArray);
106 public ShellyApiInterface getApi();
108 public ShellyDeviceProfile getProfile();
110 public long getScheduledUpdates();
112 public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
114 public boolean checkRepresentation(String key);
116 public void incProtMessages();
118 public void incProtErrors();