2 * Copyright (c) 2010-2022 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.ThingStatusDetail;
29 import org.openhab.core.types.State;
32 * The {@link ShellyThingInterface} implements the interface for Shelly Manager to access the thing handler
34 * @author Markus Michels - Initial contribution
37 public interface ShellyThingInterface {
39 public ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
41 public double getChannelDouble(String group, String channel);
43 public boolean updateChannel(String group, String channel, State value);
45 public boolean updateChannel(String channelId, State value, boolean force);
47 public void setThingOnline();
49 public void setThingOffline(ThingStatusDetail detail, String messageKey);
51 public boolean requestUpdates(int requestCount, boolean refreshSettings);
53 public void triggerUpdateFromCoap();
55 public void reinitializeThing();
57 public void restartWatchdog();
59 public void publishState(String channelId, State value);
61 public boolean areChannelsCreated();
63 public State getChannelValue(String group, String channel);
65 public boolean updateInputs(ShellySettingsStatus status);
67 public void updateChannelDefinitions(Map<String, Channel> dynChannels);
69 public void postEvent(String event, boolean force);
71 public void triggerChannel(String group, String channelID, String event);
73 public void triggerButton(String group, int idx, String value);
75 public ShellyDeviceStats getStats();
77 public void resetStats();
79 public Thing getThing();
81 public String getThingName();
83 public ShellyThingConfiguration getThingConfig();
85 public HttpClient getHttpClient();
87 public String getProperty(String key);
89 public void updateProperties(String key, String value);
91 public boolean updateWakeupReason(@Nullable List<Object> valueArray);
93 public ShellyApiInterface getApi();
95 public ShellyDeviceProfile getProfile();
97 public long getScheduledUpdates();
99 public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
101 public boolean checkRepresentation(String key);