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.openhab.binding.shelly.internal.api.ShellyApiException;
21 import org.openhab.binding.shelly.internal.api.ShellyApiInterface;
22 import org.openhab.binding.shelly.internal.api.ShellyApiJsonDTO.ShellySettingsStatus;
23 import org.openhab.binding.shelly.internal.api.ShellyDeviceProfile;
24 import org.openhab.binding.shelly.internal.config.ShellyThingConfiguration;
25 import org.openhab.core.thing.Channel;
26 import org.openhab.core.thing.Thing;
27 import org.openhab.core.thing.ThingStatusDetail;
28 import org.openhab.core.types.State;
31 * The {@link ShellyThingInterface} implements the interface for Shelly Manager to access the thing handler
33 * @author Markus Michels - Initial contribution
36 public interface ShellyThingInterface {
38 public ShellyDeviceProfile getProfile(boolean forceRefresh) throws ShellyApiException;
40 public double getChannelDouble(String group, String channel);
42 public boolean updateChannel(String group, String channel, State value);
44 public boolean updateChannel(String channelId, State value, boolean force);
46 public void setThingOnline();
48 public void setThingOffline(ThingStatusDetail detail, String messageKey);
50 public boolean requestUpdates(int requestCount, boolean refreshSettings);
52 public void triggerUpdateFromCoap();
54 public void reinitializeThing();
56 public void restartWatchdog();
58 public void publishState(String channelId, State value);
60 public boolean areChannelsCreated();
62 public State getChannelValue(String group, String channel);
64 public boolean updateInputs(ShellySettingsStatus status);
66 public void updateChannelDefinitions(Map<String, Channel> dynChannels);
68 public void postEvent(String event, boolean force);
70 public void triggerChannel(String group, String channelID, String event);
72 public void triggerButton(String group, int idx, String value);
74 public ShellyDeviceStats getStats();
76 public void resetStats();
78 public Thing getThing();
80 public String getThingName();
82 public ShellyThingConfiguration getThingConfig();
84 public String getProperty(String key);
86 public void updateProperties(String key, String value);
88 public boolean updateWakeupReason(@Nullable List<Object> valueArray);
90 public ShellyApiInterface getApi();
92 public ShellyDeviceProfile getProfile();
94 public long getScheduledUpdates();
96 public void fillDeviceStatus(ShellySettingsStatus status, boolean updated);
98 public boolean checkRepresentation(String key);