2 * Copyright (c) 2010-2024 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.api2;
15 import java.util.ArrayList;
17 import org.openhab.binding.shelly.internal.api2.Shelly2ApiJsonDTO.Shelly2DevConfigBle.Shelly2DevConfigBleObserver;
18 import org.openhab.binding.shelly.internal.api2.Shelly2ApiJsonDTO.Shelly2DevConfigBle.Shelly2DevConfigBleRpc;
19 import org.openhab.binding.shelly.internal.api2.Shelly2ApiJsonDTO.Shelly2DeviceStatus.Shelly2DeviceStatusResult;
20 import org.openhab.binding.shelly.internal.api2.Shelly2ApiJsonDTO.Shelly2RpcBaseMessage.Shelly2RpcMessageError;
22 import com.google.gson.annotations.SerializedName;
25 * {@link Shelly2ApiJsonDTO} wraps the Shelly REST API and provides various low level function to access the device api
29 * @author Markus Michels - Initial contribution
31 public class Shelly2ApiJsonDTO {
32 public static final String SHELLYRPC_ENDPOINT = "/rpc";
34 public static final String SHELLYRPC_METHOD_CLASS_SHELLY = "Shelly";
35 public static final String SHELLYRPC_METHOD_CLASS_SWITCH = "Switch";
37 public static final String SHELLYRPC_METHOD_GETDEVCONFIG = "GetDeviceInfo";
38 public static final String SHELLYRPC_METHOD_GETSYSCONFIG = "GetSysConfig"; // only sys
39 public static final String SHELLYRPC_METHOD_GETCONFIG = "GetConfig"; // sys + components
40 public static final String SHELLYRPC_METHOD_GETSYSSTATUS = "GetSysStatus"; // only sys
41 public static final String SHELLYRPC_METHOD_GETSTATUS = "GetStatus"; // sys + components
42 public static final String SHELLYRPC_METHOD_REBOOT = "Shelly.Reboot";
43 public static final String SHELLYRPC_METHOD_RESET = "Shelly.FactoryReset";
44 public static final String SHELLYRPC_METHOD_CHECKUPD = "Shelly.CheckForUpdate";
45 public static final String SHELLYRPC_METHOD_UPDATE = "Shelly.Update";
46 public static final String SHELLYRPC_METHOD_AUTHSET = "Shelly.SetAuth";
47 public static final String SHELLYRPC_METHOD_SWITCH_STATUS = "Switch.GetStatus";
48 public static final String SHELLYRPC_METHOD_SWITCH_SET = "Switch.Set";
49 public static final String SHELLYRPC_METHOD_SWITCH_SETCONFIG = "Switch.SetConfig";
50 public static final String SHELLYRPC_METHOD_COVER_SETPOS = "Cover.GoToPosition";
51 public static final String SHELLY2_COVER_CMD_OPEN = "Open";
52 public static final String SHELLY2_COVER_CMD_CLOSE = "Close";
53 public static final String SHELLY2_COVER_CMD_STOP = "Stop";
54 public static final String SHELLYRPC_METHOD_LIGHT_STATUS = "Light.GetStatus";
55 public static final String SHELLYRPC_METHOD_LIGHT_SET = "Light.Set";
56 public static final String SHELLYRPC_METHOD_LIGHT_SETCONFIG = "Light.SetConfig";
57 public static final String SHELLYRPC_METHOD_LED_SETCONFIG = "WD_UI.SetConfig";
58 public static final String SHELLYRPC_METHOD_WIFIGETCONG = "Wifi.GetConfig";
59 public static final String SHELLYRPC_METHOD_WIFISETCONG = "Wifi.SetConfig";
60 public static final String SHELLYRPC_METHOD_WIFILISTAPCLIENTS = "WiFi.ListAPClients";
61 public static final String SHELLYRPC_METHOD_ETHGETCONG = "Eth.GetConfig";
62 public static final String SHELLYRPC_METHOD_ETHSETCONG = "Eth.SetConfig";
63 public static final String SHELLYRPC_METHOD_BLEGETCONG = "BLE.GetConfig";
64 public static final String SHELLYRPC_METHOD_BLESETCONG = "BLE.SetConfig";
65 public static final String SHELLYRPC_METHOD_CLOUDSET = "Cloud.SetConfig";
66 public static final String SHELLYRPC_METHOD_WSGETCONFIG = "WS.GetConfig";
67 public static final String SHELLYRPC_METHOD_WSSETCONFIG = "WS.SetConfig";
68 public static final String SHELLYRPC_METHOD_EMDATARESET = "EMData.DeleteAllData";
69 public static final String SHELLYRPC_METHOD_EM1DATARESET = "EM1Data.DeleteAllData";
70 public static final String SHELLYRPC_METHOD_SMOKE_SETCONFIG = "Smoke.SetConfig";
71 public static final String SHELLYRPC_METHOD_SMOKE_MUTE = "Smoke.Mute";
72 public static final String SHELLYRPC_METHOD_SCRIPT_LIST = "Script.List";
73 public static final String SHELLYRPC_METHOD_SCRIPT_SETCONFIG = "Script.SetConfig";
74 public static final String SHELLYRPC_METHOD_SCRIPT_GETSTATUS = "Script.GetStatus";
75 public static final String SHELLYRPC_METHOD_SCRIPT_DELETE = "Script.Delete";
76 public static final String SHELLYRPC_METHOD_SCRIPT_CREATE = "Script.Create";
77 public static final String SHELLYRPC_METHOD_SCRIPT_GETCODE = "Script.GetCode";
78 public static final String SHELLYRPC_METHOD_SCRIPT_PUTCODE = "Script.PutCode";
79 public static final String SHELLYRPC_METHOD_SCRIPT_START = "Script.Start";
80 public static final String SHELLYRPC_METHOD_SCRIPT_STOP = "Script.Stop";
82 public static final String SHELLYRPC_METHOD_NOTIFYSTATUS = "NotifyStatus"; // inbound status
83 public static final String SHELLYRPC_METHOD_NOTIFYFULLSTATUS = "NotifyFullStatus"; // inbound status from bat device
84 public static final String SHELLYRPC_METHOD_NOTIFYEVENT = "NotifyEvent"; // inbound event
87 public static final String SHELLY2_PROFILE_RELAY = "switch";
88 public static final String SHELLY2_PROFILE_COVER = "cover";
91 public static final String SHELLY2_BTNT_MOMENTARY = "momentary";
92 public static final String SHELLY2_BTNT_FLIP = "flip";
93 public static final String SHELLY2_BTNT_FOLLOW = "follow";
94 public static final String SHELLY2_BTNT_DETACHED = "detached";
97 public static final String SHELLY2_INPUTT_SWITCH = "switch";
98 public static final String SHELLY2_INPUTT_BUTTON = "button";
99 public static final String SHELLY2_INPUTT_ANALOG = "analog"; // Shelly Addon: analogous input
102 public static final String SHELLY2_API_MODE_DETACHED = "detached";
103 public static final String SHELLY2_API_MODE_FOLLOW = "follow";
105 // Initial switch states
106 public static final String SHELLY2_API_ISTATE_ON = "on";
107 public static final String SHELLY2_API_ISTATE_OFF = "off";
108 public static final String SHELLY2_API_ISTATE_FOLLOWLAST = "restore_last";
109 public static final String SHELLY2_API_ISTATE_MATCHINPUT = "match_input";
111 // Cover/Roller modes
112 public static final String SHELLY2_RMODE_SINGLE = "single";
113 public static final String SHELLY2_RMODE_DUAL = "dual";
114 public static final String SHELLY2_RMODE_DETACHED = "detached";
116 public static final String SHELLY2_RSTATE_OPENING = "opening";
117 public static final String SHELLY2_RSTATE_OPEN = "open";
118 public static final String SHELLY2_RSTATE_CLOSING = "closing";
119 public static final String SHELLY2_RSTATE_CLOSED = "closed";
120 public static final String SHELLY2_RSTATE_STOPPED = "stopped";
121 public static final String SHELLY2_RSTATE_CALIB = "calibrating";
123 // Event notifications
124 public static final String SHELLY2_EVENT_BTNUP = "btn_up";
125 public static final String SHELLY2_EVENT_BTNDOWN = "btn_down";
126 public static final String SHELLY2_EVENT_1PUSH = "single_push";
127 public static final String SHELLY2_EVENT_2PUSH = "double_push";
128 public static final String SHELLY2_EVENT_3PUSH = "triple_push";
129 public static final String SHELLY2_EVENT_LPUSH = "long_push";
130 public static final String SHELLY2_EVENT_SLPUSH = "short_long_push";
131 public static final String SHELLY2_EVENT_LSPUSH = "long_short_push";
133 public static final String SHELLY2_EVENT_SLEEP = "sleep";
134 public static final String SHELLY2_EVENT_CFGCHANGED = "config_changed";
135 public static final String SHELLY2_EVENT_OTASTART = "ota_begin";
136 public static final String SHELLY2_EVENT_OTAPROGRESS = "ota_progress";
137 public static final String SHELLY2_EVENT_OTADONE = "ota_success";
138 public static final String SHELLY2_EVENT_WIFICONNFAILED = "sta_connect_fail";
139 public static final String SHELLY2_EVENT_WIFIDISCONNECTED = "sta_disconnected";
142 public static final String SHELLY2_BLU_GWSCRIPT = "oh-blu-scanner.js";
143 public static final String SHELLY2_EVENT_BLUPREFIX = "oh-blu.";
144 public static final String SHELLY2_EVENT_BLUSCAN = SHELLY2_EVENT_BLUPREFIX + "scan_result";
145 public static final String SHELLY2_EVENT_BLUDATA = SHELLY2_EVENT_BLUPREFIX + "data";
148 public static final String SHELLY2_ERROR_OVERPOWER = "overpower";
149 public static final String SHELLY2_ERROR_OVERTEMP = "overtemp";
150 public static final String SHELLY2_ERROR_OVERVOLTAGE = "overvoltage";
152 // Wakeup reasons (e.g. Plus HT)
153 public static final String SHELLY2_WAKEUPO_BOOT_POWERON = "poweron";
154 public static final String SHELLY2_WAKEUPO_BOOT_RESTART = "software_restart";
155 public static final String SHELLY2_WAKEUPO_BOOT_WAKEUP = "deepsleep_wake";
156 public static final String SHELLY2_WAKEUPO_BOOT_INTERNAL = "internal";
157 public static final String SHELLY2_WAKEUPO_BOOT_UNKNOWN = "unknown";
159 public static final String SHELLY2_WAKEUPOCAUSE_BUTTON = "button";
160 public static final String SHELLY2_WAKEUPOCAUSE_USB = "usb";
161 public static final String SHELLY2_WAKEUPOCAUSE_PERIODIC = "periodic";
162 public static final String SHELLY2_WAKEUPOCAUSE_UPDATE = "status_update";
163 public static final String SHELLY2_WAKEUPOCAUSE_UNDEFINED = "undefined";
165 // Dimmer US: LED power modes
166 public static final String SHELLY2_POWERLED_ON = "on";
167 public static final String SHELLY2_POWERLED_OFF = "off";
168 public static final String SHELLY2_POWERLED_MATCH = "match_output";
169 public static final String SHELLY2_POWERLED_INVERT = "inverted_output";
171 public static class Shelly2DevConfigBle {
172 public static class Shelly2DevConfigBleRpc {
173 public Boolean enable;
176 public static class Shelly2DevConfigBleObserver {
177 public Boolean enable;
180 public Boolean enable;
181 public Shelly2DevConfigBleRpc rpc;
182 public Shelly2DevConfigBleObserver observer;
185 public static class Shelly2DevConfigEth {
186 public Boolean enable;
187 public String ipv4mode;
189 public String netmask;
191 public String nameserver;
194 public static class Shelly2DeviceSettings {
199 public String profile;
201 @SerializedName("fw_id")
205 @SerializedName("auth_en")
207 @SerializedName("auth_domain")
208 public String authDomain;
211 public static class Shelly2DeviceConfigAp {
212 public static class Shelly2DeviceConfigApRE {
213 public Boolean enable;
216 public Boolean enable;
218 public String password;
219 @SerializedName("is_open")
220 public Boolean isOpen;
221 @SerializedName("range_extender")
222 Shelly2DeviceConfigApRE rangeExtender;
225 public static class Shelly2DeviceConfig {
226 public class Shelly2DeviceConfigSys {
227 public class Shelly2DeviceConfigDevice {
230 @SerializedName("fw_id")
232 public String profile;
233 @SerializedName("eco_mode")
234 public Boolean ecoMode;
235 public Boolean discoverable;
238 public class Shelly2DeviceConfigLocation {
244 public class Shelly2DeviceConfigSntp {
245 public String server;
248 public class Shelly2DeviceConfigSleep {
249 @SerializedName("wakeup_period")
250 public Integer wakeupPeriod;
253 public class Shelly2DeviceConfigDebug {
254 public class Shelly2DeviceConfigDebugMqtt {
255 public Boolean enable;
258 public class Shelly2DeviceConfigDebugWebSocket {
259 public Boolean enable;
262 public class Shelly2DeviceConfigDebugUdp {
266 public Shelly2DeviceConfigDebugMqtt mqtt;
267 public Shelly2DeviceConfigDebugWebSocket websocket;
268 public Shelly2DeviceConfigDebugUdp udp;
271 public class Shelly2DeviceConfigUiData {
272 public String cover; // hold comma seperated list of roller favorites
275 public class Shelly2DeviceConfigRpcUdp {
276 @SerializedName("dst_addr")
277 public String dstAddr;
278 @SerializedName("listenPort")
279 public String listenPort;
282 @SerializedName("cfg_rev")
283 public Integer cfgRevision;
284 public Shelly2DeviceConfigDevice device;
285 public Shelly2DeviceConfigLocation location;
286 public Shelly2DeviceConfigSntp sntp;
287 public Shelly2DeviceConfigSleep sleep;
288 public Shelly2DeviceConfigDebug debug;
289 @SerializedName("ui_data")
290 public Shelly2DeviceConfigUiData uiData;
291 @SerializedName("rpc_udp")
292 public Shelly2DeviceConfigRpcUdp rpcUdp;
295 public class Shelly2DevConfigInput {
299 public Boolean invert;
300 @SerializedName("factory_reset")
301 public Boolean factoryReset;
302 @SerializedName("report_thr")
303 public Double reportTreshold; // only for type analog
306 public class Shelly2DevConfigSwitch {
310 @SerializedName("in_mode")
313 @SerializedName("initial_state")
314 public String initialState;
315 @SerializedName("auto_on")
316 public Boolean autoOn;
317 @SerializedName("auto_on_delay")
318 public Double autoOnDelay;
319 @SerializedName("auto_off")
320 public Boolean autoOff;
321 @SerializedName("auto_off_delay")
322 public Double autoOffDelay;
323 @SerializedName("power_limit")
324 public Integer powerLimit;
325 @SerializedName("voltage_limit")
326 public Integer voltageLimit;
327 @SerializedName("current_limit")
328 public Double currentLimit;
331 public static class Shelly2DevConfigEm {
334 @SerializedName("blink_mode_selector")
335 public String blinkModeSelector;
336 @SerializedName("phase_selector")
337 public String phase_selector;
338 @SerializedName("monitor_phase_sequence")
339 public Boolean monitorPhaseSequence;
342 public class Shelly2DevConfigPm1 {
347 public class Shelly2DevConfigCover {
348 public class Shelly2DeviceConfigCoverMotor {
349 @SerializedName("idle_power_thr")
350 public Double idle_powerThr;
353 public class Shelly2DeviceConfigCoverSafetySwitch {
354 public Boolean enable;
355 public String direction;
356 public String action;
357 @SerializedName("allowed_move")
358 public String allowedMove;
361 public class Shelly2DeviceConfigCoverObstructionDetection {
362 public Boolean enable;
363 public String direction;
364 public String action;
365 @SerializedName("power_thr")
366 public Integer powerThr;
367 public Double holdoff;
372 public Shelly2DeviceConfigCoverMotor motor;
373 @SerializedName("maxtime_open")
374 public Double maxtimeOpen;
375 @SerializedName("maxtime_close")
376 public Double maxtimeClose;
377 @SerializedName("initial_state")
378 public String initialState;
379 @SerializedName("invert_directions")
380 public Boolean invertDirections;
381 @SerializedName("in_mode")
382 public String inMode;
383 @SerializedName("swap_inputs")
384 public Boolean swapInputs;
385 @SerializedName("safety_switch")
386 public Shelly2DeviceConfigCoverSafetySwitch safetySwitch;
387 @SerializedName("power_limit")
388 public Integer powerLimit;
389 @SerializedName("voltage_limit")
390 public Integer voltageLimit;
391 @SerializedName("current_limit")
392 public Double currentLimit;
393 @SerializedName("obstruction_detection")
394 public Shelly2DeviceConfigCoverObstructionDetection obstructionDetection;
397 public static class Shelly2ConfigSmoke {
399 public Boolean alarm;
403 public static class Shelly2GetConfigLight {
404 public static class Shelly2GetConfigLightDefault {
405 public Integer brightness;
408 public static class Shelly2GetConfigLightNightMode {
409 public boolean enable;
410 public Integer brightness;
415 @SerializedName("initial_state")
416 public String initialState;
417 @SerializedName("auto_on")
418 public Boolean autoOn;
419 @SerializedName("auto_off")
420 public Boolean autoOff;
421 @SerializedName("auto_on_delay")
422 public Double autoOnDelay;
423 @SerializedName("auto_off_delay")
424 public Double autoOffDelay;
425 @SerializedName("default")
426 public Shelly2GetConfigLightDefault defaultCfg;
427 @SerializedName("night_mode")
428 public Shelly2GetConfigLightNightMode nightMode;
431 public class Shelly2DeviceConfigLed {
432 @SerializedName("sys_led_enable")
433 public Boolean sysLedEnable;
434 @SerializedName("power_led")
435 public String powerLed;
438 public static class Shelly2GetConfigResult {
440 public class Shelly2DevConfigCloud {
441 public Boolean enable;
442 public String server;
445 public class Shelly2DevConfigMqtt {
446 public Boolean enable;
447 public String server;
449 @SerializedName("topic_prefix:0")
450 public String topicPrefix;
451 @SerializedName("rpc_ntf")
452 public String rpcNtf;
453 @SerializedName("status_ntf")
454 public String statusNtf;
457 public Shelly2DevConfigBle ble;
458 public Shelly2DevConfigEth eth;
459 public Shelly2DevConfigCloud cloud;
460 public Shelly2DevConfigMqtt mqtt;
461 public Shelly2DeviceConfigSys sys;
462 public Shelly2DeviceConfigWiFi wifi;
463 @SerializedName("wd_ui")
464 public Shelly2DeviceConfigLed led;
466 @SerializedName("input:0")
467 public Shelly2DevConfigInput input0;
468 @SerializedName("input:1")
469 public Shelly2DevConfigInput input1;
470 @SerializedName("input:2")
471 public Shelly2DevConfigInput input2;
472 @SerializedName("input:3")
473 public Shelly2DevConfigInput input3;
475 @SerializedName("switch:0")
476 public Shelly2DevConfigSwitch switch0;
477 @SerializedName("switch:1")
478 public Shelly2DevConfigSwitch switch1;
479 @SerializedName("switch:2")
480 public Shelly2DevConfigSwitch switch2;
481 @SerializedName("switch:3")
482 public Shelly2DevConfigSwitch switch3;
483 @SerializedName("switch:100")
484 public Shelly2DevConfigSwitch switch100; // Pro 3EM Add-On
486 @SerializedName("em:0")
487 public Shelly2DevConfigEm em0;
488 @SerializedName("em1:0")
489 public Shelly2DevConfigEm em10;
490 @SerializedName("em1:1")
491 public Shelly2DevConfigEm em11;
492 @SerializedName("pm1:0")
493 public Shelly2DevConfigPm1 pm10;
495 @SerializedName("cover:0")
496 public Shelly2DevConfigCover cover0;
498 @SerializedName("light:0")
499 public Shelly2GetConfigLight light0;
501 @SerializedName("smoke:0")
502 public Shelly2ConfigSmoke smoke0;
505 public class Shelly2DeviceConfigSta {
507 public String password;
508 @SerializedName("is_open")
509 public Boolean isOpen;
510 public Boolean enable;
511 public String ipv4mode;
513 public String netmask;
515 public String nameserver;
518 public class Shelly2DeviceConfigRoam {
519 @SerializedName("rssi_thr")
520 public Integer rssiThr;
521 public Integer interval;
524 public class Shelly2DeviceConfigWiFi {
525 public Shelly2DeviceConfigAp ap;
526 public Shelly2DeviceConfigSta sta;
527 public Shelly2DeviceConfigSta sta1;
528 public Shelly2DeviceConfigRoam roam;
533 public Shelly2GetConfigResult result;
536 public static class Shelly2APClientList {
537 public static class Shelly2APClient {
540 @SerializedName("ip_static")
541 public Boolean staticIP;
542 public Integer mport;
547 @SerializedName("ap_clients")
548 public ArrayList<Shelly2APClient> apClients;
551 public static class Shelly2DeviceStatus {
552 public class Shelly2InputCounts {
553 public Integer total;
554 @SerializedName("by_minute")
555 public Double[] byMinute;
556 public Double xtotal;
557 @SerializedName("xby_minute")
558 public Double[] xbyMinute;
559 @SerializedName("minute_ts")
560 public Integer minuteTS;
563 public class Shelly2InputStatus {
565 public Boolean state;
566 public Double percent; // analog input only
567 public ArrayList<String> errors;// shown only if at least one error is present.
568 public Double xpercent;
569 public Shelly2InputCounts counts;
574 public static class Shelly2DeviceStatusLight {
576 public String source;
577 public Boolean output;
578 public Double brightness;
579 @SerializedName("timer_started_at")
580 public Double timerStartedAt;
581 @SerializedName("timer_duration")
582 public Integer timerDuration;
585 public static class Shelly2DeviceStatusResult {
586 public class Shelly2DeviceStatusBle {
590 public class Shelly2DeviceStatusCloud {
591 public Boolean connected;
594 public class Shelly2DeviceStatusMqqt {
595 public Boolean connected;
598 public class Shelly2CoverStatus {
600 public String source;
602 public Double apower;
603 public Double voltage;
604 public Double current;
606 public Shelly2Energy aenergy;
607 @SerializedName("current_pos")
608 public Integer currentPos;
609 @SerializedName("target_pos")
610 public Integer targetPos;
611 @SerializedName("move_timeout")
612 public Double moveTimeout;
613 @SerializedName("move_started_at")
614 public Double moveStartedAt;
615 @SerializedName("pos_control")
616 public Boolean posControl;
617 public Shelly2DeviceStatusTemp temperature;
618 public ArrayList<String> errors;
621 public class Shelly2DeviceStatusHumidity {
626 public class Shelly2DeviceStatusIlluminance {
629 public String illumination;
632 public class Shelly2DeviceStatusVoltage {
634 public Double voltage;
637 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
641 public static class Shelly2DeviceStatusPower {
642 public static class Shelly2DeviceStatusBattery {
645 public Double percent;
648 public static class Shelly2DeviceStatusCharger {
649 public Boolean present;
653 public Shelly2DeviceStatusBattery battery;
654 public Shelly2DeviceStatusCharger external;
657 public static class Shelly2DeviceStatusEm {
660 @SerializedName("a_current")
661 public Double aCurrent;
662 @SerializedName("a_voltage")
663 public Double aVoltage;
664 @SerializedName("a_act_power")
665 public Double aActPower;
666 @SerializedName("a_aprt_power")
667 public Double aAprtPower;
668 @SerializedName("a_pf")
671 @SerializedName("b_current")
672 public Double bCurrent;
673 @SerializedName("b_voltage")
674 public Double bVoltage;
675 @SerializedName("b_act_power")
676 public Double bActPower;
677 @SerializedName("b_aprt_power")
678 public Double bAprtPower;
679 @SerializedName("b_pf")
682 @SerializedName("c_current")
683 public Double cCurrent;
684 @SerializedName("c_voltage")
685 public Double cVoltage;
686 @SerializedName("c_act_power")
687 public Double cActPower;
688 @SerializedName("c_aprt_power")
689 public Double cAprtPower;
690 @SerializedName("c_pf")
693 @SerializedName("n_current")
694 public Double nCurrent;
696 @SerializedName("total_current")
697 public Double totalCurrent;
698 @SerializedName("total_act_power")
699 public Double totalActPower;
700 @SerializedName("total_aprt_power")
701 public Double totalAprtPower;
704 public static class Shelly2DeviceStatusEmData {
706 public String[] errors;
709 public class Shelly2DeviceStatusSmoke {
711 public Boolean alarm;
715 public Shelly2DeviceStatusBle ble;
716 public Shelly2DeviceStatusCloud cloud;
717 public Shelly2DeviceStatusMqqt mqtt;
718 public Shelly2DeviceStatusSys sys;
719 public Shelly2DeviceStatusSysWiFi wifi;
721 @SerializedName("input:0")
722 public Shelly2InputStatus input0;
723 @SerializedName("input:1")
724 public Shelly2InputStatus input1;
725 @SerializedName("input:2")
726 public Shelly2InputStatus input2;
727 @SerializedName("input:3")
728 public Shelly2InputStatus input3;
729 @SerializedName("input:100")
730 public Shelly2InputStatus input100; // Digital Input from Add-On
732 @SerializedName("switch:0")
733 public Shelly2RelayStatus switch0;
734 @SerializedName("switch:1")
735 public Shelly2RelayStatus switch1;
736 @SerializedName("switch:2")
737 public Shelly2RelayStatus switch2;
738 @SerializedName("switch:3")
739 public Shelly2RelayStatus switch3;
740 @SerializedName("switch:100")
741 public Shelly2RelayStatus switch100; // Pro 3EM Add-On
743 @SerializedName("pm1:0")
744 public Shelly2RelayStatus pm10;
746 @SerializedName("em:0")
747 public Shelly2DeviceStatusEm em0;
748 @SerializedName("emdata:0")
749 public Shelly2DeviceStatusEmData emdata0;
750 @SerializedName("em1:0")
751 public Shelly2StatusEm1 em10;
752 @SerializedName("em1:1")
753 public Shelly2StatusEm1 em11;
754 @SerializedName("em1data:0")
755 public Shelly2DeviceStatusEmData em1data0;
757 @SerializedName("cover:0")
758 public Shelly2CoverStatus cover0;
760 @SerializedName("light:0")
761 public Shelly2DeviceStatusLight light0;
763 @SerializedName("temperature:0")
764 public Shelly2DeviceStatusTempId temperature0;
765 @SerializedName("temperature:100")
766 public Shelly2DeviceStatusTempId temperature100;
767 @SerializedName("temperature:101")
768 public Shelly2DeviceStatusTempId temperature101;
769 @SerializedName("temperature:102")
770 public Shelly2DeviceStatusTempId temperature102;
771 @SerializedName("temperature:103")
772 public Shelly2DeviceStatusTempId temperature103;
773 @SerializedName("temperature:104")
774 public Shelly2DeviceStatusTempId temperature104;
776 @SerializedName("humidity:0")
777 public Shelly2DeviceStatusHumidity humidity0;
778 @SerializedName("humidity:100")
779 public Shelly2DeviceStatusHumidity humidity100;
781 @SerializedName("illuminance:0")
782 Shelly2DeviceStatusIlluminance illuminance0;
784 @SerializedName("smoke:0")
785 public Shelly2DeviceStatusSmoke smoke0;
787 @SerializedName("voltmeter:100")
788 public Shelly2DeviceStatusVoltage voltmeter100;
790 @SerializedName("devicepower:0")
791 public Shelly2DeviceStatusPower devicepower0;
794 public class Shelly2DeviceStatusSys {
795 public class Shelly2DeviceStatusSysAvlUpdate {
796 public class Shelly2DeviceStatusSysUpdate {
797 public String version;
800 public Shelly2DeviceStatusSysUpdate stable;
801 public Shelly2DeviceStatusSysUpdate beta;
804 public class Shelly2DeviceStatusWakeup {
810 @SerializedName("restart_required")
811 public Boolean restartRequired;
813 public Long unixtime;
815 @SerializedName("ram_size")
817 @SerializedName("ram_free")
819 @SerializedName("fs_size")
821 @SerializedName("fs_free")
823 @SerializedName("cfg_rev")
824 public Integer cfg_rev;
825 @SerializedName("available_updates")
826 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
827 @SerializedName("webhook_rev")
828 public Integer webHookRev;
829 @SerializedName("wakeup_reason")
830 public Shelly2DeviceStatusWakeup wakeUpReason;
831 @SerializedName("wakeup_period")
832 public Integer wakeupPeriod;
835 public class Shelly2DeviceStatusSysWiFi {
836 @SerializedName("sta_ip")
838 public String status;
841 @SerializedName("ap_client_count")
842 public Integer apClientCount;
847 public Shelly2DeviceStatusResult result;
850 public static class Shelly2RelayStatus {
852 public String source;
853 public Boolean output;
854 @SerializedName("timer_started_at")
855 public Double timerStartetAt;
856 @SerializedName("timer_duration")
857 public Integer timerDuration;
858 public Double apower;
859 public Double voltage;
860 public Double current;
862 public Shelly2Energy aenergy;
863 public Shelly2DeviceStatusTemp temperature;
864 public String[] errors;
867 public static class Shelly2Pm1Status {
869 public String source;
870 public Boolean output;
871 @SerializedName("timer_started_at")
872 public Double timerStartetAt;
873 @SerializedName("timer_duration")
874 public Integer timerDuration;
875 public Double apower;
876 public Double voltage;
877 public Double current;
879 public Shelly2Energy aenergy;
880 public Shelly2DeviceStatusTemp temperature;
881 public String[] errors;
884 public static class Shelly2StatusEm1 {
886 public Double current;
887 public Double voltage;
888 @SerializedName("act_power")
889 public Double actPower;
890 @SerializedName("aprt_power")
891 public Double aptrPower;
893 public String calibration;
894 public ArrayList<String> errors;
897 public static class Shelly2DeviceStatusTemp {
902 public static class Shelly2Energy {
903 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
905 @SerializedName("by_minute")
906 public Double[] byMinute;
907 @SerializedName("minute_ts")
908 public Long minuteTs;
911 public static class Shelly2ConfigParms {
913 public Boolean enable;
914 public String server;
915 @SerializedName("ssl_ca")
919 public Shelly2DeviceConfigAp ap;
922 @SerializedName("auto_on")
923 public Boolean autoOn;
924 @SerializedName("auto_on_delay")
925 public Double autoOnDelay;
926 @SerializedName("auto_off")
927 public Boolean autoOff;
928 @SerializedName("auto_off_delay")
929 public Double autoOffDelay;
932 @SerializedName("sys_led_enable")
933 public Boolean sysLedEnable;
934 @SerializedName("power_led")
935 public String powerLed;
938 public Shelly2DevConfigBleRpc rpc;
939 public Shelly2DevConfigBleObserver observer;
942 public static class Shelly2RpcRequest {
943 public Integer id = 0;
944 public String method;
946 public static class Shelly2RpcRequestParams {
947 public Integer id = 1;
954 public Integer brightness;
955 @SerializedName("toggle_after")
956 public Integer toggleAfter;
968 public Shelly2ConfigParms config;
973 public Shelly2RpcRequestParams withConfig() {
974 config = new Shelly2ConfigParms();
979 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
981 public Shelly2RpcRequest() {
984 public Shelly2RpcRequest withMethod(String method) {
985 this.method = method;
989 public Shelly2RpcRequest withId(int id) {
994 public Shelly2RpcRequest withPos(int pos) {
999 public Shelly2RpcRequest withName(String name) {
1005 public static class Shelly2WsConfigResponse {
1009 public static class Shelly2WsConfigResult {
1010 @SerializedName("restart_required")
1011 public Boolean restartRequired;
1014 public Shelly2WsConfigResult result;
1017 public static class ShellyScriptListResponse {
1018 public static class ShellyScriptListEntry {
1021 public Boolean enable;
1022 public Boolean running;
1025 public ArrayList<ShellyScriptListEntry> scripts;
1028 public static class ShellyScriptResponse {
1030 public Boolean running;
1035 public static class ShellyScriptPutCodeParams {
1038 public Boolean append;
1041 public static class Shelly2RpcBaseMessage {
1042 // Basic message format, e.g.
1043 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
1044 public class Shelly2RpcMessageError {
1045 public Integer code;
1046 public String message;
1052 public String component;
1053 public String method;
1054 public Object params;
1055 public String event;
1056 public Object result;
1057 public Shelly2AuthRsp auth;
1058 public Shelly2RpcMessageError error;
1061 public static class Shelly2RpcNotifyStatus {
1062 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
1069 public String method;
1070 public Shelly2NotifyStatus params;
1071 public Shelly2NotifyStatus result;
1072 public Shelly2RpcMessageError error;
1075 public static String SHELLY2_AUTHDEF_USER = "admin";
1076 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
1077 public static String SHELLY2_AUTHTTYPE_STRING = "string";
1078 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
1079 // = ':auth:'+HexHash("dummy_method:dummy_uri");
1080 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
1082 public static class Shelly2AuthChallenge { // on 401 message contains the auth info
1083 @SerializedName("auth_type")
1084 public String authType;
1085 public String nonce;
1087 public String realm;
1088 public String algorithm;
1091 public static class Shelly2AuthRsp {
1092 public String username;
1093 public String nonce;
1094 public String cnonce;
1096 public String realm;
1097 public String algorithm;
1098 public String response;
1099 @SerializedName("auth_type")
1100 public String authType;
1105 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1106 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1107 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1108 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
1109 // "ts":1682877399.22}
1112 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1113 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1114 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1115 // "data":{"encryption":false,"BTHome_version":2,"pid":38,"Battery":100,"Illuminance":0,"Window":1,"Rotation":0,"addr":"bc:02:6e:c3:a6:c7","rssi":-62},
1116 // "ts":1682877414.25}
1118 public class Shelly2NotifyEventMessage {
1121 public Boolean encryption;
1122 @SerializedName("BTHome_version")
1123 public Integer bthVersion;
1125 @SerializedName("Battery")
1126 public Integer battery;
1127 @SerializedName("Button")
1128 public Integer buttonEvent;
1129 @SerializedName("Illuminance")
1130 public Integer illuminance;
1131 @SerializedName("Window")
1132 public Integer windowState;
1133 @SerializedName("Rotation")
1134 public Double rotation;
1135 @SerializedName("Motion")
1136 public Integer motionState;
1137 @SerializedName("Temperature")
1138 public Double temperature;
1139 @SerializedName("Humidity")
1140 public Double humidity;
1142 public Integer rssi;
1143 public Integer tx_power;
1146 public class Shelly2NotifyEvent {
1149 public String component;
1150 public String event;
1151 public Shelly2NotifyEventMessage data;
1153 public Integer reason;
1154 @SerializedName("cfg_rev")
1155 public Integer cfgRev;
1158 public class Shelly2NotifyEventData {
1160 public ArrayList<Shelly2NotifyEvent> events;
1163 public static class Shelly2RpcNotifyEvent {
1166 public Shelly2NotifyEventData params;