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_ETHGETCONG = "Eth.GetConfig";
59 public static final String SHELLYRPC_METHOD_ETHSETCONG = "Eth.SetConfig";
60 public static final String SHELLYRPC_METHOD_BLEGETCONG = "BLE.GetConfig";
61 public static final String SHELLYRPC_METHOD_BLESETCONG = "BLE.SetConfig";
62 public static final String SHELLYRPC_METHOD_CLOUDSET = "Cloud.SetConfig";
63 public static final String SHELLYRPC_METHOD_WSGETCONFIG = "WS.GetConfig";
64 public static final String SHELLYRPC_METHOD_WSSETCONFIG = "WS.SetConfig";
65 public static final String SHELLYRPC_METHOD_EMDATARESET = "EMData.DeleteAllData";
66 public static final String SHELLYRPC_METHOD_EM1DATARESET = "EM1Data.DeleteAllData";
67 public static final String SHELLYRPC_METHOD_SMOKE_SETCONFIG = "Smoke.SetConfig";
68 public static final String SHELLYRPC_METHOD_SMOKE_MUTE = "Smoke.Mute";
69 public static final String SHELLYRPC_METHOD_SCRIPT_LIST = "Script.List";
70 public static final String SHELLYRPC_METHOD_SCRIPT_SETCONFIG = "Script.SetConfig";
71 public static final String SHELLYRPC_METHOD_SCRIPT_GETSTATUS = "Script.GetStatus";
72 public static final String SHELLYRPC_METHOD_SCRIPT_DELETE = "Script.Delete";
73 public static final String SHELLYRPC_METHOD_SCRIPT_CREATE = "Script.Create";
74 public static final String SHELLYRPC_METHOD_SCRIPT_GETCODE = "Script.GetCode";
75 public static final String SHELLYRPC_METHOD_SCRIPT_PUTCODE = "Script.PutCode";
76 public static final String SHELLYRPC_METHOD_SCRIPT_START = "Script.Start";
77 public static final String SHELLYRPC_METHOD_SCRIPT_STOP = "Script.Stop";
79 public static final String SHELLYRPC_METHOD_NOTIFYSTATUS = "NotifyStatus"; // inbound status
80 public static final String SHELLYRPC_METHOD_NOTIFYFULLSTATUS = "NotifyFullStatus"; // inbound status from bat device
81 public static final String SHELLYRPC_METHOD_NOTIFYEVENT = "NotifyEvent"; // inbound event
84 public static final String SHELLY2_PROFILE_RELAY = "switch";
85 public static final String SHELLY2_PROFILE_COVER = "cover";
88 public static final String SHELLY2_BTNT_MOMENTARY = "momentary";
89 public static final String SHELLY2_BTNT_FLIP = "flip";
90 public static final String SHELLY2_BTNT_FOLLOW = "follow";
91 public static final String SHELLY2_BTNT_DETACHED = "detached";
94 public static final String SHELLY2_INPUTT_SWITCH = "switch";
95 public static final String SHELLY2_INPUTT_BUTTON = "button";
96 public static final String SHELLY2_INPUTT_ANALOG = "analog"; // Shelly Addon: analogous input
99 public static final String SHELLY2_API_MODE_DETACHED = "detached";
100 public static final String SHELLY2_API_MODE_FOLLOW = "follow";
102 // Initial switch states
103 public static final String SHELLY2_API_ISTATE_ON = "on";
104 public static final String SHELLY2_API_ISTATE_OFF = "off";
105 public static final String SHELLY2_API_ISTATE_FOLLOWLAST = "restore_last";
106 public static final String SHELLY2_API_ISTATE_MATCHINPUT = "match_input";
108 // Cover/Roller modes
109 public static final String SHELLY2_RMODE_SINGLE = "single";
110 public static final String SHELLY2_RMODE_DUAL = "dual";
111 public static final String SHELLY2_RMODE_DETACHED = "detached";
113 public static final String SHELLY2_RSTATE_OPENING = "opening";
114 public static final String SHELLY2_RSTATE_OPEN = "open";
115 public static final String SHELLY2_RSTATE_CLOSING = "closing";
116 public static final String SHELLY2_RSTATE_CLOSED = "closed";
117 public static final String SHELLY2_RSTATE_STOPPED = "stopped";
118 public static final String SHELLY2_RSTATE_CALIB = "calibrating";
120 // Event notifications
121 public static final String SHELLY2_EVENT_BTNUP = "btn_up";
122 public static final String SHELLY2_EVENT_BTNDOWN = "btn_down";
123 public static final String SHELLY2_EVENT_1PUSH = "single_push";
124 public static final String SHELLY2_EVENT_2PUSH = "double_push";
125 public static final String SHELLY2_EVENT_3PUSH = "triple_push";
126 public static final String SHELLY2_EVENT_LPUSH = "long_push";
127 public static final String SHELLY2_EVENT_SLPUSH = "short_long_push";
128 public static final String SHELLY2_EVENT_LSPUSH = "long_short_push";
130 public static final String SHELLY2_EVENT_SLEEP = "sleep";
131 public static final String SHELLY2_EVENT_CFGCHANGED = "config_changed";
132 public static final String SHELLY2_EVENT_OTASTART = "ota_begin";
133 public static final String SHELLY2_EVENT_OTAPROGRESS = "ota_progress";
134 public static final String SHELLY2_EVENT_OTADONE = "ota_success";
135 public static final String SHELLY2_EVENT_WIFICONNFAILED = "sta_connect_fail";
136 public static final String SHELLY2_EVENT_WIFIDISCONNECTED = "sta_disconnected";
139 public static final String SHELLY2_BLU_GWSCRIPT = "oh-blu-scanner.js";
140 public static final String SHELLY2_EVENT_BLUPREFIX = "oh-blu.";
141 public static final String SHELLY2_EVENT_BLUSCAN = SHELLY2_EVENT_BLUPREFIX + "scan_result";
142 public static final String SHELLY2_EVENT_BLUDATA = SHELLY2_EVENT_BLUPREFIX + "data";
145 public static final String SHELLY2_ERROR_OVERPOWER = "overpower";
146 public static final String SHELLY2_ERROR_OVERTEMP = "overtemp";
147 public static final String SHELLY2_ERROR_OVERVOLTAGE = "overvoltage";
149 // Wakeup reasons (e.g. Plus HT)
150 public static final String SHELLY2_WAKEUPO_BOOT_POWERON = "poweron";
151 public static final String SHELLY2_WAKEUPO_BOOT_RESTART = "software_restart";
152 public static final String SHELLY2_WAKEUPO_BOOT_WAKEUP = "deepsleep_wake";
153 public static final String SHELLY2_WAKEUPO_BOOT_INTERNAL = "internal";
154 public static final String SHELLY2_WAKEUPO_BOOT_UNKNOWN = "unknown";
156 public static final String SHELLY2_WAKEUPOCAUSE_BUTTON = "button";
157 public static final String SHELLY2_WAKEUPOCAUSE_USB = "usb";
158 public static final String SHELLY2_WAKEUPOCAUSE_PERIODIC = "periodic";
159 public static final String SHELLY2_WAKEUPOCAUSE_UPDATE = "status_update";
160 public static final String SHELLY2_WAKEUPOCAUSE_UNDEFINED = "undefined";
162 // Dimmer US: LED power modes
163 public static final String SHELLY2_POWERLED_ON = "on";
164 public static final String SHELLY2_POWERLED_OFF = "off";
165 public static final String SHELLY2_POWERLED_MATCH = "match_output";
166 public static final String SHELLY2_POWERLED_INVERT = "inverted_output";
168 public class Shelly2DevConfigBle {
169 public Boolean enable;
172 public class Shelly2DevConfigEth {
173 public Boolean enable;
174 public String ipv4mode;
176 public String netmask;
178 public String nameserver;
181 public static class Shelly2DeviceSettings {
186 public String profile;
188 @SerializedName("fw_id")
192 @SerializedName("auth_en")
194 @SerializedName("auth_domain")
195 public String authDomain;
198 public static class Shelly2DeviceConfigAp {
199 public static class Shelly2DeviceConfigApRE {
200 public Boolean enable;
203 public Boolean enable;
205 public String password;
206 @SerializedName("is_open")
207 public Boolean isOpen;
208 @SerializedName("range_extender")
209 Shelly2DeviceConfigApRE rangeExtender;
212 public static class Shelly2DeviceConfig {
213 public class Shelly2DeviceConfigSys {
214 public class Shelly2DeviceConfigDevice {
217 @SerializedName("fw_id")
219 public String profile;
220 @SerializedName("eco_mode")
221 public Boolean ecoMode;
222 public Boolean discoverable;
225 public class Shelly2DeviceConfigLocation {
231 public class Shelly2DeviceConfigSntp {
232 public String server;
235 public class Shelly2DeviceConfigSleep {
236 @SerializedName("wakeup_period")
237 public Integer wakeupPeriod;
240 public class Shelly2DeviceConfigDebug {
241 public class Shelly2DeviceConfigDebugMqtt {
242 public Boolean enable;
245 public class Shelly2DeviceConfigDebugWebSocket {
246 public Boolean enable;
249 public class Shelly2DeviceConfigDebugUdp {
253 public Shelly2DeviceConfigDebugMqtt mqtt;
254 public Shelly2DeviceConfigDebugWebSocket websocket;
255 public Shelly2DeviceConfigDebugUdp udp;
258 public class Shelly2DeviceConfigUiData {
259 public String cover; // hold comma seperated list of roller favorites
262 public class Shelly2DeviceConfigRpcUdp {
263 @SerializedName("dst_addr")
264 public String dstAddr;
265 @SerializedName("listenPort")
266 public String listenPort;
269 @SerializedName("cfg_rev")
270 public Integer cfgRevision;
271 public Shelly2DeviceConfigDevice device;
272 public Shelly2DeviceConfigLocation location;
273 public Shelly2DeviceConfigSntp sntp;
274 public Shelly2DeviceConfigSleep sleep;
275 public Shelly2DeviceConfigDebug debug;
276 @SerializedName("ui_data")
277 public Shelly2DeviceConfigUiData uiData;
278 @SerializedName("rpc_udp")
279 public Shelly2DeviceConfigRpcUdp rpcUdp;
282 public class Shelly2DevConfigInput {
286 public Boolean invert;
287 @SerializedName("factory_reset")
288 public Boolean factoryReset;
289 @SerializedName("report_thr")
290 public Double reportTreshold; // only for type analog
293 public class Shelly2DevConfigSwitch {
297 @SerializedName("in_mode")
300 @SerializedName("initial_state")
301 public String initialState;
302 @SerializedName("auto_on")
303 public Boolean autoOn;
304 @SerializedName("auto_on_delay")
305 public Double autoOnDelay;
306 @SerializedName("auto_off")
307 public Boolean autoOff;
308 @SerializedName("auto_off_delay")
309 public Double autoOffDelay;
310 @SerializedName("power_limit")
311 public Integer powerLimit;
312 @SerializedName("voltage_limit")
313 public Integer voltageLimit;
314 @SerializedName("current_limit")
315 public Double currentLimit;
318 public static class Shelly2DevConfigEm {
321 @SerializedName("blink_mode_selector")
322 public String blinkModeSelector;
323 @SerializedName("phase_selector")
324 public String phase_selector;
325 @SerializedName("monitor_phase_sequence")
326 public Boolean monitorPhaseSequence;
329 public class Shelly2DevConfigPm1 {
334 public class Shelly2DevConfigCover {
335 public class Shelly2DeviceConfigCoverMotor {
336 @SerializedName("idle_power_thr")
337 public Double idle_powerThr;
340 public class Shelly2DeviceConfigCoverSafetySwitch {
341 public Boolean enable;
342 public String direction;
343 public String action;
344 @SerializedName("allowed_move")
345 public String allowedMove;
348 public class Shelly2DeviceConfigCoverObstructionDetection {
349 public Boolean enable;
350 public String direction;
351 public String action;
352 @SerializedName("power_thr")
353 public Integer powerThr;
354 public Double holdoff;
359 public Shelly2DeviceConfigCoverMotor motor;
360 @SerializedName("maxtime_open")
361 public Double maxtimeOpen;
362 @SerializedName("maxtime_close")
363 public Double maxtimeClose;
364 @SerializedName("initial_state")
365 public String initialState;
366 @SerializedName("invert_directions")
367 public Boolean invertDirections;
368 @SerializedName("in_mode")
369 public String inMode;
370 @SerializedName("swap_inputs")
371 public Boolean swapInputs;
372 @SerializedName("safety_switch")
373 public Shelly2DeviceConfigCoverSafetySwitch safetySwitch;
374 @SerializedName("power_limit")
375 public Integer powerLimit;
376 @SerializedName("voltage_limit")
377 public Integer voltageLimit;
378 @SerializedName("current_limit")
379 public Double currentLimit;
380 @SerializedName("obstruction_detection")
381 public Shelly2DeviceConfigCoverObstructionDetection obstructionDetection;
384 public static class Shelly2ConfigSmoke {
386 public Boolean alarm;
390 public static class Shelly2GetConfigLight {
391 public static class Shelly2GetConfigLightDefault {
392 public Integer brightness;
395 public static class Shelly2GetConfigLightNightMode {
396 public boolean enable;
397 public Integer brightness;
402 @SerializedName("initial_state")
403 public String initialState;
404 @SerializedName("auto_on")
405 public Boolean autoOn;
406 @SerializedName("auto_off")
407 public Boolean autoOff;
408 @SerializedName("auto_on_delay")
409 public Double autoOnDelay;
410 @SerializedName("auto_off_delay")
411 public Double autoOffDelay;
412 @SerializedName("default")
413 public Shelly2GetConfigLightDefault defaultCfg;
414 @SerializedName("night_mode")
415 public Shelly2GetConfigLightNightMode nightMode;
418 public class Shelly2DeviceConfigLed {
419 @SerializedName("sys_led_enable")
420 public Boolean sysLedEnable;
421 @SerializedName("power_led")
422 public String powerLed;
425 public static class Shelly2GetConfigResult {
427 public class Shelly2DevConfigCloud {
428 public Boolean enable;
429 public String server;
432 public class Shelly2DevConfigMqtt {
433 public Boolean enable;
434 public String server;
436 @SerializedName("topic_prefix:0")
437 public String topicPrefix;
438 @SerializedName("rpc_ntf")
439 public String rpcNtf;
440 @SerializedName("status_ntf")
441 public String statusNtf;
444 public Shelly2DevConfigBle ble;
445 public Shelly2DevConfigEth eth;
446 public Shelly2DevConfigCloud cloud;
447 public Shelly2DevConfigMqtt mqtt;
448 public Shelly2DeviceConfigSys sys;
449 public Shelly2DeviceConfigWiFi wifi;
450 @SerializedName("wd_ui")
451 public Shelly2DeviceConfigLed led;
453 @SerializedName("input:0")
454 public Shelly2DevConfigInput input0;
455 @SerializedName("input:1")
456 public Shelly2DevConfigInput input1;
457 @SerializedName("input:2")
458 public Shelly2DevConfigInput input2;
459 @SerializedName("input:3")
460 public Shelly2DevConfigInput input3;
462 @SerializedName("switch:0")
463 public Shelly2DevConfigSwitch switch0;
464 @SerializedName("switch:1")
465 public Shelly2DevConfigSwitch switch1;
466 @SerializedName("switch:2")
467 public Shelly2DevConfigSwitch switch2;
468 @SerializedName("switch:3")
469 public Shelly2DevConfigSwitch switch3;
470 @SerializedName("switch:100")
471 public Shelly2DevConfigSwitch switch100; // Pro 3EM Add-On
473 @SerializedName("em:0")
474 public Shelly2DevConfigEm em0;
475 @SerializedName("em1:0")
476 public Shelly2DevConfigEm em10;
477 @SerializedName("em1:1")
478 public Shelly2DevConfigEm em11;
479 @SerializedName("pm1:0")
480 public Shelly2DevConfigPm1 pm10;
482 @SerializedName("cover:0")
483 public Shelly2DevConfigCover cover0;
485 @SerializedName("light:0")
486 public Shelly2GetConfigLight light0;
488 @SerializedName("smoke:0")
489 public Shelly2ConfigSmoke smoke0;
492 public class Shelly2DeviceConfigSta {
494 public String password;
495 @SerializedName("is_open")
496 public Boolean isOpen;
497 public Boolean enable;
498 public String ipv4mode;
500 public String netmask;
502 public String nameserver;
505 public class Shelly2DeviceConfigRoam {
506 @SerializedName("rssi_thr")
507 public Integer rssiThr;
508 public Integer interval;
511 public class Shelly2DeviceConfigWiFi {
512 public Shelly2DeviceConfigAp ap;
513 public Shelly2DeviceConfigSta sta;
514 public Shelly2DeviceConfigSta sta1;
515 public Shelly2DeviceConfigRoam roam;
520 public Shelly2GetConfigResult result;
523 public static class Shelly2DeviceStatus {
524 public class Shelly2InputCounts {
525 public Integer total;
526 @SerializedName("by_minute")
527 public Double[] byMinute;
528 public Double xtotal;
529 @SerializedName("xby_minute")
530 public Double[] xbyMinute;
531 @SerializedName("minute_ts")
532 public Integer minuteTS;
535 public class Shelly2InputStatus {
537 public Boolean state;
538 public Double percent; // analog input only
539 public ArrayList<String> errors;// shown only if at least one error is present.
540 public Double xpercent;
541 public Shelly2InputCounts counts;
546 public static class Shelly2DeviceStatusLight {
548 public String source;
549 public Boolean output;
550 public Double brightness;
551 @SerializedName("timer_started_at")
552 public Double timerStartedAt;
553 @SerializedName("timer_duration")
554 public Integer timerDuration;
557 public static class Shelly2DeviceStatusResult {
558 public class Shelly2DeviceStatusBle {
562 public class Shelly2DeviceStatusCloud {
563 public Boolean connected;
566 public class Shelly2DeviceStatusMqqt {
567 public Boolean connected;
570 public class Shelly2CoverStatus {
572 public String source;
574 public Double apower;
575 public Double voltage;
576 public Double current;
578 public Shelly2Energy aenergy;
579 @SerializedName("current_pos")
580 public Integer currentPos;
581 @SerializedName("target_pos")
582 public Integer targetPos;
583 @SerializedName("move_timeout")
584 public Double moveTimeout;
585 @SerializedName("move_started_at")
586 public Double moveStartedAt;
587 @SerializedName("pos_control")
588 public Boolean posControl;
589 public Shelly2DeviceStatusTemp temperature;
590 public ArrayList<String> errors;
593 public class Shelly2DeviceStatusHumidity {
598 public class Shelly2DeviceStatusIlluminance {
601 public String illumination;
604 public class Shelly2DeviceStatusVoltage {
606 public Double voltage;
609 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
613 public static class Shelly2DeviceStatusPower {
614 public static class Shelly2DeviceStatusBattery {
617 public Double percent;
620 public static class Shelly2DeviceStatusCharger {
621 public Boolean present;
625 public Shelly2DeviceStatusBattery battery;
626 public Shelly2DeviceStatusCharger external;
629 public static class Shelly2DeviceStatusEm {
632 @SerializedName("a_current")
633 public Double aCurrent;
634 @SerializedName("a_voltage")
635 public Double aVoltage;
636 @SerializedName("a_act_power")
637 public Double aActPower;
638 @SerializedName("a_aprt_power")
639 public Double aAprtPower;
640 @SerializedName("a_pf")
643 @SerializedName("b_current")
644 public Double bCurrent;
645 @SerializedName("b_voltage")
646 public Double bVoltage;
647 @SerializedName("b_act_power")
648 public Double bActPower;
649 @SerializedName("b_aprt_power")
650 public Double bAprtPower;
651 @SerializedName("b_pf")
654 @SerializedName("c_current")
655 public Double cCurrent;
656 @SerializedName("c_voltage")
657 public Double cVoltage;
658 @SerializedName("c_act_power")
659 public Double cActPower;
660 @SerializedName("c_aprt_power")
661 public Double cAprtPower;
662 @SerializedName("c_pf")
665 @SerializedName("n_current")
666 public Double nCurrent;
668 @SerializedName("total_current")
669 public Double totalCurrent;
670 @SerializedName("total_act_power")
671 public Double totalActPower;
672 @SerializedName("total_aprt_power")
673 public Double totalAprtPower;
676 public static class Shelly2DeviceStatusEmData {
678 public String[] errors;
681 public class Shelly2DeviceStatusSmoke {
683 public Boolean alarm;
687 public Shelly2DeviceStatusBle ble;
688 public Shelly2DeviceStatusCloud cloud;
689 public Shelly2DeviceStatusMqqt mqtt;
690 public Shelly2DeviceStatusSys sys;
691 public Shelly2DeviceStatusSysWiFi wifi;
693 @SerializedName("input:0")
694 public Shelly2InputStatus input0;
695 @SerializedName("input:1")
696 public Shelly2InputStatus input1;
697 @SerializedName("input:2")
698 public Shelly2InputStatus input2;
699 @SerializedName("input:3")
700 public Shelly2InputStatus input3;
701 @SerializedName("input:100")
702 public Shelly2InputStatus input100; // Digital Input from Add-On
704 @SerializedName("switch:0")
705 public Shelly2RelayStatus switch0;
706 @SerializedName("switch:1")
707 public Shelly2RelayStatus switch1;
708 @SerializedName("switch:2")
709 public Shelly2RelayStatus switch2;
710 @SerializedName("switch:3")
711 public Shelly2RelayStatus switch3;
712 @SerializedName("switch:100")
713 public Shelly2RelayStatus switch100; // Pro 3EM Add-On
715 @SerializedName("pm1:0")
716 public Shelly2RelayStatus pm10;
718 @SerializedName("em:0")
719 public Shelly2DeviceStatusEm em0;
720 @SerializedName("emdata:0")
721 public Shelly2DeviceStatusEmData emdata0;
722 @SerializedName("em1:0")
723 public Shelly2StatusEm1 em10;
724 @SerializedName("em1:1")
725 public Shelly2StatusEm1 em11;
726 @SerializedName("em1data:0")
727 public Shelly2DeviceStatusEmData em1data0;
729 @SerializedName("cover:0")
730 public Shelly2CoverStatus cover0;
732 @SerializedName("light:0")
733 public Shelly2DeviceStatusLight light0;
735 @SerializedName("temperature:0")
736 public Shelly2DeviceStatusTempId temperature0;
737 @SerializedName("temperature:100")
738 public Shelly2DeviceStatusTempId temperature100;
739 @SerializedName("temperature:101")
740 public Shelly2DeviceStatusTempId temperature101;
741 @SerializedName("temperature:102")
742 public Shelly2DeviceStatusTempId temperature102;
743 @SerializedName("temperature:103")
744 public Shelly2DeviceStatusTempId temperature103;
745 @SerializedName("temperature:104")
746 public Shelly2DeviceStatusTempId temperature104;
748 @SerializedName("humidity:0")
749 public Shelly2DeviceStatusHumidity humidity0;
750 @SerializedName("humidity:100")
751 public Shelly2DeviceStatusHumidity humidity100;
753 @SerializedName("illuminance:0")
754 Shelly2DeviceStatusIlluminance illuminance0;
756 @SerializedName("smoke:0")
757 public Shelly2DeviceStatusSmoke smoke0;
759 @SerializedName("voltmeter:100")
760 public Shelly2DeviceStatusVoltage voltmeter100;
762 @SerializedName("devicepower:0")
763 public Shelly2DeviceStatusPower devicepower0;
766 public class Shelly2DeviceStatusSys {
767 public class Shelly2DeviceStatusSysAvlUpdate {
768 public class Shelly2DeviceStatusSysUpdate {
769 public String version;
772 public Shelly2DeviceStatusSysUpdate stable;
773 public Shelly2DeviceStatusSysUpdate beta;
776 public class Shelly2DeviceStatusWakeup {
782 @SerializedName("restart_required")
783 public Boolean restartRequired;
785 public Long unixtime;
787 @SerializedName("ram_size")
789 @SerializedName("ram_free")
791 @SerializedName("fs_size")
793 @SerializedName("fs_free")
795 @SerializedName("cfg_rev")
796 public Integer cfg_rev;
797 @SerializedName("available_updates")
798 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
799 @SerializedName("webhook_rev")
800 public Integer webHookRev;
801 @SerializedName("wakeup_reason")
802 public Shelly2DeviceStatusWakeup wakeUpReason;
803 @SerializedName("wakeup_period")
804 public Integer wakeupPeriod;
807 public class Shelly2DeviceStatusSysWiFi {
808 @SerializedName("sta_ip")
810 public String status;
813 @SerializedName("ap_client_count")
814 public Integer apClientCount;
819 public Shelly2DeviceStatusResult result;
822 public static class Shelly2RelayStatus {
824 public String source;
825 public Boolean output;
826 @SerializedName("timer_started_at")
827 public Double timerStartetAt;
828 @SerializedName("timer_duration")
829 public Integer timerDuration;
830 public Double apower;
831 public Double voltage;
832 public Double current;
834 public Shelly2Energy aenergy;
835 public Shelly2DeviceStatusTemp temperature;
836 public String[] errors;
839 public static class Shelly2Pm1Status {
841 public String source;
842 public Boolean output;
843 @SerializedName("timer_started_at")
844 public Double timerStartetAt;
845 @SerializedName("timer_duration")
846 public Integer timerDuration;
847 public Double apower;
848 public Double voltage;
849 public Double current;
851 public Shelly2Energy aenergy;
852 public Shelly2DeviceStatusTemp temperature;
853 public String[] errors;
856 public static class Shelly2StatusEm1 {
858 public Double current;
859 public Double voltage;
860 @SerializedName("act_power")
861 public Double actPower;
862 @SerializedName("aprt_power")
863 public Double aptrPower;
865 public String calibration;
866 public ArrayList<String> errors;
869 public static class Shelly2DeviceStatusTemp {
874 public static class Shelly2Energy {
875 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
877 @SerializedName("by_minute")
878 public Double[] byMinute;
879 @SerializedName("minute_ts")
880 public Long minuteTs;
883 public static class Shelly2ConfigParms {
885 public Boolean enable;
886 public String server;
887 @SerializedName("ssl_ca")
891 public Shelly2DeviceConfigAp ap;
894 @SerializedName("auto_on")
895 public Boolean autoOn;
896 @SerializedName("auto_on_delay")
897 public Double autoOnDelay;
898 @SerializedName("auto_off")
899 public Boolean autoOff;
900 @SerializedName("auto_off_delay")
901 public Double autoOffDelay;
904 @SerializedName("sys_led_enable")
905 public Boolean sysLedEnable;
906 @SerializedName("power_led")
907 public String powerLed;
910 public static class Shelly2RpcRequest {
911 public Integer id = 0;
912 public String method;
914 public static class Shelly2RpcRequestParams {
915 public Integer id = 1;
922 public Integer brightness;
923 @SerializedName("toggle_after")
924 public Integer toggleAfter;
936 public Shelly2ConfigParms config;
941 public Shelly2RpcRequestParams withConfig() {
942 config = new Shelly2ConfigParms();
947 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
949 public Shelly2RpcRequest() {
952 public Shelly2RpcRequest withMethod(String method) {
953 this.method = method;
957 public Shelly2RpcRequest withId(int id) {
962 public Shelly2RpcRequest withPos(int pos) {
967 public Shelly2RpcRequest withName(String name) {
973 public static class Shelly2WsConfigResponse {
977 public static class Shelly2WsConfigResult {
978 @SerializedName("restart_required")
979 public Boolean restartRequired;
982 public Shelly2WsConfigResult result;
985 public static class ShellyScriptListResponse {
986 public static class ShellyScriptListEntry {
989 public Boolean enable;
990 public Boolean running;
993 public ArrayList<ShellyScriptListEntry> scripts;
996 public static class ShellyScriptResponse {
998 public Boolean running;
1003 public static class ShellyScriptPutCodeParams {
1006 public Boolean append;
1009 public static class Shelly2RpcBaseMessage {
1010 // Basic message format, e.g.
1011 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
1012 public class Shelly2RpcMessageError {
1013 public Integer code;
1014 public String message;
1020 public String component;
1021 public String method;
1022 public Object params;
1023 public String event;
1024 public Object result;
1025 public Shelly2AuthRsp auth;
1026 public Shelly2RpcMessageError error;
1029 public static class Shelly2RpcNotifyStatus {
1030 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
1037 public String method;
1038 public Shelly2NotifyStatus params;
1039 public Shelly2NotifyStatus result;
1040 public Shelly2RpcMessageError error;
1043 public static String SHELLY2_AUTHDEF_USER = "admin";
1044 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
1045 public static String SHELLY2_AUTHTTYPE_STRING = "string";
1046 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
1047 // = ':auth:'+HexHash("dummy_method:dummy_uri");
1048 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
1050 public static class Shelly2AuthChallenge { // on 401 message contains the auth info
1051 @SerializedName("auth_type")
1052 public String authType;
1053 public String nonce;
1055 public String realm;
1056 public String algorithm;
1059 public static class Shelly2AuthRsp {
1060 public String username;
1061 public String nonce;
1062 public String cnonce;
1064 public String realm;
1065 public String algorithm;
1066 public String response;
1067 @SerializedName("auth_type")
1068 public String authType;
1073 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1074 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1075 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1076 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
1077 // "ts":1682877399.22}
1080 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1081 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1082 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1083 // "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},
1084 // "ts":1682877414.25}
1086 public class Shelly2NotifyEventMessage {
1089 public Boolean encryption;
1090 @SerializedName("BTHome_version")
1091 public Integer bthVersion;
1093 @SerializedName("Battery")
1094 public Integer battery;
1095 @SerializedName("Button")
1096 public Integer buttonEvent;
1097 @SerializedName("Illuminance")
1098 public Integer illuminance;
1099 @SerializedName("Window")
1100 public Integer windowState;
1101 @SerializedName("Rotation")
1102 public Double rotation;
1103 @SerializedName("Motion")
1104 public Integer motionState;
1105 @SerializedName("Temperature")
1106 public Double temperature;
1107 @SerializedName("Humidity")
1108 public Double humidity;
1110 public Integer rssi;
1111 public Integer tx_power;
1114 public class Shelly2NotifyEvent {
1117 public String component;
1118 public String event;
1119 public Shelly2NotifyEventMessage data;
1121 public Integer reason;
1122 @SerializedName("cfg_rev")
1123 public Integer cfgRev;
1126 public class Shelly2NotifyEventData {
1128 public ArrayList<Shelly2NotifyEvent> events;
1131 public static class Shelly2RpcNotifyEvent {
1134 public Shelly2NotifyEventData params;