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_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_ROLLER = "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 {
187 @SerializedName("fw_id")
188 public String firmware;
191 @SerializedName("auth_en")
192 public Boolean authEnable;
193 @SerializedName("auth_domain")
194 public String authDomain;
197 public static class Shelly2DeviceConfigAp {
198 public static class Shelly2DeviceConfigApRE {
199 public Boolean enable;
202 public Boolean enable;
204 public String password;
205 @SerializedName("is_open")
206 public Boolean isOpen;
207 @SerializedName("range_extender")
208 Shelly2DeviceConfigApRE rangeExtender;
211 public static class Shelly2DeviceConfig {
212 public class Shelly2DeviceConfigSys {
213 public class Shelly2DeviceConfigDevice {
216 @SerializedName("fw_id")
218 public String profile;
219 @SerializedName("eco_mode")
220 public Boolean ecoMode;
221 public Boolean discoverable;
224 public class Shelly2DeviceConfigLocation {
230 public class Shelly2DeviceConfigSntp {
231 public String server;
234 public class Shelly2DeviceConfigSleep {
235 @SerializedName("wakeup_period")
236 public Integer wakeupPeriod;
239 public class Shelly2DeviceConfigDebug {
240 public class Shelly2DeviceConfigDebugMqtt {
241 public Boolean enable;
244 public class Shelly2DeviceConfigDebugWebSocket {
245 public Boolean enable;
248 public class Shelly2DeviceConfigDebugUdp {
252 public Shelly2DeviceConfigDebugMqtt mqtt;
253 public Shelly2DeviceConfigDebugWebSocket websocket;
254 public Shelly2DeviceConfigDebugUdp udp;
257 public class Shelly2DeviceConfigUiData {
258 public String cover; // hold comma seperated list of roller favorites
261 public class Shelly2DeviceConfigRpcUdp {
262 @SerializedName("dst_addr")
263 public String dstAddr;
264 @SerializedName("listenPort")
265 public String listenPort;
268 @SerializedName("cfg_rev")
269 public Integer cfgRevision;
270 public Shelly2DeviceConfigDevice device;
271 public Shelly2DeviceConfigLocation location;
272 public Shelly2DeviceConfigSntp sntp;
273 public Shelly2DeviceConfigSleep sleep;
274 public Shelly2DeviceConfigDebug debug;
275 @SerializedName("ui_data")
276 public Shelly2DeviceConfigUiData uiData;
277 @SerializedName("rpc_udp")
278 public Shelly2DeviceConfigRpcUdp rpcUdp;
281 public class Shelly2DevConfigInput {
285 public Boolean invert;
286 @SerializedName("factory_reset")
287 public Boolean factoryReset;
288 @SerializedName("report_thr")
289 public Double reportTreshold; // only for type analog
292 public class Shelly2DevConfigSwitch {
296 @SerializedName("in_mode")
299 @SerializedName("initial_state")
300 public String initialState;
301 @SerializedName("auto_on")
302 public Boolean autoOn;
303 @SerializedName("auto_on_delay")
304 public Double autoOnDelay;
305 @SerializedName("auto_off")
306 public Boolean autoOff;
307 @SerializedName("auto_off_delay")
308 public Double autoOffDelay;
309 @SerializedName("power_limit")
310 public Integer powerLimit;
311 @SerializedName("voltage_limit")
312 public Integer voltageLimit;
313 @SerializedName("current_limit")
314 public Double currentLimit;
317 public static class Shelly2DevConfigEm {
320 @SerializedName("blink_mode_selector")
321 public String blinkModeSelector;
322 @SerializedName("phase_selector")
323 public String phase_selector;
324 @SerializedName("monitor_phase_sequence")
325 public Boolean monitorPhaseSequence;
328 public class Shelly2DevConfigPm1 {
333 public class Shelly2DevConfigCover {
334 public class Shelly2DeviceConfigCoverMotor {
335 @SerializedName("idle_power_thr")
336 public Double idle_powerThr;
339 public class Shelly2DeviceConfigCoverSafetySwitch {
340 public Boolean enable;
341 public String direction;
342 public String action;
343 @SerializedName("allowed_move")
344 public String allowedMove;
347 public class Shelly2DeviceConfigCoverObstructionDetection {
348 public Boolean enable;
349 public String direction;
350 public String action;
351 @SerializedName("power_thr")
352 public Integer powerThr;
353 public Double holdoff;
358 public Shelly2DeviceConfigCoverMotor motor;
359 @SerializedName("maxtime_open")
360 public Double maxtimeOpen;
361 @SerializedName("maxtime_close")
362 public Double maxtimeClose;
363 @SerializedName("initial_state")
364 public String initialState;
365 @SerializedName("invert_directions")
366 public Boolean invertDirections;
367 @SerializedName("in_mode")
368 public String inMode;
369 @SerializedName("swap_inputs")
370 public Boolean swapInputs;
371 @SerializedName("safety_switch")
372 public Shelly2DeviceConfigCoverSafetySwitch safetySwitch;
373 @SerializedName("power_limit")
374 public Integer powerLimit;
375 @SerializedName("voltage_limit")
376 public Integer voltageLimit;
377 @SerializedName("current_limit")
378 public Double currentLimit;
379 @SerializedName("obstruction_detection")
380 public Shelly2DeviceConfigCoverObstructionDetection obstructionDetection;
383 public static class Shelly2ConfigSmoke {
385 public Boolean alarm;
389 public static class Shelly2GetConfigLight {
390 public static class Shelly2GetConfigLightDefault {
391 public Integer brightness;
394 public static class Shelly2GetConfigLightNightMode {
395 public boolean enable;
396 public Integer brightness;
401 @SerializedName("initial_state")
402 public String initialState;
403 @SerializedName("auto_on")
404 public Boolean autoOn;
405 @SerializedName("auto_off")
406 public Boolean autoOff;
407 @SerializedName("auto_on_delay")
408 public Double autoOnDelay;
409 @SerializedName("auto_off_delay")
410 public Double autoOffDelay;
411 @SerializedName("default")
412 public Shelly2GetConfigLightDefault defaultCfg;
413 @SerializedName("night_mode")
414 public Shelly2GetConfigLightNightMode nightMode;
417 public class Shelly2DeviceConfigLed {
418 @SerializedName("sys_led_enable")
419 public Boolean sysLedEnable;
420 @SerializedName("power_led")
421 public String powerLed;
424 public static class Shelly2GetConfigResult {
426 public class Shelly2DevConfigCloud {
427 public Boolean enable;
428 public String server;
431 public class Shelly2DevConfigMqtt {
432 public Boolean enable;
433 public String server;
435 @SerializedName("topic_prefix:0")
436 public String topicPrefix;
437 @SerializedName("rpc_ntf")
438 public String rpcNtf;
439 @SerializedName("status_ntf")
440 public String statusNtf;
443 public Shelly2DevConfigBle ble;
444 public Shelly2DevConfigEth eth;
445 public Shelly2DevConfigCloud cloud;
446 public Shelly2DevConfigMqtt mqtt;
447 public Shelly2DeviceConfigSys sys;
448 public Shelly2DeviceConfigWiFi wifi;
449 @SerializedName("wd_ui")
450 public Shelly2DeviceConfigLed led;
452 @SerializedName("input:0")
453 public Shelly2DevConfigInput input0;
454 @SerializedName("input:1")
455 public Shelly2DevConfigInput input1;
456 @SerializedName("input:2")
457 public Shelly2DevConfigInput input2;
458 @SerializedName("input:3")
459 public Shelly2DevConfigInput input3;
461 @SerializedName("switch:0")
462 public Shelly2DevConfigSwitch switch0;
463 @SerializedName("switch:1")
464 public Shelly2DevConfigSwitch switch1;
465 @SerializedName("switch:2")
466 public Shelly2DevConfigSwitch switch2;
467 @SerializedName("switch:3")
468 public Shelly2DevConfigSwitch switch3;
469 @SerializedName("switch:100")
470 public Shelly2DevConfigSwitch switch100; // Pro 3EM Add-On
472 @SerializedName("em:0")
473 public Shelly2DevConfigEm em0;
474 @SerializedName("em1:0")
475 public Shelly2DevConfigEm em10;
476 @SerializedName("em1:1")
477 public Shelly2DevConfigEm em11;
478 @SerializedName("pm1:0")
479 public Shelly2DevConfigPm1 pm10;
481 @SerializedName("cover:0")
482 public Shelly2DevConfigCover cover0;
484 @SerializedName("light:0")
485 public Shelly2GetConfigLight light0;
487 @SerializedName("smoke:0")
488 public Shelly2ConfigSmoke smoke0;
491 public class Shelly2DeviceConfigSta {
493 public String password;
494 @SerializedName("is_open")
495 public Boolean isOpen;
496 public Boolean enable;
497 public String ipv4mode;
499 public String netmask;
501 public String nameserver;
504 public class Shelly2DeviceConfigRoam {
505 @SerializedName("rssi_thr")
506 public Integer rssiThr;
507 public Integer interval;
510 public class Shelly2DeviceConfigWiFi {
511 public Shelly2DeviceConfigAp ap;
512 public Shelly2DeviceConfigSta sta;
513 public Shelly2DeviceConfigSta sta1;
514 public Shelly2DeviceConfigRoam roam;
519 public Shelly2GetConfigResult result;
522 public static class Shelly2DeviceStatus {
523 public class Shelly2InputStatus {
525 public Boolean state;
526 public Double percent; // analog input only
527 public ArrayList<String> errors;// shown only if at least one error is present.
530 public static class Shelly2DeviceStatusLight {
532 public String source;
533 public Boolean output;
534 public Double brightness;
535 @SerializedName("timer_started_at")
536 public Double timerStartedAt;
537 @SerializedName("timer_duration")
538 public Integer timerDuration;
541 public static class Shelly2DeviceStatusResult {
542 public class Shelly2DeviceStatusBle {
546 public class Shelly2DeviceStatusCloud {
547 public Boolean connected;
550 public class Shelly2DeviceStatusMqqt {
551 public Boolean connected;
554 public class Shelly2CoverStatus {
556 public String source;
558 public Double apower;
559 public Double voltage;
560 public Double current;
562 public Shelly2Energy aenergy;
563 @SerializedName("current_pos")
564 public Integer currentPos;
565 @SerializedName("target_pos")
566 public Integer targetPos;
567 @SerializedName("move_timeout")
568 public Double moveTimeout;
569 @SerializedName("move_started_at")
570 public Double moveStartedAt;
571 @SerializedName("pos_control")
572 public Boolean posControl;
573 public Shelly2DeviceStatusTemp temperature;
574 public ArrayList<String> errors;
577 public class Shelly2DeviceStatusHumidity {
582 public class Shelly2DeviceStatusIlluminance {
585 public String illumination;
588 public class Shelly2DeviceStatusVoltage {
590 public Double voltage;
593 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
597 public static class Shelly2DeviceStatusPower {
598 public static class Shelly2DeviceStatusBattery {
601 public Double percent;
604 public static class Shelly2DeviceStatusCharger {
605 public Boolean present;
609 public Shelly2DeviceStatusBattery battery;
610 public Shelly2DeviceStatusCharger external;
613 public static class Shelly2DeviceStatusEm {
616 @SerializedName("a_current")
617 public Double aCurrent;
618 @SerializedName("a_voltage")
619 public Double aVoltage;
620 @SerializedName("a_act_power")
621 public Double aActPower;
622 @SerializedName("a_aprt_power")
623 public Double aAprtPower;
624 @SerializedName("a_pf")
627 @SerializedName("b_current")
628 public Double bCurrent;
629 @SerializedName("b_voltage")
630 public Double bVoltage;
631 @SerializedName("b_act_power")
632 public Double bActPower;
633 @SerializedName("b_aprt_power")
634 public Double bAprtPower;
635 @SerializedName("b_pf")
638 @SerializedName("c_current")
639 public Double cCurrent;
640 @SerializedName("c_voltage")
641 public Double cVoltage;
642 @SerializedName("c_act_power")
643 public Double cActPower;
644 @SerializedName("c_aprt_power")
645 public Double cAprtPower;
646 @SerializedName("c_pf")
649 @SerializedName("n_current")
650 public Double nCurrent;
652 @SerializedName("total_current")
653 public Double totalCurrent;
654 @SerializedName("total_act_power")
655 public Double totalActPower;
656 @SerializedName("total_aprt_power")
657 public Double totalAprtPower;
660 public static class Shelly2DeviceStatusEmData {
662 public String[] errors;
665 public class Shelly2DeviceStatusSmoke {
667 public Boolean alarm;
671 public Shelly2DeviceStatusBle ble;
672 public Shelly2DeviceStatusCloud cloud;
673 public Shelly2DeviceStatusMqqt mqtt;
674 public Shelly2DeviceStatusSys sys;
675 public Shelly2DeviceStatusSysWiFi wifi;
677 @SerializedName("input:0")
678 public Shelly2InputStatus input0;
679 @SerializedName("input:1")
680 public Shelly2InputStatus input1;
681 @SerializedName("input:2")
682 public Shelly2InputStatus input2;
683 @SerializedName("input:3")
684 public Shelly2InputStatus input3;
685 @SerializedName("input:100")
686 public Shelly2InputStatus input100; // Digital Input from Add-On
688 @SerializedName("switch:0")
689 public Shelly2RelayStatus switch0;
690 @SerializedName("switch:1")
691 public Shelly2RelayStatus switch1;
692 @SerializedName("switch:2")
693 public Shelly2RelayStatus switch2;
694 @SerializedName("switch:3")
695 public Shelly2RelayStatus switch3;
696 @SerializedName("switch:100")
697 public Shelly2RelayStatus switch100; // Pro 3EM Add-On
699 @SerializedName("pm1:0")
700 public Shelly2RelayStatus pm10;
702 @SerializedName("em:0")
703 public Shelly2DeviceStatusEm em0;
704 @SerializedName("emdata:0")
705 public Shelly2DeviceStatusEmData emdata0;
706 @SerializedName("em1:0")
707 public Shelly2StatusEm1 em10;
708 @SerializedName("em1:1")
709 public Shelly2StatusEm1 em11;
710 @SerializedName("em1data:0")
711 public Shelly2DeviceStatusEmData em1data0;
713 @SerializedName("cover:0")
714 public Shelly2CoverStatus cover0;
716 @SerializedName("light:0")
717 public Shelly2DeviceStatusLight light0;
719 @SerializedName("temperature:0")
720 public Shelly2DeviceStatusTempId temperature0;
721 @SerializedName("temperature:100")
722 public Shelly2DeviceStatusTempId temperature100;
723 @SerializedName("temperature:101")
724 public Shelly2DeviceStatusTempId temperature101;
725 @SerializedName("temperature:102")
726 public Shelly2DeviceStatusTempId temperature102;
727 @SerializedName("temperature:103")
728 public Shelly2DeviceStatusTempId temperature103;
729 @SerializedName("temperature:104")
730 public Shelly2DeviceStatusTempId temperature104;
732 @SerializedName("humidity:0")
733 public Shelly2DeviceStatusHumidity humidity0;
734 @SerializedName("humidity:100")
735 public Shelly2DeviceStatusHumidity humidity100;
737 @SerializedName("illuminance:0")
738 Shelly2DeviceStatusIlluminance illuminance0;
740 @SerializedName("smoke:0")
741 public Shelly2DeviceStatusSmoke smoke0;
743 @SerializedName("voltmeter:100")
744 public Shelly2DeviceStatusVoltage voltmeter100;
746 @SerializedName("devicepower:0")
747 public Shelly2DeviceStatusPower devicepower0;
750 public class Shelly2DeviceStatusSys {
751 public class Shelly2DeviceStatusSysAvlUpdate {
752 public class Shelly2DeviceStatusSysUpdate {
753 public String version;
756 public Shelly2DeviceStatusSysUpdate stable;
757 public Shelly2DeviceStatusSysUpdate beta;
760 public class Shelly2DeviceStatusWakeup {
766 @SerializedName("restart_required")
767 public Boolean restartRequired;
769 public Long unixtime;
771 @SerializedName("ram_size")
773 @SerializedName("ram_free")
775 @SerializedName("fs_size")
777 @SerializedName("fs_free")
779 @SerializedName("cfg_rev")
780 public Integer cfg_rev;
781 @SerializedName("available_updates")
782 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
783 @SerializedName("webhook_rev")
784 public Integer webHookRev;
785 @SerializedName("wakeup_reason")
786 public Shelly2DeviceStatusWakeup wakeUpReason;
787 @SerializedName("wakeup_period")
788 public Integer wakeupPeriod;
791 public class Shelly2DeviceStatusSysWiFi {
792 @SerializedName("sta_ip")
794 public String status;
797 @SerializedName("ap_client_count")
798 public Integer apClientCount;
803 public Shelly2DeviceStatusResult result;
806 public static class Shelly2RelayStatus {
808 public String source;
809 public Boolean output;
810 @SerializedName("timer_started_at")
811 public Double timerStartetAt;
812 @SerializedName("timer_duration")
813 public Integer timerDuration;
814 public Double apower;
815 public Double voltage;
816 public Double current;
818 public Shelly2Energy aenergy;
819 public Shelly2DeviceStatusTemp temperature;
820 public String[] errors;
823 public static class Shelly2Pm1Status {
825 public String source;
826 public Boolean output;
827 @SerializedName("timer_started_at")
828 public Double timerStartetAt;
829 @SerializedName("timer_duration")
830 public Integer timerDuration;
831 public Double apower;
832 public Double voltage;
833 public Double current;
835 public Shelly2Energy aenergy;
836 public Shelly2DeviceStatusTemp temperature;
837 public String[] errors;
840 public static class Shelly2StatusEm1 {
842 public Double current;
843 public Double voltage;
844 @SerializedName("act_power")
845 public Double actPower;
846 @SerializedName("aprt_power")
847 public Double aptrPower;
849 public String calibration;
850 public ArrayList<String> errors;
853 public static class Shelly2DeviceStatusTemp {
858 public static class Shelly2Energy {
859 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
861 @SerializedName("by_minute")
862 public Double[] byMinute;
863 @SerializedName("minute_ts")
864 public Long minuteTs;
867 public static class Shelly2ConfigParms {
869 public Boolean enable;
870 public String server;
871 @SerializedName("ssl_ca")
875 public Shelly2DeviceConfigAp ap;
878 @SerializedName("auto_on")
879 public Boolean autoOn;
880 @SerializedName("auto_on_delay")
881 public Double autoOnDelay;
882 @SerializedName("auto_off")
883 public Boolean autoOff;
884 @SerializedName("auto_off_delay")
885 public Double autoOffDelay;
888 @SerializedName("sys_led_enable")
889 public Boolean sysLedEnable;
890 @SerializedName("power_led")
891 public String powerLed;
894 public static class Shelly2RpcRequest {
895 public Integer id = 0;
896 public String method;
898 public static class Shelly2RpcRequestParams {
899 public Integer id = 1;
906 public Integer brightness;
907 @SerializedName("toggle_after")
908 public Integer toggleAfter;
920 public Shelly2ConfigParms config;
925 public Shelly2RpcRequestParams withConfig() {
926 config = new Shelly2ConfigParms();
931 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
933 public Shelly2RpcRequest() {
936 public Shelly2RpcRequest withMethod(String method) {
937 this.method = method;
941 public Shelly2RpcRequest withId(int id) {
946 public Shelly2RpcRequest withPos(int pos) {
951 public Shelly2RpcRequest withName(String name) {
957 public static class Shelly2WsConfigResponse {
961 public static class Shelly2WsConfigResult {
962 @SerializedName("restart_required")
963 public Boolean restartRequired;
966 public Shelly2WsConfigResult result;
969 public static class ShellyScriptListResponse {
970 public static class ShellyScriptListEntry {
973 public Boolean enable;
974 public Boolean running;
977 public ArrayList<ShellyScriptListEntry> scripts;
980 public static class ShellyScriptResponse {
982 public Boolean running;
987 public static class ShellyScriptPutCodeParams {
990 public Boolean append;
993 public static class Shelly2RpcBaseMessage {
994 // Basic message format, e.g.
995 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
996 public class Shelly2RpcMessageError {
998 public String message;
1004 public String component;
1005 public String method;
1006 public Object params;
1007 public String event;
1008 public Object result;
1009 public Shelly2AuthRsp auth;
1010 public Shelly2RpcMessageError error;
1013 public static class Shelly2RpcNotifyStatus {
1014 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
1021 public String method;
1022 public Shelly2NotifyStatus params;
1023 public Shelly2NotifyStatus result;
1024 public Shelly2RpcMessageError error;
1027 public static String SHELLY2_AUTHDEF_USER = "admin";
1028 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
1029 public static String SHELLY2_AUTHTTYPE_STRING = "string";
1030 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
1031 // = ':auth:'+HexHash("dummy_method:dummy_uri");
1032 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
1034 public static class Shelly2AuthChallenge { // on 401 message contains the auth info
1035 @SerializedName("auth_type")
1036 public String authType;
1037 public String nonce;
1039 public String realm;
1040 public String algorithm;
1043 public static class Shelly2AuthRsp {
1044 public String username;
1045 public String nonce;
1046 public String cnonce;
1048 public String realm;
1049 public String algorithm;
1050 public String response;
1051 @SerializedName("auth_type")
1052 public String authType;
1057 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1058 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1059 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1060 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
1061 // "ts":1682877399.22}
1064 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1065 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1066 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1067 // "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},
1068 // "ts":1682877414.25}
1070 public class Shelly2NotifyEventMessage {
1073 public Boolean encryption;
1074 @SerializedName("BTHome_version")
1075 public Integer bthVersion;
1077 @SerializedName("Battery")
1078 public Integer battery;
1079 @SerializedName("Button")
1080 public Integer buttonEvent;
1081 @SerializedName("Illuminance")
1082 public Integer illuminance;
1083 @SerializedName("Window")
1084 public Integer windowState;
1085 @SerializedName("Rotation")
1086 public Double rotation;
1088 public Integer rssi;
1089 public Integer tx_power;
1092 public class Shelly2NotifyEvent {
1095 public String component;
1096 public String event;
1097 public Shelly2NotifyEventMessage data;
1099 public Integer reason;
1100 @SerializedName("cfg_rev")
1101 public Integer cfgRev;
1104 public class Shelly2NotifyEventData {
1106 public ArrayList<Shelly2NotifyEvent> events;
1109 public static class Shelly2RpcNotifyEvent {
1112 public Shelly2NotifyEventData params;