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.Shelly2DeviceStatus.Shelly2DeviceStatusResult;
18 import org.openhab.binding.shelly.internal.api2.Shelly2ApiJsonDTO.Shelly2RpcBaseMessage.Shelly2RpcMessageError;
20 import com.google.gson.annotations.SerializedName;
23 * {@link Shelly2ApiJsonDTO} wraps the Shelly REST API and provides various low level function to access the device api
27 * @author Markus Michels - Initial contribution
29 public class Shelly2ApiJsonDTO {
30 public static final String SHELLYRPC_ENDPOINT = "/rpc";
32 public static final String SHELLYRPC_METHOD_CLASS_SHELLY = "Shelly";
33 public static final String SHELLYRPC_METHOD_CLASS_SWITCH = "Switch";
35 public static final String SHELLYRPC_METHOD_GETDEVCONFIG = "GetDeviceInfo";
36 public static final String SHELLYRPC_METHOD_GETSYSCONFIG = "GetSysConfig"; // only sys
37 public static final String SHELLYRPC_METHOD_GETCONFIG = "GetConfig"; // sys + components
38 public static final String SHELLYRPC_METHOD_GETSYSSTATUS = "GetSysStatus"; // only sys
39 public static final String SHELLYRPC_METHOD_GETSTATUS = "GetStatus"; // sys + components
40 public static final String SHELLYRPC_METHOD_REBOOT = "Shelly.Reboot";
41 public static final String SHELLYRPC_METHOD_RESET = "Shelly.FactoryReset";
42 public static final String SHELLYRPC_METHOD_CHECKUPD = "Shelly.CheckForUpdate";
43 public static final String SHELLYRPC_METHOD_UPDATE = "Shelly.Update";
44 public static final String SHELLYRPC_METHOD_AUTHSET = "Shelly.SetAuth";
45 public static final String SHELLYRPC_METHOD_SWITCH_STATUS = "Switch.GetStatus";
46 public static final String SHELLYRPC_METHOD_SWITCH_SET = "Switch.Set";
47 public static final String SHELLYRPC_METHOD_SWITCH_SETCONFIG = "Switch.SetConfig";
48 public static final String SHELLYRPC_METHOD_COVER_SETPOS = "Cover.GoToPosition";
49 public static final String SHELLY2_COVER_CMD_OPEN = "Open";
50 public static final String SHELLY2_COVER_CMD_CLOSE = "Close";
51 public static final String SHELLY2_COVER_CMD_STOP = "Stop";
52 public static final String SHELLYRPC_METHOD_LIGHT_STATUS = "Light.GetStatus";
53 public static final String SHELLYRPC_METHOD_LIGHT_SET = "Light.Set";
54 public static final String SHELLYRPC_METHOD_LIGHT_SETCONFIG = "Light.SetConfig";
55 public static final String SHELLYRPC_METHOD_LED_SETCONFIG = "WD_UI.SetConfig";
56 public static final String SHELLYRPC_METHOD_WIFIGETCONG = "Wifi.GetConfig";
57 public static final String SHELLYRPC_METHOD_WIFISETCONG = "Wifi.SetConfig";
58 public static final String SHELLYRPC_METHOD_WIFILISTAPCLIENTS = "WiFi.ListAPClients";
59 public static final String SHELLYRPC_METHOD_ETHGETCONG = "Eth.GetConfig";
60 public static final String SHELLYRPC_METHOD_ETHSETCONG = "Eth.SetConfig";
61 public static final String SHELLYRPC_METHOD_BLEGETCONG = "BLE.GetConfig";
62 public static final String SHELLYRPC_METHOD_BLESETCONG = "BLE.SetConfig";
63 public static final String SHELLYRPC_METHOD_CLOUDSET = "Cloud.SetConfig";
64 public static final String SHELLYRPC_METHOD_WSGETCONFIG = "WS.GetConfig";
65 public static final String SHELLYRPC_METHOD_WSSETCONFIG = "WS.SetConfig";
66 public static final String SHELLYRPC_METHOD_EMDATARESET = "EMData.DeleteAllData";
67 public static final String SHELLYRPC_METHOD_EM1DATARESET = "EM1Data.DeleteAllData";
68 public static final String SHELLYRPC_METHOD_SMOKE_SETCONFIG = "Smoke.SetConfig";
69 public static final String SHELLYRPC_METHOD_SMOKE_MUTE = "Smoke.Mute";
70 public static final String SHELLYRPC_METHOD_SCRIPT_LIST = "Script.List";
71 public static final String SHELLYRPC_METHOD_SCRIPT_SETCONFIG = "Script.SetConfig";
72 public static final String SHELLYRPC_METHOD_SCRIPT_GETSTATUS = "Script.GetStatus";
73 public static final String SHELLYRPC_METHOD_SCRIPT_DELETE = "Script.Delete";
74 public static final String SHELLYRPC_METHOD_SCRIPT_CREATE = "Script.Create";
75 public static final String SHELLYRPC_METHOD_SCRIPT_GETCODE = "Script.GetCode";
76 public static final String SHELLYRPC_METHOD_SCRIPT_PUTCODE = "Script.PutCode";
77 public static final String SHELLYRPC_METHOD_SCRIPT_START = "Script.Start";
78 public static final String SHELLYRPC_METHOD_SCRIPT_STOP = "Script.Stop";
80 public static final String SHELLYRPC_METHOD_NOTIFYSTATUS = "NotifyStatus"; // inbound status
81 public static final String SHELLYRPC_METHOD_NOTIFYFULLSTATUS = "NotifyFullStatus"; // inbound status from bat device
82 public static final String SHELLYRPC_METHOD_NOTIFYEVENT = "NotifyEvent"; // inbound event
85 public static final String SHELLY2_PROFILE_RELAY = "switch";
86 public static final String SHELLY2_PROFILE_COVER = "cover";
89 public static final String SHELLY2_BTNT_MOMENTARY = "momentary";
90 public static final String SHELLY2_BTNT_FLIP = "flip";
91 public static final String SHELLY2_BTNT_FOLLOW = "follow";
92 public static final String SHELLY2_BTNT_DETACHED = "detached";
95 public static final String SHELLY2_INPUTT_SWITCH = "switch";
96 public static final String SHELLY2_INPUTT_BUTTON = "button";
97 public static final String SHELLY2_INPUTT_ANALOG = "analog"; // Shelly Addon: analogous input
100 public static final String SHELLY2_API_MODE_DETACHED = "detached";
101 public static final String SHELLY2_API_MODE_FOLLOW = "follow";
103 // Initial switch states
104 public static final String SHELLY2_API_ISTATE_ON = "on";
105 public static final String SHELLY2_API_ISTATE_OFF = "off";
106 public static final String SHELLY2_API_ISTATE_FOLLOWLAST = "restore_last";
107 public static final String SHELLY2_API_ISTATE_MATCHINPUT = "match_input";
109 // Cover/Roller modes
110 public static final String SHELLY2_RMODE_SINGLE = "single";
111 public static final String SHELLY2_RMODE_DUAL = "dual";
112 public static final String SHELLY2_RMODE_DETACHED = "detached";
114 public static final String SHELLY2_RSTATE_OPENING = "opening";
115 public static final String SHELLY2_RSTATE_OPEN = "open";
116 public static final String SHELLY2_RSTATE_CLOSING = "closing";
117 public static final String SHELLY2_RSTATE_CLOSED = "closed";
118 public static final String SHELLY2_RSTATE_STOPPED = "stopped";
119 public static final String SHELLY2_RSTATE_CALIB = "calibrating";
121 // Event notifications
122 public static final String SHELLY2_EVENT_BTNUP = "btn_up";
123 public static final String SHELLY2_EVENT_BTNDOWN = "btn_down";
124 public static final String SHELLY2_EVENT_1PUSH = "single_push";
125 public static final String SHELLY2_EVENT_2PUSH = "double_push";
126 public static final String SHELLY2_EVENT_3PUSH = "triple_push";
127 public static final String SHELLY2_EVENT_LPUSH = "long_push";
128 public static final String SHELLY2_EVENT_SLPUSH = "short_long_push";
129 public static final String SHELLY2_EVENT_LSPUSH = "long_short_push";
131 public static final String SHELLY2_EVENT_SLEEP = "sleep";
132 public static final String SHELLY2_EVENT_CFGCHANGED = "config_changed";
133 public static final String SHELLY2_EVENT_OTASTART = "ota_begin";
134 public static final String SHELLY2_EVENT_OTAPROGRESS = "ota_progress";
135 public static final String SHELLY2_EVENT_OTADONE = "ota_success";
136 public static final String SHELLY2_EVENT_WIFICONNFAILED = "sta_connect_fail";
137 public static final String SHELLY2_EVENT_WIFIDISCONNECTED = "sta_disconnected";
140 public static final String SHELLY2_BLU_GWSCRIPT = "oh-blu-scanner.js";
141 public static final String SHELLY2_EVENT_BLUPREFIX = "oh-blu.";
142 public static final String SHELLY2_EVENT_BLUSCAN = SHELLY2_EVENT_BLUPREFIX + "scan_result";
143 public static final String SHELLY2_EVENT_BLUDATA = SHELLY2_EVENT_BLUPREFIX + "data";
146 public static final String SHELLY2_ERROR_OVERPOWER = "overpower";
147 public static final String SHELLY2_ERROR_OVERTEMP = "overtemp";
148 public static final String SHELLY2_ERROR_OVERVOLTAGE = "overvoltage";
150 // Wakeup reasons (e.g. Plus HT)
151 public static final String SHELLY2_WAKEUPO_BOOT_POWERON = "poweron";
152 public static final String SHELLY2_WAKEUPO_BOOT_RESTART = "software_restart";
153 public static final String SHELLY2_WAKEUPO_BOOT_WAKEUP = "deepsleep_wake";
154 public static final String SHELLY2_WAKEUPO_BOOT_INTERNAL = "internal";
155 public static final String SHELLY2_WAKEUPO_BOOT_UNKNOWN = "unknown";
157 public static final String SHELLY2_WAKEUPOCAUSE_BUTTON = "button";
158 public static final String SHELLY2_WAKEUPOCAUSE_USB = "usb";
159 public static final String SHELLY2_WAKEUPOCAUSE_PERIODIC = "periodic";
160 public static final String SHELLY2_WAKEUPOCAUSE_UPDATE = "status_update";
161 public static final String SHELLY2_WAKEUPOCAUSE_UNDEFINED = "undefined";
163 // Dimmer US: LED power modes
164 public static final String SHELLY2_POWERLED_ON = "on";
165 public static final String SHELLY2_POWERLED_OFF = "off";
166 public static final String SHELLY2_POWERLED_MATCH = "match_output";
167 public static final String SHELLY2_POWERLED_INVERT = "inverted_output";
169 public class Shelly2DevConfigBle {
170 public Boolean enable;
173 public class Shelly2DevConfigEth {
174 public Boolean enable;
175 public String ipv4mode;
177 public String netmask;
179 public String nameserver;
182 public static class Shelly2DeviceSettings {
187 public String profile;
189 @SerializedName("fw_id")
193 @SerializedName("auth_en")
195 @SerializedName("auth_domain")
196 public String authDomain;
199 public static class Shelly2DeviceConfigAp {
200 public static class Shelly2DeviceConfigApRE {
201 public Boolean enable;
204 public Boolean enable;
206 public String password;
207 @SerializedName("is_open")
208 public Boolean isOpen;
209 @SerializedName("range_extender")
210 Shelly2DeviceConfigApRE rangeExtender;
213 public static class Shelly2DeviceConfig {
214 public class Shelly2DeviceConfigSys {
215 public class Shelly2DeviceConfigDevice {
218 @SerializedName("fw_id")
220 public String profile;
221 @SerializedName("eco_mode")
222 public Boolean ecoMode;
223 public Boolean discoverable;
226 public class Shelly2DeviceConfigLocation {
232 public class Shelly2DeviceConfigSntp {
233 public String server;
236 public class Shelly2DeviceConfigSleep {
237 @SerializedName("wakeup_period")
238 public Integer wakeupPeriod;
241 public class Shelly2DeviceConfigDebug {
242 public class Shelly2DeviceConfigDebugMqtt {
243 public Boolean enable;
246 public class Shelly2DeviceConfigDebugWebSocket {
247 public Boolean enable;
250 public class Shelly2DeviceConfigDebugUdp {
254 public Shelly2DeviceConfigDebugMqtt mqtt;
255 public Shelly2DeviceConfigDebugWebSocket websocket;
256 public Shelly2DeviceConfigDebugUdp udp;
259 public class Shelly2DeviceConfigUiData {
260 public String cover; // hold comma seperated list of roller favorites
263 public class Shelly2DeviceConfigRpcUdp {
264 @SerializedName("dst_addr")
265 public String dstAddr;
266 @SerializedName("listenPort")
267 public String listenPort;
270 @SerializedName("cfg_rev")
271 public Integer cfgRevision;
272 public Shelly2DeviceConfigDevice device;
273 public Shelly2DeviceConfigLocation location;
274 public Shelly2DeviceConfigSntp sntp;
275 public Shelly2DeviceConfigSleep sleep;
276 public Shelly2DeviceConfigDebug debug;
277 @SerializedName("ui_data")
278 public Shelly2DeviceConfigUiData uiData;
279 @SerializedName("rpc_udp")
280 public Shelly2DeviceConfigRpcUdp rpcUdp;
283 public class Shelly2DevConfigInput {
287 public Boolean invert;
288 @SerializedName("factory_reset")
289 public Boolean factoryReset;
290 @SerializedName("report_thr")
291 public Double reportTreshold; // only for type analog
294 public class Shelly2DevConfigSwitch {
298 @SerializedName("in_mode")
301 @SerializedName("initial_state")
302 public String initialState;
303 @SerializedName("auto_on")
304 public Boolean autoOn;
305 @SerializedName("auto_on_delay")
306 public Double autoOnDelay;
307 @SerializedName("auto_off")
308 public Boolean autoOff;
309 @SerializedName("auto_off_delay")
310 public Double autoOffDelay;
311 @SerializedName("power_limit")
312 public Integer powerLimit;
313 @SerializedName("voltage_limit")
314 public Integer voltageLimit;
315 @SerializedName("current_limit")
316 public Double currentLimit;
319 public static class Shelly2DevConfigEm {
322 @SerializedName("blink_mode_selector")
323 public String blinkModeSelector;
324 @SerializedName("phase_selector")
325 public String phase_selector;
326 @SerializedName("monitor_phase_sequence")
327 public Boolean monitorPhaseSequence;
330 public class Shelly2DevConfigPm1 {
335 public class Shelly2DevConfigCover {
336 public class Shelly2DeviceConfigCoverMotor {
337 @SerializedName("idle_power_thr")
338 public Double idle_powerThr;
341 public class Shelly2DeviceConfigCoverSafetySwitch {
342 public Boolean enable;
343 public String direction;
344 public String action;
345 @SerializedName("allowed_move")
346 public String allowedMove;
349 public class Shelly2DeviceConfigCoverObstructionDetection {
350 public Boolean enable;
351 public String direction;
352 public String action;
353 @SerializedName("power_thr")
354 public Integer powerThr;
355 public Double holdoff;
360 public Shelly2DeviceConfigCoverMotor motor;
361 @SerializedName("maxtime_open")
362 public Double maxtimeOpen;
363 @SerializedName("maxtime_close")
364 public Double maxtimeClose;
365 @SerializedName("initial_state")
366 public String initialState;
367 @SerializedName("invert_directions")
368 public Boolean invertDirections;
369 @SerializedName("in_mode")
370 public String inMode;
371 @SerializedName("swap_inputs")
372 public Boolean swapInputs;
373 @SerializedName("safety_switch")
374 public Shelly2DeviceConfigCoverSafetySwitch safetySwitch;
375 @SerializedName("power_limit")
376 public Integer powerLimit;
377 @SerializedName("voltage_limit")
378 public Integer voltageLimit;
379 @SerializedName("current_limit")
380 public Double currentLimit;
381 @SerializedName("obstruction_detection")
382 public Shelly2DeviceConfigCoverObstructionDetection obstructionDetection;
385 public static class Shelly2ConfigSmoke {
387 public Boolean alarm;
391 public static class Shelly2GetConfigLight {
392 public static class Shelly2GetConfigLightDefault {
393 public Integer brightness;
396 public static class Shelly2GetConfigLightNightMode {
397 public boolean enable;
398 public Integer brightness;
403 @SerializedName("initial_state")
404 public String initialState;
405 @SerializedName("auto_on")
406 public Boolean autoOn;
407 @SerializedName("auto_off")
408 public Boolean autoOff;
409 @SerializedName("auto_on_delay")
410 public Double autoOnDelay;
411 @SerializedName("auto_off_delay")
412 public Double autoOffDelay;
413 @SerializedName("default")
414 public Shelly2GetConfigLightDefault defaultCfg;
415 @SerializedName("night_mode")
416 public Shelly2GetConfigLightNightMode nightMode;
419 public class Shelly2DeviceConfigLed {
420 @SerializedName("sys_led_enable")
421 public Boolean sysLedEnable;
422 @SerializedName("power_led")
423 public String powerLed;
426 public static class Shelly2GetConfigResult {
428 public class Shelly2DevConfigCloud {
429 public Boolean enable;
430 public String server;
433 public class Shelly2DevConfigMqtt {
434 public Boolean enable;
435 public String server;
437 @SerializedName("topic_prefix:0")
438 public String topicPrefix;
439 @SerializedName("rpc_ntf")
440 public String rpcNtf;
441 @SerializedName("status_ntf")
442 public String statusNtf;
445 public Shelly2DevConfigBle ble;
446 public Shelly2DevConfigEth eth;
447 public Shelly2DevConfigCloud cloud;
448 public Shelly2DevConfigMqtt mqtt;
449 public Shelly2DeviceConfigSys sys;
450 public Shelly2DeviceConfigWiFi wifi;
451 @SerializedName("wd_ui")
452 public Shelly2DeviceConfigLed led;
454 @SerializedName("input:0")
455 public Shelly2DevConfigInput input0;
456 @SerializedName("input:1")
457 public Shelly2DevConfigInput input1;
458 @SerializedName("input:2")
459 public Shelly2DevConfigInput input2;
460 @SerializedName("input:3")
461 public Shelly2DevConfigInput input3;
463 @SerializedName("switch:0")
464 public Shelly2DevConfigSwitch switch0;
465 @SerializedName("switch:1")
466 public Shelly2DevConfigSwitch switch1;
467 @SerializedName("switch:2")
468 public Shelly2DevConfigSwitch switch2;
469 @SerializedName("switch:3")
470 public Shelly2DevConfigSwitch switch3;
471 @SerializedName("switch:100")
472 public Shelly2DevConfigSwitch switch100; // Pro 3EM Add-On
474 @SerializedName("em:0")
475 public Shelly2DevConfigEm em0;
476 @SerializedName("em1:0")
477 public Shelly2DevConfigEm em10;
478 @SerializedName("em1:1")
479 public Shelly2DevConfigEm em11;
480 @SerializedName("pm1:0")
481 public Shelly2DevConfigPm1 pm10;
483 @SerializedName("cover:0")
484 public Shelly2DevConfigCover cover0;
486 @SerializedName("light:0")
487 public Shelly2GetConfigLight light0;
489 @SerializedName("smoke:0")
490 public Shelly2ConfigSmoke smoke0;
493 public class Shelly2DeviceConfigSta {
495 public String password;
496 @SerializedName("is_open")
497 public Boolean isOpen;
498 public Boolean enable;
499 public String ipv4mode;
501 public String netmask;
503 public String nameserver;
506 public class Shelly2DeviceConfigRoam {
507 @SerializedName("rssi_thr")
508 public Integer rssiThr;
509 public Integer interval;
512 public class Shelly2DeviceConfigWiFi {
513 public Shelly2DeviceConfigAp ap;
514 public Shelly2DeviceConfigSta sta;
515 public Shelly2DeviceConfigSta sta1;
516 public Shelly2DeviceConfigRoam roam;
521 public Shelly2GetConfigResult result;
524 public static class Shelly2APClientList {
525 public static class Shelly2APClient {
528 @SerializedName("ip_static")
529 public Boolean staticIP;
530 public Integer mport;
535 @SerializedName("ap_clients")
536 public ArrayList<Shelly2APClient> apClients;
539 public static class Shelly2DeviceStatus {
540 public class Shelly2InputCounts {
541 public Integer total;
542 @SerializedName("by_minute")
543 public Double[] byMinute;
544 public Double xtotal;
545 @SerializedName("xby_minute")
546 public Double[] xbyMinute;
547 @SerializedName("minute_ts")
548 public Integer minuteTS;
551 public class Shelly2InputStatus {
553 public Boolean state;
554 public Double percent; // analog input only
555 public ArrayList<String> errors;// shown only if at least one error is present.
556 public Double xpercent;
557 public Shelly2InputCounts counts;
562 public static class Shelly2DeviceStatusLight {
564 public String source;
565 public Boolean output;
566 public Double brightness;
567 @SerializedName("timer_started_at")
568 public Double timerStartedAt;
569 @SerializedName("timer_duration")
570 public Integer timerDuration;
573 public static class Shelly2DeviceStatusResult {
574 public class Shelly2DeviceStatusBle {
578 public class Shelly2DeviceStatusCloud {
579 public Boolean connected;
582 public class Shelly2DeviceStatusMqqt {
583 public Boolean connected;
586 public class Shelly2CoverStatus {
588 public String source;
590 public Double apower;
591 public Double voltage;
592 public Double current;
594 public Shelly2Energy aenergy;
595 @SerializedName("current_pos")
596 public Integer currentPos;
597 @SerializedName("target_pos")
598 public Integer targetPos;
599 @SerializedName("move_timeout")
600 public Double moveTimeout;
601 @SerializedName("move_started_at")
602 public Double moveStartedAt;
603 @SerializedName("pos_control")
604 public Boolean posControl;
605 public Shelly2DeviceStatusTemp temperature;
606 public ArrayList<String> errors;
609 public class Shelly2DeviceStatusHumidity {
614 public class Shelly2DeviceStatusIlluminance {
617 public String illumination;
620 public class Shelly2DeviceStatusVoltage {
622 public Double voltage;
625 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
629 public static class Shelly2DeviceStatusPower {
630 public static class Shelly2DeviceStatusBattery {
633 public Double percent;
636 public static class Shelly2DeviceStatusCharger {
637 public Boolean present;
641 public Shelly2DeviceStatusBattery battery;
642 public Shelly2DeviceStatusCharger external;
645 public static class Shelly2DeviceStatusEm {
648 @SerializedName("a_current")
649 public Double aCurrent;
650 @SerializedName("a_voltage")
651 public Double aVoltage;
652 @SerializedName("a_act_power")
653 public Double aActPower;
654 @SerializedName("a_aprt_power")
655 public Double aAprtPower;
656 @SerializedName("a_pf")
659 @SerializedName("b_current")
660 public Double bCurrent;
661 @SerializedName("b_voltage")
662 public Double bVoltage;
663 @SerializedName("b_act_power")
664 public Double bActPower;
665 @SerializedName("b_aprt_power")
666 public Double bAprtPower;
667 @SerializedName("b_pf")
670 @SerializedName("c_current")
671 public Double cCurrent;
672 @SerializedName("c_voltage")
673 public Double cVoltage;
674 @SerializedName("c_act_power")
675 public Double cActPower;
676 @SerializedName("c_aprt_power")
677 public Double cAprtPower;
678 @SerializedName("c_pf")
681 @SerializedName("n_current")
682 public Double nCurrent;
684 @SerializedName("total_current")
685 public Double totalCurrent;
686 @SerializedName("total_act_power")
687 public Double totalActPower;
688 @SerializedName("total_aprt_power")
689 public Double totalAprtPower;
692 public static class Shelly2DeviceStatusEmData {
694 public String[] errors;
697 public class Shelly2DeviceStatusSmoke {
699 public Boolean alarm;
703 public Shelly2DeviceStatusBle ble;
704 public Shelly2DeviceStatusCloud cloud;
705 public Shelly2DeviceStatusMqqt mqtt;
706 public Shelly2DeviceStatusSys sys;
707 public Shelly2DeviceStatusSysWiFi wifi;
709 @SerializedName("input:0")
710 public Shelly2InputStatus input0;
711 @SerializedName("input:1")
712 public Shelly2InputStatus input1;
713 @SerializedName("input:2")
714 public Shelly2InputStatus input2;
715 @SerializedName("input:3")
716 public Shelly2InputStatus input3;
717 @SerializedName("input:100")
718 public Shelly2InputStatus input100; // Digital Input from Add-On
720 @SerializedName("switch:0")
721 public Shelly2RelayStatus switch0;
722 @SerializedName("switch:1")
723 public Shelly2RelayStatus switch1;
724 @SerializedName("switch:2")
725 public Shelly2RelayStatus switch2;
726 @SerializedName("switch:3")
727 public Shelly2RelayStatus switch3;
728 @SerializedName("switch:100")
729 public Shelly2RelayStatus switch100; // Pro 3EM Add-On
731 @SerializedName("pm1:0")
732 public Shelly2RelayStatus pm10;
734 @SerializedName("em:0")
735 public Shelly2DeviceStatusEm em0;
736 @SerializedName("emdata:0")
737 public Shelly2DeviceStatusEmData emdata0;
738 @SerializedName("em1:0")
739 public Shelly2StatusEm1 em10;
740 @SerializedName("em1:1")
741 public Shelly2StatusEm1 em11;
742 @SerializedName("em1data:0")
743 public Shelly2DeviceStatusEmData em1data0;
745 @SerializedName("cover:0")
746 public Shelly2CoverStatus cover0;
748 @SerializedName("light:0")
749 public Shelly2DeviceStatusLight light0;
751 @SerializedName("temperature:0")
752 public Shelly2DeviceStatusTempId temperature0;
753 @SerializedName("temperature:100")
754 public Shelly2DeviceStatusTempId temperature100;
755 @SerializedName("temperature:101")
756 public Shelly2DeviceStatusTempId temperature101;
757 @SerializedName("temperature:102")
758 public Shelly2DeviceStatusTempId temperature102;
759 @SerializedName("temperature:103")
760 public Shelly2DeviceStatusTempId temperature103;
761 @SerializedName("temperature:104")
762 public Shelly2DeviceStatusTempId temperature104;
764 @SerializedName("humidity:0")
765 public Shelly2DeviceStatusHumidity humidity0;
766 @SerializedName("humidity:100")
767 public Shelly2DeviceStatusHumidity humidity100;
769 @SerializedName("illuminance:0")
770 Shelly2DeviceStatusIlluminance illuminance0;
772 @SerializedName("smoke:0")
773 public Shelly2DeviceStatusSmoke smoke0;
775 @SerializedName("voltmeter:100")
776 public Shelly2DeviceStatusVoltage voltmeter100;
778 @SerializedName("devicepower:0")
779 public Shelly2DeviceStatusPower devicepower0;
782 public class Shelly2DeviceStatusSys {
783 public class Shelly2DeviceStatusSysAvlUpdate {
784 public class Shelly2DeviceStatusSysUpdate {
785 public String version;
788 public Shelly2DeviceStatusSysUpdate stable;
789 public Shelly2DeviceStatusSysUpdate beta;
792 public class Shelly2DeviceStatusWakeup {
798 @SerializedName("restart_required")
799 public Boolean restartRequired;
801 public Long unixtime;
803 @SerializedName("ram_size")
805 @SerializedName("ram_free")
807 @SerializedName("fs_size")
809 @SerializedName("fs_free")
811 @SerializedName("cfg_rev")
812 public Integer cfg_rev;
813 @SerializedName("available_updates")
814 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
815 @SerializedName("webhook_rev")
816 public Integer webHookRev;
817 @SerializedName("wakeup_reason")
818 public Shelly2DeviceStatusWakeup wakeUpReason;
819 @SerializedName("wakeup_period")
820 public Integer wakeupPeriod;
823 public class Shelly2DeviceStatusSysWiFi {
824 @SerializedName("sta_ip")
826 public String status;
829 @SerializedName("ap_client_count")
830 public Integer apClientCount;
835 public Shelly2DeviceStatusResult result;
838 public static class Shelly2RelayStatus {
840 public String source;
841 public Boolean output;
842 @SerializedName("timer_started_at")
843 public Double timerStartetAt;
844 @SerializedName("timer_duration")
845 public Integer timerDuration;
846 public Double apower;
847 public Double voltage;
848 public Double current;
850 public Shelly2Energy aenergy;
851 public Shelly2DeviceStatusTemp temperature;
852 public String[] errors;
855 public static class Shelly2Pm1Status {
857 public String source;
858 public Boolean output;
859 @SerializedName("timer_started_at")
860 public Double timerStartetAt;
861 @SerializedName("timer_duration")
862 public Integer timerDuration;
863 public Double apower;
864 public Double voltage;
865 public Double current;
867 public Shelly2Energy aenergy;
868 public Shelly2DeviceStatusTemp temperature;
869 public String[] errors;
872 public static class Shelly2StatusEm1 {
874 public Double current;
875 public Double voltage;
876 @SerializedName("act_power")
877 public Double actPower;
878 @SerializedName("aprt_power")
879 public Double aptrPower;
881 public String calibration;
882 public ArrayList<String> errors;
885 public static class Shelly2DeviceStatusTemp {
890 public static class Shelly2Energy {
891 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
893 @SerializedName("by_minute")
894 public Double[] byMinute;
895 @SerializedName("minute_ts")
896 public Long minuteTs;
899 public static class Shelly2ConfigParms {
901 public Boolean enable;
902 public String server;
903 @SerializedName("ssl_ca")
907 public Shelly2DeviceConfigAp ap;
910 @SerializedName("auto_on")
911 public Boolean autoOn;
912 @SerializedName("auto_on_delay")
913 public Double autoOnDelay;
914 @SerializedName("auto_off")
915 public Boolean autoOff;
916 @SerializedName("auto_off_delay")
917 public Double autoOffDelay;
920 @SerializedName("sys_led_enable")
921 public Boolean sysLedEnable;
922 @SerializedName("power_led")
923 public String powerLed;
926 public static class Shelly2RpcRequest {
927 public Integer id = 0;
928 public String method;
930 public static class Shelly2RpcRequestParams {
931 public Integer id = 1;
938 public Integer brightness;
939 @SerializedName("toggle_after")
940 public Integer toggleAfter;
952 public Shelly2ConfigParms config;
957 public Shelly2RpcRequestParams withConfig() {
958 config = new Shelly2ConfigParms();
963 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
965 public Shelly2RpcRequest() {
968 public Shelly2RpcRequest withMethod(String method) {
969 this.method = method;
973 public Shelly2RpcRequest withId(int id) {
978 public Shelly2RpcRequest withPos(int pos) {
983 public Shelly2RpcRequest withName(String name) {
989 public static class Shelly2WsConfigResponse {
993 public static class Shelly2WsConfigResult {
994 @SerializedName("restart_required")
995 public Boolean restartRequired;
998 public Shelly2WsConfigResult result;
1001 public static class ShellyScriptListResponse {
1002 public static class ShellyScriptListEntry {
1005 public Boolean enable;
1006 public Boolean running;
1009 public ArrayList<ShellyScriptListEntry> scripts;
1012 public static class ShellyScriptResponse {
1014 public Boolean running;
1019 public static class ShellyScriptPutCodeParams {
1022 public Boolean append;
1025 public static class Shelly2RpcBaseMessage {
1026 // Basic message format, e.g.
1027 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
1028 public class Shelly2RpcMessageError {
1029 public Integer code;
1030 public String message;
1036 public String component;
1037 public String method;
1038 public Object params;
1039 public String event;
1040 public Object result;
1041 public Shelly2AuthRsp auth;
1042 public Shelly2RpcMessageError error;
1045 public static class Shelly2RpcNotifyStatus {
1046 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
1053 public String method;
1054 public Shelly2NotifyStatus params;
1055 public Shelly2NotifyStatus result;
1056 public Shelly2RpcMessageError error;
1059 public static String SHELLY2_AUTHDEF_USER = "admin";
1060 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
1061 public static String SHELLY2_AUTHTTYPE_STRING = "string";
1062 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
1063 // = ':auth:'+HexHash("dummy_method:dummy_uri");
1064 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
1066 public static class Shelly2AuthChallenge { // on 401 message contains the auth info
1067 @SerializedName("auth_type")
1068 public String authType;
1069 public String nonce;
1071 public String realm;
1072 public String algorithm;
1075 public static class Shelly2AuthRsp {
1076 public String username;
1077 public String nonce;
1078 public String cnonce;
1080 public String realm;
1081 public String algorithm;
1082 public String response;
1083 @SerializedName("auth_type")
1084 public String authType;
1089 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1090 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1091 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1092 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
1093 // "ts":1682877399.22}
1096 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1097 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1098 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1099 // "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},
1100 // "ts":1682877414.25}
1102 public class Shelly2NotifyEventMessage {
1105 public Boolean encryption;
1106 @SerializedName("BTHome_version")
1107 public Integer bthVersion;
1109 @SerializedName("Battery")
1110 public Integer battery;
1111 @SerializedName("Button")
1112 public Integer buttonEvent;
1113 @SerializedName("Illuminance")
1114 public Integer illuminance;
1115 @SerializedName("Window")
1116 public Integer windowState;
1117 @SerializedName("Rotation")
1118 public Double rotation;
1119 @SerializedName("Motion")
1120 public Integer motionState;
1121 @SerializedName("Temperature")
1122 public Double temperature;
1123 @SerializedName("Humidity")
1124 public Double humidity;
1126 public Integer rssi;
1127 public Integer tx_power;
1130 public class Shelly2NotifyEvent {
1133 public String component;
1134 public String event;
1135 public Shelly2NotifyEventMessage data;
1137 public Integer reason;
1138 @SerializedName("cfg_rev")
1139 public Integer cfgRev;
1142 public class Shelly2NotifyEventData {
1144 public ArrayList<Shelly2NotifyEvent> events;
1147 public static class Shelly2RpcNotifyEvent {
1150 public Shelly2NotifyEventData params;