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 Shelly2InputStatus {
526 public Boolean state;
527 public Double percent; // analog input only
528 public ArrayList<String> errors;// shown only if at least one error is present.
531 public static class Shelly2DeviceStatusLight {
533 public String source;
534 public Boolean output;
535 public Double brightness;
536 @SerializedName("timer_started_at")
537 public Double timerStartedAt;
538 @SerializedName("timer_duration")
539 public Integer timerDuration;
542 public static class Shelly2DeviceStatusResult {
543 public class Shelly2DeviceStatusBle {
547 public class Shelly2DeviceStatusCloud {
548 public Boolean connected;
551 public class Shelly2DeviceStatusMqqt {
552 public Boolean connected;
555 public class Shelly2CoverStatus {
557 public String source;
559 public Double apower;
560 public Double voltage;
561 public Double current;
563 public Shelly2Energy aenergy;
564 @SerializedName("current_pos")
565 public Integer currentPos;
566 @SerializedName("target_pos")
567 public Integer targetPos;
568 @SerializedName("move_timeout")
569 public Double moveTimeout;
570 @SerializedName("move_started_at")
571 public Double moveStartedAt;
572 @SerializedName("pos_control")
573 public Boolean posControl;
574 public Shelly2DeviceStatusTemp temperature;
575 public ArrayList<String> errors;
578 public class Shelly2DeviceStatusHumidity {
583 public class Shelly2DeviceStatusIlluminance {
586 public String illumination;
589 public class Shelly2DeviceStatusVoltage {
591 public Double voltage;
594 public class Shelly2DeviceStatusTempId extends Shelly2DeviceStatusTemp {
598 public static class Shelly2DeviceStatusPower {
599 public static class Shelly2DeviceStatusBattery {
602 public Double percent;
605 public static class Shelly2DeviceStatusCharger {
606 public Boolean present;
610 public Shelly2DeviceStatusBattery battery;
611 public Shelly2DeviceStatusCharger external;
614 public static class Shelly2DeviceStatusEm {
617 @SerializedName("a_current")
618 public Double aCurrent;
619 @SerializedName("a_voltage")
620 public Double aVoltage;
621 @SerializedName("a_act_power")
622 public Double aActPower;
623 @SerializedName("a_aprt_power")
624 public Double aAprtPower;
625 @SerializedName("a_pf")
628 @SerializedName("b_current")
629 public Double bCurrent;
630 @SerializedName("b_voltage")
631 public Double bVoltage;
632 @SerializedName("b_act_power")
633 public Double bActPower;
634 @SerializedName("b_aprt_power")
635 public Double bAprtPower;
636 @SerializedName("b_pf")
639 @SerializedName("c_current")
640 public Double cCurrent;
641 @SerializedName("c_voltage")
642 public Double cVoltage;
643 @SerializedName("c_act_power")
644 public Double cActPower;
645 @SerializedName("c_aprt_power")
646 public Double cAprtPower;
647 @SerializedName("c_pf")
650 @SerializedName("n_current")
651 public Double nCurrent;
653 @SerializedName("total_current")
654 public Double totalCurrent;
655 @SerializedName("total_act_power")
656 public Double totalActPower;
657 @SerializedName("total_aprt_power")
658 public Double totalAprtPower;
661 public static class Shelly2DeviceStatusEmData {
663 public String[] errors;
666 public class Shelly2DeviceStatusSmoke {
668 public Boolean alarm;
672 public Shelly2DeviceStatusBle ble;
673 public Shelly2DeviceStatusCloud cloud;
674 public Shelly2DeviceStatusMqqt mqtt;
675 public Shelly2DeviceStatusSys sys;
676 public Shelly2DeviceStatusSysWiFi wifi;
678 @SerializedName("input:0")
679 public Shelly2InputStatus input0;
680 @SerializedName("input:1")
681 public Shelly2InputStatus input1;
682 @SerializedName("input:2")
683 public Shelly2InputStatus input2;
684 @SerializedName("input:3")
685 public Shelly2InputStatus input3;
686 @SerializedName("input:100")
687 public Shelly2InputStatus input100; // Digital Input from Add-On
689 @SerializedName("switch:0")
690 public Shelly2RelayStatus switch0;
691 @SerializedName("switch:1")
692 public Shelly2RelayStatus switch1;
693 @SerializedName("switch:2")
694 public Shelly2RelayStatus switch2;
695 @SerializedName("switch:3")
696 public Shelly2RelayStatus switch3;
697 @SerializedName("switch:100")
698 public Shelly2RelayStatus switch100; // Pro 3EM Add-On
700 @SerializedName("pm1:0")
701 public Shelly2RelayStatus pm10;
703 @SerializedName("em:0")
704 public Shelly2DeviceStatusEm em0;
705 @SerializedName("emdata:0")
706 public Shelly2DeviceStatusEmData emdata0;
707 @SerializedName("em1:0")
708 public Shelly2StatusEm1 em10;
709 @SerializedName("em1:1")
710 public Shelly2StatusEm1 em11;
711 @SerializedName("em1data:0")
712 public Shelly2DeviceStatusEmData em1data0;
714 @SerializedName("cover:0")
715 public Shelly2CoverStatus cover0;
717 @SerializedName("light:0")
718 public Shelly2DeviceStatusLight light0;
720 @SerializedName("temperature:0")
721 public Shelly2DeviceStatusTempId temperature0;
722 @SerializedName("temperature:100")
723 public Shelly2DeviceStatusTempId temperature100;
724 @SerializedName("temperature:101")
725 public Shelly2DeviceStatusTempId temperature101;
726 @SerializedName("temperature:102")
727 public Shelly2DeviceStatusTempId temperature102;
728 @SerializedName("temperature:103")
729 public Shelly2DeviceStatusTempId temperature103;
730 @SerializedName("temperature:104")
731 public Shelly2DeviceStatusTempId temperature104;
733 @SerializedName("humidity:0")
734 public Shelly2DeviceStatusHumidity humidity0;
735 @SerializedName("humidity:100")
736 public Shelly2DeviceStatusHumidity humidity100;
738 @SerializedName("illuminance:0")
739 Shelly2DeviceStatusIlluminance illuminance0;
741 @SerializedName("smoke:0")
742 public Shelly2DeviceStatusSmoke smoke0;
744 @SerializedName("voltmeter:100")
745 public Shelly2DeviceStatusVoltage voltmeter100;
747 @SerializedName("devicepower:0")
748 public Shelly2DeviceStatusPower devicepower0;
751 public class Shelly2DeviceStatusSys {
752 public class Shelly2DeviceStatusSysAvlUpdate {
753 public class Shelly2DeviceStatusSysUpdate {
754 public String version;
757 public Shelly2DeviceStatusSysUpdate stable;
758 public Shelly2DeviceStatusSysUpdate beta;
761 public class Shelly2DeviceStatusWakeup {
767 @SerializedName("restart_required")
768 public Boolean restartRequired;
770 public Long unixtime;
772 @SerializedName("ram_size")
774 @SerializedName("ram_free")
776 @SerializedName("fs_size")
778 @SerializedName("fs_free")
780 @SerializedName("cfg_rev")
781 public Integer cfg_rev;
782 @SerializedName("available_updates")
783 public Shelly2DeviceStatusSysAvlUpdate availableUpdates;
784 @SerializedName("webhook_rev")
785 public Integer webHookRev;
786 @SerializedName("wakeup_reason")
787 public Shelly2DeviceStatusWakeup wakeUpReason;
788 @SerializedName("wakeup_period")
789 public Integer wakeupPeriod;
792 public class Shelly2DeviceStatusSysWiFi {
793 @SerializedName("sta_ip")
795 public String status;
798 @SerializedName("ap_client_count")
799 public Integer apClientCount;
804 public Shelly2DeviceStatusResult result;
807 public static class Shelly2RelayStatus {
809 public String source;
810 public Boolean output;
811 @SerializedName("timer_started_at")
812 public Double timerStartetAt;
813 @SerializedName("timer_duration")
814 public Integer timerDuration;
815 public Double apower;
816 public Double voltage;
817 public Double current;
819 public Shelly2Energy aenergy;
820 public Shelly2DeviceStatusTemp temperature;
821 public String[] errors;
824 public static class Shelly2Pm1Status {
826 public String source;
827 public Boolean output;
828 @SerializedName("timer_started_at")
829 public Double timerStartetAt;
830 @SerializedName("timer_duration")
831 public Integer timerDuration;
832 public Double apower;
833 public Double voltage;
834 public Double current;
836 public Shelly2Energy aenergy;
837 public Shelly2DeviceStatusTemp temperature;
838 public String[] errors;
841 public static class Shelly2StatusEm1 {
843 public Double current;
844 public Double voltage;
845 @SerializedName("act_power")
846 public Double actPower;
847 @SerializedName("aprt_power")
848 public Double aptrPower;
850 public String calibration;
851 public ArrayList<String> errors;
854 public static class Shelly2DeviceStatusTemp {
859 public static class Shelly2Energy {
860 // "switch:1":{"id":1,"aenergy":{"total":0.003,"by_minute":[0.000,0.000,0.000],"minute_ts":1619910239}}}}
862 @SerializedName("by_minute")
863 public Double[] byMinute;
864 @SerializedName("minute_ts")
865 public Long minuteTs;
868 public static class Shelly2ConfigParms {
870 public Boolean enable;
871 public String server;
872 @SerializedName("ssl_ca")
876 public Shelly2DeviceConfigAp ap;
879 @SerializedName("auto_on")
880 public Boolean autoOn;
881 @SerializedName("auto_on_delay")
882 public Double autoOnDelay;
883 @SerializedName("auto_off")
884 public Boolean autoOff;
885 @SerializedName("auto_off_delay")
886 public Double autoOffDelay;
889 @SerializedName("sys_led_enable")
890 public Boolean sysLedEnable;
891 @SerializedName("power_led")
892 public String powerLed;
895 public static class Shelly2RpcRequest {
896 public Integer id = 0;
897 public String method;
899 public static class Shelly2RpcRequestParams {
900 public Integer id = 1;
907 public Integer brightness;
908 @SerializedName("toggle_after")
909 public Integer toggleAfter;
921 public Shelly2ConfigParms config;
926 public Shelly2RpcRequestParams withConfig() {
927 config = new Shelly2ConfigParms();
932 public Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
934 public Shelly2RpcRequest() {
937 public Shelly2RpcRequest withMethod(String method) {
938 this.method = method;
942 public Shelly2RpcRequest withId(int id) {
947 public Shelly2RpcRequest withPos(int pos) {
952 public Shelly2RpcRequest withName(String name) {
958 public static class Shelly2WsConfigResponse {
962 public static class Shelly2WsConfigResult {
963 @SerializedName("restart_required")
964 public Boolean restartRequired;
967 public Shelly2WsConfigResult result;
970 public static class ShellyScriptListResponse {
971 public static class ShellyScriptListEntry {
974 public Boolean enable;
975 public Boolean running;
978 public ArrayList<ShellyScriptListEntry> scripts;
981 public static class ShellyScriptResponse {
983 public Boolean running;
988 public static class ShellyScriptPutCodeParams {
991 public Boolean append;
994 public static class Shelly2RpcBaseMessage {
995 // Basic message format, e.g.
996 // {"id":1,"src":"localweb528","method":"Shelly.GetConfig"}
997 public class Shelly2RpcMessageError {
999 public String message;
1005 public String component;
1006 public String method;
1007 public Object params;
1008 public String event;
1009 public Object result;
1010 public Shelly2AuthRsp auth;
1011 public Shelly2RpcMessageError error;
1014 public static class Shelly2RpcNotifyStatus {
1015 public static class Shelly2NotifyStatus extends Shelly2DeviceStatusResult {
1022 public String method;
1023 public Shelly2NotifyStatus params;
1024 public Shelly2NotifyStatus result;
1025 public Shelly2RpcMessageError error;
1028 public static String SHELLY2_AUTHDEF_USER = "admin";
1029 public static String SHELLY2_AUTHTTYPE_DIGEST = "digest";
1030 public static String SHELLY2_AUTHTTYPE_STRING = "string";
1031 public static String SHELLY2_AUTHALG_SHA256 = "SHA-256";
1032 // = ':auth:'+HexHash("dummy_method:dummy_uri");
1033 public static String SHELLY2_AUTH_NOISE = "6370ec69915103833b5222b368555393393f098bfbfbb59f47e0590af135f062";
1035 public static class Shelly2AuthChallenge { // on 401 message contains the auth info
1036 @SerializedName("auth_type")
1037 public String authType;
1038 public String nonce;
1040 public String realm;
1041 public String algorithm;
1044 public static class Shelly2AuthRsp {
1045 public String username;
1046 public String nonce;
1047 public String cnonce;
1049 public String realm;
1050 public String algorithm;
1051 public String response;
1052 @SerializedName("auth_type")
1053 public String authType;
1058 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1059 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1060 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1061 // "data":{"encryption":false,"BTHome_version":2,"pid":205,"Battery":100,"Button":1,"addr":"b4:35:22:fd:b3:81","rssi":-68},
1062 // "ts":1682877399.22}
1065 // {"component":"script:2", "id":2, "event":"oh-blu.scan_result",
1066 // "data":{"addr":"bc:02:6e:c3:a6:c7","rssi":-62,"tx_power":-128}, "ts":1682877414.21}
1067 // {"component":"script:2", "id":2, "event":"oh-blu.data",
1068 // "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},
1069 // "ts":1682877414.25}
1071 public class Shelly2NotifyEventMessage {
1074 public Boolean encryption;
1075 @SerializedName("BTHome_version")
1076 public Integer bthVersion;
1078 @SerializedName("Battery")
1079 public Integer battery;
1080 @SerializedName("Button")
1081 public Integer buttonEvent;
1082 @SerializedName("Illuminance")
1083 public Integer illuminance;
1084 @SerializedName("Window")
1085 public Integer windowState;
1086 @SerializedName("Rotation")
1087 public Double rotation;
1088 @SerializedName("Motion")
1089 public Integer motionState;
1090 @SerializedName("Temperature")
1091 public Double temperature;
1093 public Integer rssi;
1094 public Integer tx_power;
1097 public class Shelly2NotifyEvent {
1100 public String component;
1101 public String event;
1102 public Shelly2NotifyEventMessage data;
1104 public Integer reason;
1105 @SerializedName("cfg_rev")
1106 public Integer cfgRev;
1109 public class Shelly2NotifyEventData {
1111 public ArrayList<Shelly2NotifyEvent> events;
1114 public static class Shelly2RpcNotifyEvent {
1117 public Shelly2NotifyEventData params;