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 ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
45 List<StateOption> getStateOptions(ChannelTypeUID uid);
47 double getChannelDouble(String group, String channel);
49 boolean updateChannel(String group, String channel, State value);
51 boolean updateChannel(String channelId, State value, boolean force);
53 void setThingOnline();
55 void setThingOffline(ThingStatusDetail detail, String messageKey, Object... arguments);
59 String getThingType();
61 ThingStatus getThingStatus();
63 ThingStatusDetail getThingStatusDetail();
65 boolean isThingOnline();
67 boolean requestUpdates(int requestCount, boolean refreshSettings);
69 void triggerUpdateFromCoap();
71 void reinitializeThing();
73 void restartWatchdog();
75 void publishState(String channelId, State value);
77 boolean areChannelsCreated();
79 State getChannelValue(String group, String channel);
81 boolean updateInputs(ShellySettingsStatus status);
83 void updateChannelDefinitions(Map<String, Channel> dynChannels);
85 void postEvent(String event, boolean force);
87 void triggerChannel(String group, String channelID, String event);
89 void triggerButton(String group, int idx, String value);
91 ShellyDeviceStats getStats();
97 String getThingName();
99 ShellyThingConfiguration getThingConfig();
101 HttpClient getHttpClient();
103 String getProperty(String key);
105 void updateProperties(String key, String value);
107 boolean updateWakeupReason(@Nullable List<Object> valueArray);
109 ShellyApiInterface getApi();
111 ShellyDeviceProfile getProfile();
113 long getScheduledUpdates();
115 void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
117 boolean checkRepresentation(String key);
119 void incProtMessages();
121 void incProtErrors();