2 * Copyright (c) 2010-2023 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_METHOD_CLASS_SHELLY = "Shelly";
31 public static final String SHELLYRPC_METHOD_CLASS_SWITCH = "Switch";
33 public static final String SHELLYRPC_METHOD_GETDEVCONFIG = "GetDeviceInfo";
34 public static final String SHELLYRPC_METHOD_GETSYSCONFIG = "GetSysConfig"; // only sys
35 public static final String SHELLYRPC_METHOD_GETCONFIG = "GetConfig"; // sys + components
36 public static final String SHELLYRPC_METHOD_GETSYSSTATUS = "GetSysStatus"; // only sys
37 public static final String SHELLYRPC_METHOD_GETSTATUS = "GetStatus"; // sys + components
38 public static final String SHELLYRPC_METHOD_REBOOT = "Shelly.Reboot";
39 public static final String SHELLYRPC_METHOD_RESET = "Shelly.FactoryReset";
40 public static final String SHELLYRPC_METHOD_CHECKUPD = "Shelly.CheckForUpdate";
41 public static final String SHELLYRPC_METHOD_UPDATE = "Shelly.Update";
42 public static final String SHELLYRPC_METHOD_AUTHSET = "Shelly.SetAuth";
43 public static final String SHELLYRPC_METHOD_SWITCH_STATUS = "Switch.GetStatus";
44 public static final String SHELLYRPC_METHOD_SWITCH_SET = "Switch.Set";
45 public static final String SHELLYRPC_METHOD_SWITCH_SETCONFIG = "Switch.SetConfig";
46 public static final String SHELLYRPC_METHOD_COVER_SETPOS = "Cover.GoToPosition";
47 public static final String SHELLY2_COVER_CMD_OPEN = "Open";
48 public static final String SHELLY2_COVER_CMD_CLOSE = "Close";
49 public static final String SHELLY2_COVER_CMD_STOP = "Stop";
50 public static final String SHELLYRPC_METHOD_WIFIGETCONG = "Wifi.GetConfig";
51 public static final String SHELLYRPC_METHOD_WIFISETCONG = "Wifi.SetConfig";
52 public static final String SHELLYRPC_METHOD_ETHGETCONG = "Eth.GetConfig";
53 public static final String SHELLYRPC_METHOD_ETHSETCONG = "Eth.SetConfig";
54 public static final String SHELLYRPC_METHOD_BLEGETCONG = "BLE.GetConfig";
55 public static final String SHELLYRPC_METHOD_BLESETCONG = "BLE.SetConfig";
56 public static final String SHELLYRPC_METHOD_CLOUDSET = "Cloud.SetConfig";
57 public static final String SHELLYRPC_METHOD_WSGETCONFIG = "WS.GetConfig";
58 public static final String SHELLYRPC_METHOD_WSSETCONFIG = "WS.SetConfig";
59 public static final String SHELLYRPC_METHOD_SMOKE_SETCONFIG = "Smoke.SetConfig";
60 public static final String SHELLYRPC_METHOD_SMOKE_MUTE = "Smoke.Mute";
61 public static final String SHELLYRPC_METHOD_SCRIPT_LIST = "Script.List";
62 public static final String SHELLYRPC_METHOD_SCRIPT_SETCONFIG = "Script.SetConfig";
63 public static final String SHELLYRPC_METHOD_SCRIPT_GETSTATUS = "Script.GetStatus";
64 public static final String SHELLYRPC_METHOD_SCRIPT_DELETE = "Script.Delete";
65 public static final String SHELLYRPC_METHOD_SCRIPT_CREATE = "Script.Create";
66 public static final String SHELLYRPC_METHOD_SCRIPT_GETCODE = "Script.GetCode";
67 public static final String SHELLYRPC_METHOD_SCRIPT_PUTCODE = "Script.PutCode";
68 public static final String SHELLYRPC_METHOD_SCRIPT_START = "Script.Start";
69 public static final String SHELLYRPC_METHOD_SCRIPT_STOP = "Script.Stop";
71 public static final String SHELLYRPC_METHOD_NOTIFYSTATUS = "NotifyStatus"; // inbound status
72 public static final String SHELLYRPC_METHOD_NOTIFYFULLSTATUS = "NotifyFullStatus"; // inbound status from bat device
73 public static final String SHELLYRPC_METHOD_NOTIFYEVENT = "NotifyEvent"; // inbound event
76 public static final String SHELLY2_PROFILE_RELAY = "switch";
77 public static final String SHELLY2_PROFILE_ROLLER = "cover";
80 public static final String SHELLY2_BTNT_MOMENTARY = "momentary";
81 public static final String SHELLY2_BTNT_FLIP = "flip";
82 public static final String SHELLY2_BTNT_FOLLOW = "follow";
83 public static final String SHELLY2_BTNT_DETACHED = "detached";
86 public static final String SHELLY2_INPUTT_SWITCH = "switch";
87 public static final String SHELLY2_INPUTT_BUTTON = "button";
88 public static final String SHELLY2_INPUTT_ANALOG = "analog"; // Shelly Addon: analogous input
91 public static final String SHELLY2_API_MODE_DETACHED = "detached";
92 public static final String SHELLY2_API_MODE_FOLLOW = "follow";
94 // Initial switch states
95 public static final String SHELLY2_API_ISTATE_ON = "on";
96 public static final String SHELLY2_API_ISTATE_OFF = "off";
97 public static final String SHELLY2_API_ISTATE_FOLLOWLAST = "restore_last";
98 public static final String SHELLY2_API_ISTATE_MATCHINPUT = "match_input";
100 // Cover/Roller modes
101 public static final String SHELLY2_RMODE_SINGLE = "single";
102 public static final String SHELLY2_RMODE_DUAL = "dual";
103 public static final String SHELLY2_RMODE_DETACHED = "detached";
105 public static final String SHELLY2_RSTATE_OPENING = "opening";
106 public static final String SHELLY2_RSTATE_OPEN = "open";
107 public static final String SHELLY2_RSTATE_CLOSING = "closing";
108 public static final String SHELLY2_RSTATE_CLOSED = "closed";
109 public static final String SHELLY2_RSTATE_STOPPED = "stopped";
110 public static final String SHELLY2_RSTATE_CALIB = "calibrating";
112 // Event notifications
113 public static final String SHELLY2_EVENT_BTNUP = "btn_up";
114 public static final String SHELLY2_EVENT_BTNDOWN = "btn_down";
115 public static final String SHELLY2_EVENT_1PUSH = "single_push";
116 public static final String SHELLY2_EVENT_2PUSH = "double_push";
117 public static final String SHELLY2_EVENT_3PUSH = "triple_push";
118 public static final String SHELLY2_EVENT_LPUSH = "long_push";
119 public static final String SHELLY2_EVENT_SLPUSH = "short_long_push";
120 public static final String SHELLY2_EVENT_LSPUSH = "long_short_push";
122 public static final String SHELLY2_EVENT_SLEEP = "sleep";
123 public static final String SHELLY2_EVENT_CFGCHANGED = "config_changed";
124 public static final String SHELLY2_EVENT_OTASTART = "ota_begin";
125 public static final String SHELLY2_EVENT_OTAPROGRESS = "ota_progress";
126 public static final String SHELLY2_EVENT_OTADONE = "ota_success";
127 public static final String SHELLY2_EVENT_WIFICONNFAILED = "sta_connect_fail";
128 public static final String SHELLY2_EVENT_WIFIDISCONNECTED = "sta_disconnected";
131 public static final String SHELLY2_BLU_GWSCRIPT = "oh-blu-scanner.js";
132 public static final String SHELLY2_EVENT_BLUPREFIX = "oh-blu.";
133 public static final String SHELLY2_EVENT_BLUSCAN = SHELLY2_EVENT_BLUPREFIX + "scan_result";
134 public static final String SHELLY2_EVENT_BLUDATA = SHELLY2_EVENT_BLUPREFIX + "data";
137 public static final String SHELLY2_ERROR_OVERPOWER = "overpower";
138 public static final String SHELLY2_ERROR_OVERTEMP = "overtemp";
139 public static final String SHELLY2_ERROR_OVERVOLTAGE = "overvoltage";
141 // Wakeup reasons (e.g. Plus HT)
142 public static final String SHELLY2_WAKEUPO_BOOT_POWERON = "poweron";
143 public static final String SHELLY2_WAKEUPO_BOOT_RESTART = "software_restart";
144 public static final String SHELLY2_WAKEUPO_BOOT_WAKEUP = "deepsleep_wake";
145 public static final String SHELLY2_WAKEUPO_BOOT_INTERNAL = "internal";
146 public static final String SHELLY2_WAKEUPO_BOOT_UNKNOWN = "unknown";
148 public static final String SHELLY2_WAKEUPOCAUSE_BUTTON = "button";
149 public static final String SHELLY2_WAKEUPOCAUSE_USB = "usb";
150 public static final String SHELLY2_WAKEUPOCAUSE_PERIODIC = "periodic";
151 public static final String SHELLY2_WAKEUPOCAUSE_UPDATE = "status_update";
152 public static final String SHELLY2_WAKEUPOCAUSE_UNDEFINED = "undefined";
154 public class Shelly2DevConfigBle {
155 public Boolean enable;
158 public class Shelly2DevConfigEth {
159 public Boolean enable;
160 public String ipv4mode;
162 public String netmask;
164 public String nameserver;
167 public static class Shelly2DeviceSettings {
173 @SerializedName("fw_id")
174 public String firmware;
177 @SerializedName("auth_en")
178 public Boolean authEnable;
179 @SerializedName("auth_domain")
180 public String authDomain;
183 public static class Shelly2DeviceConfigAp {
184 public static class Shelly2DeviceConfigApRE {
185 public Boolean enable;
188 public Boolean enable;
190 public String password;
191 @SerializedName("is_open")
192 public Boolean isOpen;
193 @SerializedName("range_extender")
194 Shelly2DeviceConfigApRE rangeExtender;
197 public static class Shelly2DeviceConfig {
198 public class Shelly2DeviceConfigSys {
199 public class Shelly2DeviceConfigDevice {
202 @SerializedName("fw_id")
204 public String profile;
205 @SerializedName("eco_mode")
206 public Boolean ecoMode;
207 public Boolean discoverable;
210 public class Shelly2DeviceConfigLocation {
216 public class Shelly2DeviceConfigSntp {
217 public String server;
220 public class Shelly2DeviceConfigSleep {
221 @SerializedName("wakeup_period")
222 public Integer wakeupPeriod;
225 public class Shelly2DeviceConfigDebug {
226 public class Shelly2DeviceConfigDebugMqtt {
227 public Boolean enable;
230 public class Shelly2DeviceConfigDebugWebSocket {
231 public Boolean enable;
234 public class Shelly2DeviceConfigDebugUdp {
238 public Shelly2DeviceConfigDebugMqtt mqtt;
239 public Shelly2DeviceConfigDebugWebSocket websocket;
240 public Shelly2DeviceConfigDebugUdp udp;
243 public class Shelly2DeviceConfigUiData {
244 public String cover; // hold comma seperated list of roller favorites
247 public class Shelly2DeviceConfigRpcUdp {
248 @SerializedName("dst_addr")
249 public String dstAddr;
250 @SerializedName("listenPort")
251 public String listenPort;
254 @SerializedName("cfg_rev")
255 public Integer cfgRevision;
256 public Shelly2DeviceConfigDevice device;
257 public Shelly2DeviceConfigLocation location;
258 public Shelly2DeviceConfigSntp sntp;
259 public Shelly2DeviceConfigSleep sleep;
260 public Shelly2DeviceConfigDebug debug;
261 @SerializedName("ui_data")
262 public Shelly2DeviceConfigUiData uiData;
263 @SerializedName("rpc_udp")
264 public Shelly2DeviceConfigRpcUdp rpcUdp;
267 public class Shelly2DevConfigInput {
271 public Boolean invert;
272 @SerializedName("factory_reset")
273 public Boolean factoryReset;
274 @SerializedName("report_thr")
275 public Double reportTreshold; // only for type analog
278 public class Shelly2DevConfigSwitch {
282 @SerializedName("in_mode")
285 @SerializedName("initial_state")
286 public String initialState;
287 @SerializedName("auto_on")
288 public Boolean autoOn;
289 @SerializedName("auto_on_delay")
290 public Double autoOnDelay;
291 @SerializedName("auto_off")
292 public Boolean autoOff;
293 @SerializedName("auto_off_delay")
294 public Double autoOffDelay;
295 @SerializedName("power_limit")
296 public Integer powerLimit;
297 @SerializedName("voltage_limit")
298 public Integer voltageLimit;
299 @SerializedName("current_limit")
300 public Double currentLimit;
303 public static class Shelly2DevConfigEm {
306 @SerializedName("blink_mode_selector")
307 public String blinkModeSelector;
308 @SerializedName("phase_selector")
309 public String phase_selector;
310 @SerializedName("monitor_phase_sequence")
311 public Boolean monitorPhaseSequence;
314 public class Shelly2DevConfigCover {
315 public class Shelly2DeviceConfigCoverMotor {
316 @SerializedName("idle_power_thr")
317 public Double idle_powerThr;
320 public class Shelly2DeviceConfigCoverSafetySwitch {
321 public Boolean enable;
322 public String direction;
323 public String action;
324 @SerializedName("allowed_move")
325 public String allowedMove;
328 public class Shelly2DeviceConfigCoverObstructionDetection {
329 public Boolean enable;
330 public String direction;
331 public String action;
332 @SerializedName("power_thr")
333 public Integer powerThr;
334 public Double holdoff;
339 public Shelly2DeviceConfigCoverMotor motor;
340 @SerializedName("maxtime_open")
341 public Double maxtimeOpen;
342 @SerializedName("maxtime_close")
343 public Double maxtimeClose;
344 @SerializedName("initial_state")
345 public String initialState;
346 @SerializedName("invert_directions")
347 public Boolean invertDirections;
348 @SerializedName("in_mode")
349 public String inMode;
350 @SerializedName("swap_inputs")
351 public Boolean swapInputs;
352 @SerializedName("safety_switch")
353 public Shelly2DeviceConfigCoverSafetySwitch safetySwitch;
354 @SerializedName("power_limit")
355 public Integer powerLimit;
356 @SerializedName("voltage_limit")
357 public Integer voltageLimit;
358 @SerializedName("current_limit")
359 public Double currentLimit;
360 @SerializedName("obstruction_detection")
361 public Shelly2DeviceConfigCoverObstructionDetection obstructionDetection;
364 public static class Shelly2ConfigSmoke {
366 public Boolean alarm;
370 public static class Shelly2GetConfigResult {
372 public class Shelly2DevConfigCloud {
373 public Boolean enable;
374 public String server;
377 public class Shelly2DevConfigMqtt {
378 public Boolean enable;
379 public String server;
381 @SerializedName("topic_prefix:0")
382 public String topicPrefix;
383 @SerializedName("rpc_ntf")
384 public String rpcNtf;
385 @SerializedName("status_ntf")
386 public String statusNtf;
389 public Shelly2DevConfigBle ble;
390 public Shelly2DevConfigEth eth;
391 public Shelly2DevConfigCloud cloud;
392 public Shelly2DevConfigMqtt mqtt;
393 public Shelly2DeviceConfigSys sys;
394 public Shelly2DeviceConfigWiFi wifi;
396 @SerializedName("input:0")
397 public Shelly2DevConfigInput input0;
398 @SerializedName("input:1")
399 public Shelly2DevConfigInput input1;
400 @SerializedName("input:2")
401 public Shelly2DevConfigInput input2;
402 @SerializedName("input:3")
403 public Shelly2DevConfigInput input3;
405 @SerializedName("switch:0")
406 public Shelly2DevConfigSwitch switch0;
407 @SerializedName("switch:1")
408 public Shelly2DevConfigSwitch switch1;
409 @SerializedName("switch:2")
410 public Shelly2DevConfigSwitch switch2;
411 @SerializedName("switch:3")
412 public Shelly2DevConfigSwitch switch3;
414 @SerializedName("em:0")
415 public Shelly2DevConfigEm em0;
417 @SerializedName("cover:0")
418 public Shelly2DevConfigCover cover0;
420 @SerializedName("smoke:0")
421 public Shelly2ConfigSmoke smoke0;
424 public class Shelly2DeviceConfigSta {
426 public String password;
427 @SerializedName("is_open")
428 public Boolean isOpen;
429 public Boolean enable;
430 public String ipv4mode;
432 public String netmask;
434 public String nameserver;
437 public class Shelly2DeviceConfigRoam {
438 @SerializedName("rssi_thr")
439 public Integer rssiThr;
440 public Integer interval;
443 public class Shelly2DeviceConfigWiFi {
444 public Shelly2DeviceConfigAp ap;
445 public Shelly2DeviceConfigSta sta;
446 public Shelly2DeviceConfigSta sta1;
447 public Shelly2DeviceConfigRoam roam;
452 public Shelly2GetConfigResult result;
455 public static class Shelly2DeviceStatus {
456 public class Shelly2InputStatus {
458 public Boolean state;
459 public Double percent; // analog input only
460 public ArrayList<String> errors;// shown only if at least one error is present.
463 public static class Shelly2DeviceStatusResult {
464 public class Shelly2DeviceStatusBle {
468 public class Shelly2DeviceStatusCloud {
469 public Boolean connected;
472 public class Shelly2DeviceStatusMqqt {
473 public Boolean connected;
476 public class Shelly2CoverStatus {
478 public String source;
480 public Double apower;
481 public Double voltage;
482 public Double current;
484 public Shelly2Energy aenergy;
485 @SerializedName("current_pos")
486 public Integer currentPos;
487 @SerializedName("target_pos")
488 public Integer targetPos;
489 @SerializedName("move_timeout")
490 public Double moveTimeout;
491 @SerializedName("move_started_at")
492 public Double moveStartedAt;
493 @SerializedName("pos_control")
494 public Boolean posControl;
495 public Shelly2DeviceStatusTemp temperature;
496 public ArrayList<String> errors;
499 public class Shelly2DeviceStatusHumidity {
504 public class Shelly2DeviceStatusVoltage {
506 public Double voltage;
509 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
513 public static class Shelly2DeviceStatusPower {
514 public static class Shelly2DeviceStatusBattery {
517 public Double percent;
520 public static class Shelly2DeviceStatusCharger {
521 public Boolean present;
525 public Shelly2DeviceStatusBattery battery;
526 public Shelly2DeviceStatusCharger external;
529 public static class Shelly2DeviceStatusEm {
532 @SerializedName("a_current")
533 public Double aCurrent;
534 @SerializedName("a_voltage")
535 public Double aVoltage;
536 @SerializedName("a_act_power")
537 public Double aActPower;
538 @SerializedName("a_aprt_power")
539 public Double aAprtPower;
540 @SerializedName("a_pf")
543 @SerializedName("b_current")
544 public Double bCurrent;
545 @SerializedName("b_voltage")
546 public Double bVoltage;
547 @SerializedName("b_act_power")
548 public Double bActPower;
549 @SerializedName("b_aprt_power")
550 public Double bAprtPower;
551 @SerializedName("b_pf")
554 @SerializedName("c_current")
555 public Double cCurrent;
556 @SerializedName("c_voltage")
557 public Double cVoltage;
558 @SerializedName("c_act_power")
559 public Double cActPower;
560 @SerializedName("c_aprt_power")
561 public Double cAprtPower;
562 @SerializedName("c_pf")
565 @SerializedName("n_current")
566 public Double nCurrent;
568 @SerializedName("total_current")
569 public Double totalCurrent;
570 @SerializedName("total_act_power")
571 public Double totalActPower;
572 @SerializedName("total_aprt_power")
573 public Double totalAprtPower;
576 public static class Shelly2DeviceStatusEmData {
578 public String[] errors;
581 public class Shelly2DeviceStatusSmoke {
583 public Boolean alarm;
587 public Shelly2DeviceStatusBle ble;
588 public Shelly2DeviceStatusCloud cloud;
589 public Shelly2DeviceStatusMqqt mqtt;
590 public Shelly2DeviceStatusSys sys;
591 public Shelly2DeviceStatusSysWiFi wifi;
593 @SerializedName("input:0")
594 public Shelly2InputStatus input0;
595 @SerializedName("input:1")
596 public Shelly2InputStatus input1;
597 @SerializedName("input:2")
598 public Shelly2InputStatus input2;
599 @SerializedName("input:3")
600 public Shelly2InputStatus input3;
601 @SerializedName("input:100")
602 public Shelly2InputStatus input100; // Digital Input from Add-On
604 @SerializedName("switch:0")
605 public Shelly2RelayStatus switch0;
606 @SerializedName("switch:1")
607 public Shelly2RelayStatus switch1;
608 @SerializedName("switch:2")
609 public Shelly2RelayStatus switch2;
610 @SerializedName("switch:3")
611 public Shelly2RelayStatus switch3;
613 @SerializedName("em:0")
614 Shelly2DeviceStatusEm em0;
615 @SerializedName("emdata:0")
616 Shelly2DeviceStatusEmData emdata0;
618 @SerializedName("cover:0")
619 public Shelly2CoverStatus cover0;
621 @SerializedName("temperature:0")
622 public Shelly2DeviceStatusTempId temperature0;
623 @SerializedName("temperature:100")
624 public Shelly2DeviceStatusTempId temperature100;
625 @SerializedName("temperature:101")
626 public Shelly2DeviceStatusTempId temperature101;
627 @SerializedName("temperature:102")
628 public Shelly2DeviceStatusTempId temperature102;
629 @SerializedName("temperature:103")
630 public Shelly2DeviceStatusTempId temperature103;
631 @SerializedName("temperature:104")
632 public Shelly2DeviceStatusTempId temperature104;
634 @SerializedName("humidity:0")
635 public Shelly2DeviceStatusHumidity humidity0;
636 @SerializedName("humidity:100")
637 public Shelly2DeviceStatusHumidity humidity100;
638 @SerializedName("smoke:0")
639 public Shelly2DeviceStatusSmoke smoke0;
641 @SerializedName("voltmeter:100")
642 public Shelly2DeviceStatusVoltage voltmeter100;
644 @SerializedName("devicepower:0")
645 public Shelly2DeviceStatusPower devicepower0;
648 public class Shelly2DeviceStatusSys {
649 public class Shelly2DeviceStatusSysAvlUpdate {
650 public class Shelly2DeviceStatusSysUpdate {
651 public String version;
654 public Shelly2DeviceStatusSysUpdate stable;
655 public Shelly2DeviceStatusSysUpdate beta;
658 public class Shelly2DeviceStatusWakeup {
664 @SerializedName("restart_required")
665 public Boolean restartRequired;
667 public Long unixtime;
669 @SerializedName("ram_size")
671 @SerializedName("ram_free")
673 @SerializedName("fs_size")
675 @SerializedName("fs_free")
677 @SerializedName("cfg_rev")
678 public Integer cfg_rev;
679 @SerializedName("available_updates")
680 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
681 @SerializedName("webhook_rev")
682 public Integer webHookRev;
683 @SerializedName("wakeup_reason")
684 public Shelly2DeviceStatusWakeup wakeUpReason;
685 @SerializedName("wakeup_period")
686 public Integer wakeupPeriod;
689 public class Shelly2DeviceStatusSysWiFi {
690 @SerializedName("sta_ip")
692 public String status;
695 @SerializedName("ap_client_count")
696 public Integer apClientCount;
701 public Shelly2DeviceStatusResult result;
704 public static class Shelly2RelayStatus {
706 public String source;
707 public Boolean output;
708 @SerializedName("timer_started_at")
709 public Double timerStartetAt;
710 @SerializedName("timer_duration")
711 public Integer timerDuration;
712 public Double apower;
713 public Double voltage;
714 public Double current;
716 public Shelly2Energy aenergy;
717 public Shelly2DeviceStatusTemp temperature;
718 public String[] errors;
721 public static class Shelly2DeviceStatusTemp {
726 public static class Shelly2Energy {
727 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
729 @SerializedName("by_minute")
730 public Double[] byMinute;
731 @SerializedName("minute_ts")
732 public Long minuteTs;
735 public static class Shelly2ConfigParms {
737 public Boolean enable;
738 public String server;
739 @SerializedName("ssl_ca")
743 public Shelly2DeviceConfigAp ap;
746 @SerializedName("auto_on")
747 public Boolean autoOn;
748 @SerializedName("auto_on_delay")
749 public Double autoOnDelay;
750 @SerializedName("auto_off")
751 public Boolean autoOff;
752 @SerializedName("auto_off_delay")
753 public Double autoOffDelay;
756 public static class Shelly2RpcRequest {
757 public Integer id = 0;
758 public String method;
760 public static class Shelly2RpcRequestParams {
761 public Integer id = 1;
777 public Shelly2ConfigParms config;
782 public Shelly2RpcRequestParams withConfig() {
783 config = new Shelly2ConfigParms();
788 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
790 public Shelly2RpcRequest() {
793 public Shelly2RpcRequest withMethod(String method) {
794 this.method = method;
798 public Shelly2RpcRequest withId(int id) {
803 public Shelly2RpcRequest withPos(int pos) {
808 public Shelly2RpcRequest withName(String name) {
814 public static class Shelly2WsConfigResponse {
818 public static class Shelly2WsConfigResult {
819 @SerializedName("restart_required")
820 public Boolean restartRequired;
823 public Shelly2WsConfigResult result;
826 public static class ShellyScriptListResponse {
827 public static class ShellyScriptListEntry {
830 public Boolean enable;
831 public Boolean running;
834 public ArrayList<ShellyScriptListEntry> scripts;
837 public static class ShellyScriptResponse {
839 public Boolean running;
844 public static class ShellyScriptPutCodeParams {
847 public Boolean append;
850 public static class Shelly2RpcBaseMessage {
851 // Basic message format, e.g.
852 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
853 public class Shelly2RpcMessageError {
855 public String message;
861 public String component;
862 public String method;
863 public Object params;
865 public Object result;
866 public Shelly2AuthRequest auth;
867 public Shelly2RpcMessageError error;
870 public static class Shelly2RpcNotifyStatus {
871 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
878 public String method;
879 public Shelly2NotifyStatus params;
880 public Shelly2NotifyStatus result;
881 public Shelly2RpcMessageError error;
884 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
885 public static String SHELLY2_AUTHTTYPE_STRING = "string";
886 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
887 // = ':auth:'+HexHash("dummy_method:dummy_uri");
888 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
890 public static class Shelly2AuthRequest {
891 public String username;
896 public String algorithm;
897 public String response;
898 @SerializedName("auth_type")
899 public String authType;
902 public static class Shelly2AuthResponse { // on 401 message contains the auth info
903 @SerializedName("auth_type")
904 public String authType;
908 public String algorithm;
913 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
914 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
915 // {"component":"script:2", "id":2, "event":"oh-blu.data",
916 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
917 // "ts":1682877399.22}
920 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
921 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
922 // {"component":"script:2", "id":2, "event":"oh-blu.data",
923 // "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},
924 // "ts":1682877414.25}
926 public class Shelly2NotifyEventMessage {
929 public Boolean encryption;
930 @SerializedName("BTHome_version")
931 public Integer bthVersion;
933 @SerializedName("Battery")
934 public Integer battery;
935 @SerializedName("Button")
936 public Integer buttonEvent;
937 @SerializedName("Illuminance")
938 public Integer illuminance;
939 @SerializedName("Window")
940 public Integer windowState;
941 @SerializedName("Rotation")
942 public Double rotation;
945 public Integer tx_power;
948 public class Shelly2NotifyEvent {
951 public String component;
953 public Shelly2NotifyEventMessage data;
955 public Integer reason;
956 @SerializedName("cfg_rev")
957 public Integer cfgRev;
960 public class Shelly2NotifyEventData {
962 public ArrayList<Shelly2NotifyEvent> events;
965 public static class Shelly2RpcNotifyEvent {
968 public Shelly2NotifyEventData params;