PyNetioConf 0.3.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1727 @@
1
+ """
2
+ Module containing the base class for all NETIO devices. This module is not meant to be used directly, but rather
3
+ extended by the device-specific classes.
4
+ """
5
+
6
+ from abc import ABC, abstractmethod
7
+ from collections import deque
8
+ from typing import TYPE_CHECKING, Any, Deque, Dict, List, Optional, Tuple
9
+ from xml.etree.ElementTree import Element
10
+
11
+ from websocket import WebSocket
12
+
13
+ # from .NetioManager import NetioManager
14
+
15
+
16
+ class NETIODevice(ABC):
17
+ """
18
+ A base class for Netio devices using the ESP platform.
19
+
20
+ When making changes to class init or structure the following needs to be updated in accordance:
21
+ 2.x.x-4.x.x share init class due to API similarities
22
+ 5.beta has own init (deprecated in PyNetioConf 0.2+)
23
+ 5.0.0 has it's own init
24
+ 5.2.0 has it's own init
25
+ """
26
+
27
+ def __init__(
28
+ self,
29
+ host: str,
30
+ username: str,
31
+ password: str,
32
+ sn_number: str,
33
+ hostname: str,
34
+ keep_alive: bool = True,
35
+ netio_manager: Optional["NetioManager"] = None, # type: ignore # noqa: F821
36
+ use_https: bool = False,
37
+ **kwargs: Any,
38
+ ) -> None:
39
+ self.host = host
40
+ self.username = username
41
+ self.password = password
42
+ self.sn_number = sn_number
43
+ self.hostname = hostname
44
+ self.session_id = ""
45
+ self.supported_features: dict[str, Any] = dict()
46
+ self.output_count = 0
47
+ self.user_permissions: list[str] = list()
48
+ self._keep_alive_flag = keep_alive
49
+ self._ka_thread = None
50
+ self.ws: WebSocket | None = None
51
+ self.ws_req_id = 0
52
+ self.use_https = use_https
53
+ self._request_queue: deque[dict[str, Any]] = deque()
54
+ self._pong_queue: deque[dict[str, Any]] = deque()
55
+ if use_https:
56
+ from urllib3 import disable_warnings
57
+ from urllib3.exceptions import InsecureRequestWarning
58
+
59
+ disable_warnings(category=InsecureRequestWarning)
60
+
61
+ # Keep an instace of NetioManager for updating device classes during
62
+ # firmware updates.
63
+ self.netio_manager = None
64
+
65
+ # region Session
66
+ @abstractmethod
67
+ def login(self, username: str, password: str, logout: bool = False) -> str:
68
+ """
69
+ Login to the device, generating a session ID to be used for the requests across the session.
70
+
71
+ Parameters
72
+ ----------
73
+ username: str
74
+ password: str
75
+ logout: bool
76
+ Log out of the current session before logging into a new one.
77
+ Returns
78
+ -------
79
+ Session ID of the new session.
80
+ """
81
+ pass
82
+
83
+ @abstractmethod
84
+ def logout(self) -> None:
85
+ """
86
+ Log out of the device, clearing the session.
87
+
88
+ Returns
89
+ -------
90
+ The response of the request.
91
+ """
92
+ pass
93
+
94
+ @abstractmethod
95
+ def ping(self) -> bool:
96
+ """
97
+ Ping the device to see if it is accessible.
98
+
99
+ Returns
100
+ -------
101
+ True if the device is online, False if not.
102
+ """
103
+ pass
104
+
105
+ # endregion
106
+
107
+ # region Device Information
108
+ @abstractmethod
109
+ def get_version(self) -> str:
110
+ """
111
+ Get the version information of the device.
112
+
113
+ Returns
114
+ -------
115
+ The device version as string.
116
+ """
117
+ pass
118
+
119
+ @abstractmethod
120
+ def get_version_detailed(self) -> str:
121
+ """
122
+ Get the detailed version information of the device.
123
+
124
+ Returns
125
+ -------
126
+ JSON of the recived data.
127
+ """
128
+ pass
129
+
130
+ @abstractmethod
131
+ def get_features(self) -> dict[str, Any]:
132
+ """
133
+ Get the features of the device.
134
+
135
+ Returns
136
+ -------
137
+ JSON of the recived data.
138
+ """
139
+ pass
140
+
141
+ # endregion
142
+
143
+ # region Sockets
144
+ # region Socket Control
145
+ @abstractmethod
146
+ def get_output_state(self, output_id: int) -> bool:
147
+ """
148
+ Get the output state of the device.
149
+ Parameters
150
+ ----------
151
+ output_id : int
152
+ The id of the output.
153
+
154
+ Returns
155
+ -------
156
+ A boolean indicating if the output is on.
157
+ """
158
+ pass
159
+
160
+ @abstractmethod
161
+ def set_output(self, output_id: int, state: bool) -> None:
162
+ """
163
+ Set a state of an output given its ID and the desired state.
164
+
165
+ Parameters
166
+ ----------
167
+ output_id: int
168
+ The number of the output.
169
+ state: bool
170
+ The state you want to put the device into.
171
+ Returns
172
+ -------
173
+ Dict object of the api request's response.
174
+ """
175
+ pass
176
+
177
+ @abstractmethod
178
+ def set_outputs_unified(self, state: bool) -> None:
179
+ """
180
+ Set all outputs to the same state.
181
+
182
+ Parameters
183
+ ----------
184
+ state: bool
185
+ The state you want to put the device into.
186
+ """
187
+ pass
188
+
189
+ @abstractmethod
190
+ def reset_output(self, output_id: int) -> None:
191
+ """
192
+ Reset the output given its ID.
193
+
194
+ Parameters
195
+ ----------
196
+ output_id: int
197
+ The number of the output.
198
+ """
199
+ pass
200
+
201
+ @abstractmethod
202
+ def rename_output(self, output_id: int, output_name: str) -> None:
203
+ """
204
+ Rename the output given its ID.
205
+
206
+ Parameters
207
+ ----------
208
+ output_id: int
209
+ The number of the output.
210
+ output_name
211
+ The desired name of the output.
212
+
213
+ Returns
214
+ -------
215
+ None
216
+ """
217
+ pass
218
+
219
+ @abstractmethod
220
+ def set_output_schedule(
221
+ self, output_id: int, schedule_id: int, enabled: bool | None = None
222
+ ) -> None:
223
+ """
224
+ Activate or deactivate a specific schedule on a given output provided the schedule's ID.
225
+
226
+ Parameters
227
+ ----------
228
+ output_id: int
229
+ The number of the output.
230
+ schedule_id: int
231
+ The ID of the schedule.
232
+ enabled: bool | None
233
+ Whether the schedule should be enabled. If None, keeps the current state on the device.
234
+
235
+ Returns
236
+ -------
237
+ None
238
+ """
239
+ pass
240
+
241
+ @abstractmethod
242
+ def get_output_schedule(self, output_id: int) -> dict[str, Any]:
243
+ """
244
+ Gets the schedule id and its state based on the output ID.
245
+
246
+ Parameters
247
+ ----------
248
+ output_id : int
249
+ The number of the output.
250
+
251
+ Returns
252
+ -------
253
+ The schedule id, and it's state in {"id": x, "on": True/False} format.
254
+ """
255
+ pass
256
+
257
+ @abstractmethod
258
+ def get_output_schedule_id(self, output_id: int) -> int:
259
+ """
260
+ Gets the ID of the schedule currently set on the output given its ID.
261
+
262
+ Parameters
263
+ ----------
264
+ output_id : int
265
+ The number of the output.
266
+
267
+ Returns
268
+ -------
269
+ An integer representing the schedule ID.
270
+ """
271
+ pass
272
+
273
+ @abstractmethod
274
+ def set_output_schedule_state(self, output_id: int, schedule_enabled: bool) -> None:
275
+ """
276
+ Enables or disables the currently set schedule on an output.
277
+
278
+ Parameters
279
+ ----------
280
+ output_id : int
281
+ The number of the output.
282
+ schedule_enabled : bool
283
+ Whether the schedule should be enabled.
284
+
285
+ Returns
286
+ -------
287
+ """
288
+ pass
289
+
290
+ @abstractmethod
291
+ def set_output_schedule_by_name(
292
+ self, output_id: int, schedule_name: str, enabled: bool | None = None
293
+ ) -> None:
294
+ """
295
+ Activate or deactivate a specific schedule on a given output provided the schedule's name. If the schedule
296
+ with such name isn't available raises ElementNotFound.
297
+
298
+ Parameters
299
+ ----------
300
+ output_id : int
301
+ The number of the output.
302
+ schedule_name : str
303
+ The name of the schedule.
304
+ enabled : bool | None
305
+ Whether the schedule should be enabled. If None, keeps the current state on the device.
306
+
307
+ Returns
308
+ -------
309
+ """
310
+ pass
311
+
312
+ # endregion
313
+
314
+ # region Socket Information
315
+
316
+ @abstractmethod
317
+ def get_output_data(self, output_id: int) -> dict[str, Any]:
318
+ """
319
+ Produces all relevant information about the output given its ID.
320
+
321
+ Parameters
322
+ ----------
323
+ output_id: int
324
+ The id of the output.
325
+
326
+ Returns
327
+ -------
328
+ Dict of all the available output information and their current values.
329
+ """
330
+ pass
331
+
332
+ @abstractmethod
333
+ def get_outputs_data(self) -> list[dict[str, Any]]:
334
+ """
335
+ Produces a list of all the outputs on the device and relevant information about it. The information might
336
+ differ between device types.
337
+
338
+ Returns
339
+ -------
340
+ List containing a list of all the outputs on the device and any relevant information the device keeps
341
+ about these outputs.
342
+ """
343
+ pass
344
+
345
+ @abstractmethod
346
+ def get_output_states(self) -> list[tuple[int, bool]]:
347
+ """
348
+ Generates a list of the socket states currently on the device.
349
+
350
+ Returns
351
+ -------
352
+ A list containing the on/off values for all the available socket ids.
353
+ """
354
+ pass
355
+
356
+ # endregion
357
+
358
+ # endregion
359
+
360
+ # region Device Configuration
361
+
362
+ # region Network
363
+ @abstractmethod
364
+ def get_wifi_settings(self) -> dict[str, Any]:
365
+ """
366
+ Produces all relevant information about the Wi-Fi settings on the device.
367
+
368
+ Returns
369
+ -------
370
+ Dict of all the available Wi-Fi settings and their current values.
371
+ """
372
+ pass
373
+
374
+ @abstractmethod
375
+ def set_wifi_settings(self, ssid: str, password: str) -> None:
376
+ """
377
+ Connects the device to a specified Wi-Fi network provided the SSID and password.
378
+
379
+ Parameters
380
+ ----------
381
+ ssid: str
382
+ The name of the network to connect to, this can be a hidden network.
383
+ password: str
384
+ Password of the target network.
385
+
386
+ Returns
387
+ -------
388
+ True if the device accepted the new settings, False if the network could not be set.
389
+ """
390
+ pass
391
+
392
+ @abstractmethod
393
+ def set_wifi_static_address(
394
+ self,
395
+ address: str | None = None,
396
+ net_mask: str | None = None,
397
+ gateway: str | None = None,
398
+ dns_server: str | None = None,
399
+ hostname: str | None = None,
400
+ ) -> None:
401
+ """
402
+ Sets the device static address on the currently connected Wi-Fi network. Any argument left as None keeps
403
+ the value currently configured on the device. When the device is currently using DHCP, address, net_mask
404
+ and gateway are required.
405
+
406
+ Parameters
407
+ ----------
408
+ address: str | None
409
+ The IPv4 address the device should use.
410
+ net_mask: str | None
411
+ The network mask for the subnet.
412
+ gateway: str | None
413
+ Gateway IPv4 for the device.
414
+ dns_server: str | None
415
+ The DNS server the device will use for domain resolution.
416
+ hostname: str | None
417
+ The hostname of the device. The device will appear on the network under this name.
418
+ Note: on 5.0.0+ firmware the hostname is taken from the device name, so this argument is ignored and a
419
+ warning is logged. Use rename_device to change it.
420
+
421
+ Returns
422
+ -------
423
+ Bool signalizing the success of the device settings.
424
+ """
425
+ pass
426
+
427
+ # endregion
428
+
429
+ @abstractmethod
430
+ def import_config(self, file, **kwargs: Any) -> None:
431
+ """
432
+ Import configuration to the device from a JSON file.
433
+ Parameters
434
+ ----------
435
+ file
436
+ Python file object of the JSON configuration.
437
+ Returns
438
+ -------
439
+ The response generated by the api request.
440
+ """
441
+ pass
442
+
443
+ @abstractmethod
444
+ def export_config(self, save_file: str | None = None) -> dict[str, Any]:
445
+ """
446
+ Export the device's configuration to a JSON file.
447
+
448
+ Parameters
449
+ ----------
450
+ save_file: str
451
+ The path to the file you want to save the configuration to. Default is None, which returns the JSON,
452
+ but doesn't save a file.
453
+ Returns
454
+ -------
455
+ The JSON configuration.
456
+ """
457
+ pass
458
+
459
+ @abstractmethod
460
+ def update_firmware(self, file) -> "NETIODevice":
461
+ """
462
+ Upload a firmware file to the device and begin the upgrade. Note this locks the device out for a time.
463
+
464
+ Parameters
465
+ ----------
466
+ file
467
+ Python file object of the firmware package.
468
+
469
+ Returns
470
+ -------
471
+ The response generated by the post request.
472
+ """
473
+ pass
474
+
475
+ @abstractmethod
476
+ def rename_device(self, device_name: str) -> None:
477
+ """
478
+ Rename the device to the provided name, requried to be administrator to change settings.
479
+
480
+ Parameters
481
+ ----------
482
+ device_name
483
+ The desired name of the device
484
+
485
+ Returns
486
+ -------
487
+ None
488
+ """
489
+ pass
490
+
491
+ @abstractmethod
492
+ def set_system_settings(
493
+ self,
494
+ device_name: str | None = None,
495
+ port: int | None = None,
496
+ periodic_restart: bool | None = None,
497
+ restart_period: int | None = None,
498
+ ) -> None:
499
+ """
500
+ Sets the system settings on device given the provided parameters. Any argument left as None keeps the
501
+ value currently configured on the device.
502
+ Parameters
503
+ ----------
504
+ device_name : str
505
+ The desired name of the device.
506
+ port : int
507
+ The port on which the device communication will run.
508
+ Note: on 5.0.0+ firmware the port is set with set_server_settings, so this argument is ignored and a
509
+ warning is logged.
510
+ periodic_restart : bool
511
+ Toggle for the periodic restart feature.
512
+ restart_period : int
513
+ The period at which the device will restart. Can be changed regardless of periodic restart being toggled
514
+ on or off.
515
+
516
+ Returns
517
+ -------
518
+
519
+ """
520
+ pass
521
+
522
+ @abstractmethod
523
+ def get_system_info(self) -> dict[str, Any]:
524
+ """
525
+ Gets the system info on the device.
526
+
527
+ Returns
528
+ -------
529
+ System info on the device in JSON format.
530
+ """
531
+ pass
532
+
533
+ @abstractmethod
534
+ def get_uptime(self) -> int:
535
+ """
536
+ Gets the device's current uptime in seconds.
537
+
538
+ Returns
539
+ -------
540
+ An integer representing the uptime in seconds.
541
+ """
542
+ pass
543
+
544
+ @abstractmethod
545
+ def reset_power_consumption_counters(self) -> None:
546
+ """
547
+ Resets the power consumption counters on the device for all metered outputs.
548
+
549
+ Returns
550
+ -------
551
+ """
552
+ pass
553
+
554
+ @abstractmethod
555
+ def reset_output_consumption_counter(self, output_id: int) -> None:
556
+ """
557
+ Resets power consumption counters for a specific output by its ID.
558
+
559
+ Parameters
560
+ ----------
561
+ output_id : int
562
+ The number of the output to reset counters for.
563
+ """
564
+ pass
565
+
566
+ @abstractmethod
567
+ def set_periodic_restart(
568
+ self, enable: bool | None = None, restart_period: int | None = None
569
+ ) -> None:
570
+ """
571
+ Sets the periodic restart feature toggle and optionally changes the restart period.
572
+ Parameters
573
+ ----------
574
+ enable : bool
575
+ Should the restart feature be enabled. If None, keeps the value currently set on the device.
576
+ restart_period : int
577
+ Time in minutes for the periodic restart feature.
578
+
579
+ Returns
580
+ -------
581
+
582
+ """
583
+ pass
584
+
585
+ @abstractmethod
586
+ def locate(self) -> None:
587
+ """
588
+ Blinks the LED on the device for a period of time.
589
+ """
590
+ pass
591
+
592
+ # endregion
593
+
594
+ # region User Management
595
+ @abstractmethod
596
+ def get_current_user(self) -> dict[str, Any]:
597
+ """
598
+ Gets the logged-in user that corresponds to the session id used in this request.
599
+
600
+ Returns
601
+ -------
602
+ JSON containing the current user information.
603
+ """
604
+ pass
605
+
606
+ @abstractmethod
607
+ def get_users(self) -> dict[str, Any]:
608
+ """
609
+ Gets the users and their details.
610
+ Returns
611
+ -------
612
+ A dictionary containing the user information and thir priviledges.
613
+ """
614
+ pass
615
+
616
+ @abstractmethod
617
+ def get_user_privileges(self, username: str) -> list[str]:
618
+ """
619
+ Gets a list of privileges for the specified user.
620
+
621
+ Parameters
622
+ ----------
623
+ username : str
624
+ The username of the user. Usernames can be found by get_current_user() or get_users().
625
+
626
+ Returns
627
+ -------
628
+ A list of string priviledges associated with the specified user.
629
+ """
630
+ pass
631
+
632
+ @abstractmethod
633
+ def change_password(self, new_password: str) -> None:
634
+ """
635
+ Change the password of the currently logged-in user. Requires you to be logged in as administrator.
636
+
637
+ Parameters
638
+ ----------
639
+ new_password: str
640
+ The desired password for the account.
641
+ """
642
+ pass
643
+
644
+ @abstractmethod
645
+ def change_user_password(
646
+ self, username: str, old_password: str, new_password: str
647
+ ) -> None:
648
+ """
649
+ Change the administrator password. Requires you to be logged in as administrator.
650
+
651
+ Parameters
652
+ ----------
653
+ username: str
654
+ The username of the account you want to change the password for.
655
+ old_password: str
656
+ The current password of the account.
657
+ new_password: str
658
+ The desired password for the account.
659
+ """
660
+ pass
661
+
662
+ @abstractmethod
663
+ def create_user(
664
+ self, username: str, password: str, privileges: list[str] = None
665
+ ) -> None:
666
+ """
667
+ Creates a new user on the device with the given parameters.
668
+
669
+ Parameters
670
+ ----------
671
+ username : str
672
+ The username of the account you want to create.
673
+ password : str
674
+ The password for the account.
675
+ privileges : List[str]
676
+ List of privileges required to create the account.
677
+ An empty list means no privileges, the user can only observe. (or more precisely a log-in priviledge gets added automatically)
678
+ Possible privileges include: ["can_login","can_alter_users","can_alter_settings","can_use_tunnels",
679
+ "can_browse_logs","can_alter_outputs","can_control_outputs","can_view_settings","can_alter_rules"]
680
+ """
681
+ pass
682
+
683
+ @abstractmethod
684
+ def remove_user(self, username: str) -> None:
685
+ """
686
+ Removes the specified user, requires your account to have a privilege to edit users.
687
+
688
+ Parameters
689
+ ----------
690
+ username : str
691
+ The username of the account you want to remove.
692
+ Returns
693
+ -------
694
+
695
+ """
696
+ pass
697
+
698
+ # endregion
699
+
700
+ # region Protocols
701
+
702
+ @abstractmethod
703
+ def get_active_protocols(self) -> list[int]:
704
+ """
705
+ Produces a list of the currently active protocols.
706
+
707
+ Returns
708
+ -------
709
+ List of IDs of the currently active protocols. Can be None if there is no enabled protocol.
710
+ """
711
+ pass
712
+
713
+ @abstractmethod
714
+ def get_supported_protocols(self) -> list[int]:
715
+ """
716
+ Produces a list of all the protocols supported by the current device, also contains relevant information about
717
+ those protocols.
718
+
719
+ Returns
720
+ -------
721
+ List containing a list of all the protocols available on the device and relevant information, such as the
722
+ enabled protocols and setting details.
723
+ """
724
+ pass
725
+
726
+ # region NETIO Cloud
727
+
728
+ @abstractmethod
729
+ def set_cloud_state(self, state: bool) -> None:
730
+ """
731
+ Set the cloud state of the device.
732
+
733
+ Parameters
734
+ ----------
735
+ state: bool
736
+ The desired state of the cloud connection.
737
+
738
+ Returns
739
+ -------
740
+ None
741
+ """
742
+ pass
743
+
744
+ @abstractmethod
745
+ def get_cloud_state(self) -> dict[str, Any]:
746
+ """
747
+ Get the cloud state of the device.
748
+
749
+ Returns
750
+ -------
751
+ Dict object of the api request's response.
752
+ """
753
+ pass
754
+
755
+ @abstractmethod
756
+ def set_on_premise(self, url: str) -> None:
757
+ """
758
+ Set the on-premise server of the device.
759
+
760
+ Parameters
761
+ ----------
762
+ url: str
763
+ The URL of the on-premise server.
764
+
765
+ Returns
766
+ -------
767
+ None
768
+ """
769
+ pass
770
+
771
+ @abstractmethod
772
+ def register_to_cloud(self, token: str) -> None:
773
+ """
774
+ Register the device to the cloud using the provided token.
775
+
776
+ Parameters
777
+ ----------
778
+ token: str
779
+ The token for the device.
780
+
781
+ Returns
782
+ -------
783
+ None
784
+ """
785
+ pass
786
+
787
+ # endregion
788
+
789
+ # region URLAPI
790
+ @abstractmethod
791
+ def set_urlapi_state(
792
+ self,
793
+ protocol_enabled: bool | None = None,
794
+ write_enable: bool | None = None,
795
+ write_password: str | None = None,
796
+ ) -> None:
797
+ """
798
+ Configures the URL API protocol with the provided parameters. Any argument left as None keeps the value
799
+ currently configured on the device.
800
+
801
+ Parameters
802
+ ----------
803
+ protocol_enabled: bool | None
804
+ Toggle of the enabled protocol. Not that if any other protocols are enabled, this one is to take precedence.
805
+ write_enable: bool | None
806
+ Enable Write portion of the API. URLAPI doesn't have a read-only part such as JSON or XML.
807
+ write_password: str | None
808
+ The password for the Write portion of the API.
809
+ """
810
+ pass
811
+
812
+ # endregion
813
+
814
+ # region Modbus
815
+ @abstractmethod
816
+ def get_modbus_state(self) -> dict[str, Any]:
817
+ """
818
+ Get the Modbus M2M API state of the device.
819
+
820
+ Returns
821
+ -------
822
+ JSON object containing the Modbus M2M API information.
823
+ """
824
+ pass
825
+
826
+ @abstractmethod
827
+ def set_modbus_state(
828
+ self,
829
+ protocol_enabled: bool | None = None,
830
+ port: int | None = None,
831
+ ip_filter_enabled: bool | None = None,
832
+ ip_from: str | None = None,
833
+ ip_to: str | None = None,
834
+ ) -> None:
835
+ """
836
+ Configures the modbus M2M protocol with the provided parameters. Any argument left as None keeps the value
837
+ currently configured on the device.
838
+
839
+ Parameters
840
+ ----------
841
+ protocol_enabled: bool
842
+ Toggle of the enabled protocol. Not that if any other protocols are enabled, this one is to take precedence.
843
+ port: int
844
+ The port the protocol will be listening on.
845
+ ip_filter_enabled: bool
846
+ Toggle of the IP filter. If enabled, only the IP addresses in the range will be able to access the protocol.
847
+ ip_from: str
848
+ The start of the IP range.
849
+ ip_to: str
850
+ The end of the IP range.
851
+ """
852
+ pass
853
+
854
+ # endregion
855
+
856
+ # region MQTT
857
+
858
+ @abstractmethod
859
+ def upload_mqtt_client_key(self, key: str) -> None:
860
+ """
861
+ Upload a MQTT client private key to the device.
862
+
863
+ Parameters
864
+ ----------
865
+ key: str
866
+ The private key to upload to the device.
867
+ """
868
+ pass
869
+
870
+ @abstractmethod
871
+ def upload_mqtt_client_certificate(self, cert: str) -> None:
872
+ """
873
+ Uploads the MQTT client certificate to the device.
874
+
875
+ Parameters
876
+ ----------
877
+ cert: str
878
+ The client certificate to upload to the device.
879
+ """
880
+ pass
881
+
882
+ @abstractmethod
883
+ def upload_mqtt_ca_certificate(self, ca: str) -> None:
884
+ """
885
+ Uploads the root CA certificate to the device.
886
+
887
+ Parameters
888
+ ----------
889
+ ca: str
890
+ The root CA certificate to upload.
891
+ """
892
+ pass
893
+
894
+ @abstractmethod
895
+ def get_mqttflex_state(self) -> dict[str, Any]:
896
+ """
897
+ Gets the state of the MQTT Flex protocol currently set on the device.
898
+
899
+ Returns
900
+ -------
901
+ JSON/dict object containing the current state of MQTT Flex and its configuration.
902
+ """
903
+ pass
904
+
905
+ @abstractmethod
906
+ def set_mqttflex_state(
907
+ self, state: bool | None = None, config: dict[str, Any] | None = None
908
+ ) -> None:
909
+ """
910
+ Sets the state and if provided configuration of the MQTT Flex protocol.
911
+
912
+ Enables or disables the protocol based on the state given. If a state is
913
+ given, but not configuration is given, the method will only apply changes
914
+ to the state and keep the configuration that is present on device.
915
+
916
+ Parameters
917
+ ----------
918
+ state: bool | None
919
+ A boolean to determine if the protocol should be enabled or disabled. If None, keeps the state that is
920
+ present on device.
921
+ config: dict
922
+ A dict object containing the desired MQTT configuration to upload to the device.
923
+ """
924
+ pass
925
+
926
+ # endregion
927
+
928
+ # region JSON
929
+ @abstractmethod
930
+ def get_json_api_state(self) -> dict[str, Any]:
931
+ """
932
+ Get the JSON M2M API state of the device.
933
+
934
+ Returns
935
+ -------
936
+ JSON object containing the JSON API information.
937
+ """
938
+ pass
939
+
940
+ @abstractmethod
941
+ def set_json_api_state(
942
+ self,
943
+ protocol_enabled: bool | None = None,
944
+ read_enable: bool | None = None,
945
+ write_enable: bool | None = None,
946
+ read_auth: tuple[str, str] | None = None,
947
+ write_auth: tuple[str, str] | None = None,
948
+ ) -> None:
949
+ """
950
+ Function for configuring the JSON M2M on the device. Any argument left as None keeps the value currently
951
+ configured on the device.
952
+
953
+ Parameters
954
+ ----------
955
+ protocol_enabled: bool
956
+ Toggle of the enabled protocol. Not that if any other protocols are enabled, this one is to take precedence.
957
+ read_enable: bool
958
+ Enable Read-Only portion of the API. This uses a different authentication from the Read-Write permissions.
959
+ write_enable: bool
960
+ Enable Read-Write portion of the API. Can be enabled regardless of Read-Only.
961
+ read_auth: tuple[str, str]
962
+ A tuple of the authentication pair for the Read-Only portion of the API. This does not have to be same as
963
+ the write_auth.
964
+ write_auth: tuple[str, str]
965
+ A tuple of the authentication pair for the Read-Write portion of the API. This does not have to be same as
966
+ the read_auth.
967
+
968
+ Returns
969
+ -------
970
+ Bool representing the success of the operation.
971
+ """
972
+ pass
973
+
974
+ @abstractmethod
975
+ def get_json(self, json_auth: tuple[str, str]) -> dict[str, Any]:
976
+ """
977
+ Gets the JSON information from the device. This contains full information about the device.
978
+
979
+ Parameters
980
+ ----------
981
+ json_auth: tuple
982
+ Authentication pair tuple
983
+
984
+ Returns
985
+ -------
986
+ JSON containing the device information and related values.
987
+ """
988
+ pass
989
+
990
+ # endregion
991
+
992
+ @abstractmethod
993
+ def get_netio_push_api_state(self) -> dict[str, Any]:
994
+ """
995
+ Gets the state and settings of the M2M Netio Push protocol currently set on the device.
996
+
997
+ Returns
998
+ -------
999
+
1000
+ """
1001
+ pass
1002
+
1003
+ @abstractmethod
1004
+ def set_netio_push_api_state(
1005
+ self,
1006
+ protocol_enabled: bool | None = None,
1007
+ url: str | None = None,
1008
+ push_protocol: str | None = None,
1009
+ delta: int | None = None,
1010
+ period: int | None = None,
1011
+ ) -> None:
1012
+ """
1013
+ Sets the state and settings of the M2M Netio Push protocol currently set on the device.
1014
+
1015
+ Parameters
1016
+ ----------
1017
+ protocol_enabled : bool
1018
+ Whether the protocol should be enabled or disabled. If None, keeps the setting already set on the device.
1019
+ url : str
1020
+ On what URL should the protocol push its messages. If None, keeps the setting already set on the device.
1021
+ push_protocol : str
1022
+ Which format should the push protocol use. Can be either 'json' or 'xml'. If None, the format is not sent
1023
+ and the device keeps its current one.
1024
+ delta : int
1025
+ The current delta for auto push. If None, keeps the setting already set on the device.
1026
+ period : int
1027
+ Push period in seconds. If None, keeps the setting already set on the device.
1028
+
1029
+ Returns
1030
+ -------
1031
+
1032
+ """
1033
+ pass
1034
+
1035
+ @abstractmethod
1036
+ def get_snmp_api_state(self) -> dict[str, Any]:
1037
+ """
1038
+ Gets the state and settings of the M2M SNMP protocol currently set on the device.
1039
+
1040
+ Returns
1041
+ -------
1042
+
1043
+ """
1044
+
1045
+ @abstractmethod
1046
+ def _set_snmp_api_state(
1047
+ self,
1048
+ protocol_enabled: bool,
1049
+ version: str,
1050
+ location: str | None = None,
1051
+ community_read: str | None = None,
1052
+ community_write: str | None = None,
1053
+ security_name: str | None = None,
1054
+ security_level: str | None = None,
1055
+ auth_protocol: str | None = None,
1056
+ auth_key: str | None = None,
1057
+ priv_protocol: str | None = None,
1058
+ priv_key: str | None = None,
1059
+ ) -> None:
1060
+ # TODO: Finish SNMP before 0.1.0
1061
+ pass
1062
+
1063
+ @abstractmethod
1064
+ def set_snmp_v1_2_api_state(
1065
+ self,
1066
+ protocol_enabled: bool | None = None,
1067
+ location: str | None = None,
1068
+ community_read: str | None = None,
1069
+ community_write: str | None = None,
1070
+ ) -> None:
1071
+ """
1072
+ Sets the state and settings of the M2M SNMP v1,2c protocol currently set on the device. Enabling this,
1073
+ disables the v3 version of SNMP if it's active. Disabling SNMP requires a device restart.
1074
+ Parameters
1075
+ ----------
1076
+ protocol_enabled : bool
1077
+ Whether the protocol should be enabled or disabled. If disabling the protocol the device will restart.
1078
+ If None, keeps the setting already set on the device.
1079
+ location : str
1080
+ The location of the SNMP v1,2c protocol to set on the device. If None, keeps the setting already set on the device.
1081
+ community_read : str
1082
+ The community read of the SNMP v1,2c protocol to set on the device. If None, keeps the setting already set on the device.
1083
+ community_write : str
1084
+ The community write of the SNMP v1,2c protocol to set on the device. If None, keeps the setting already set on the device.
1085
+
1086
+ Returns
1087
+ -------
1088
+
1089
+ """
1090
+
1091
+ @abstractmethod
1092
+ def set_snmp_v3_api_state(
1093
+ self,
1094
+ protocol_enabled: bool | None = None,
1095
+ location: str | None = None,
1096
+ security_name: str | None = None,
1097
+ security_level: str | None = None,
1098
+ auth_protocol: str | None = None,
1099
+ auth_key: str | None = None,
1100
+ priv_protocol: str | None = None,
1101
+ priv_key: str | None = None,
1102
+ ) -> None:
1103
+ """
1104
+ Sets the state and settings of the M2M SNMP v3 protocol currently set on the device. Enabling this will
1105
+ disable the v1,2c version of the protocol if it's active. Disabling SNMP requires a device restart.
1106
+ Parameters
1107
+ ----------
1108
+ protocol_enabled : bool
1109
+ Whether the protocol should be enabled or disabled. If disabling the protocol, the device will restart.
1110
+ If None, keeps the setting already set on the device.
1111
+ location : str
1112
+ The location of the SNMP v3 protocol, if None, keeps the setting already set on the device.
1113
+ security_name : str
1114
+ The security name of the SNMP v3 protocol, if None, keeps the setting already set on the device.
1115
+ security_level : str
1116
+ The security level of the SNMP v3, any of ["authPriv", "authNoPriv", "noAuthNoPriv"], if None,
1117
+ keeps the setting already set on the device.
1118
+ auth_protocol : str
1119
+ The authentication protocol of the SNMP v3, if None, keeps the setting already set on the device. If the
1120
+ security level is "noAuthNoPriv" this setting will not be set.
1121
+ auth_key : str
1122
+ The authentication key of the SNMP v3, if None, keeps the setting already set on the device. If the security
1123
+ level is "noAuthNoPriv" this setting will not be set.
1124
+ priv_protocol : str
1125
+ The private protocol of the SNMP v3, currently supports "AES" only, if None, keeps the setting already
1126
+ set on the device. If the security level is "noAuthNoPriv" or "authNoPriv" this setting will not be set.
1127
+ priv_key : str
1128
+ The private key of the SNMP v3, if None, keeps the setting already set on the device. If the security
1129
+ level is "noAuthNoPriv" or "authNoPriv" this setting will not be set.
1130
+
1131
+ Returns
1132
+ -------
1133
+ """
1134
+
1135
+ @abstractmethod
1136
+ def netio_push_api_push_now(self) -> None:
1137
+ """
1138
+ Manually use the push protocol if enabled.
1139
+ Returns
1140
+ -------
1141
+
1142
+ """
1143
+ pass
1144
+
1145
+ @abstractmethod
1146
+ def get_telnet_api_state(self) -> dict[str, Any]:
1147
+ """
1148
+ Gets the state and settings of the telnet M2M protocol currently set on the device.
1149
+
1150
+ Returns
1151
+ -------
1152
+ JSON object containing the current state of the telnet M2M protocol.
1153
+ """
1154
+ pass
1155
+
1156
+ @abstractmethod
1157
+ def set_telnet_api_state(
1158
+ self,
1159
+ protocol_enabled: bool | None = None,
1160
+ port: int | None = None,
1161
+ read_enabled: bool | None = None,
1162
+ read_auth: tuple[str, str] | None = None,
1163
+ write_enabled: bool | None = None,
1164
+ write_auth: tuple[str, str] | None = None,
1165
+ ) -> None:
1166
+ """
1167
+ Sets the state and settings of the telnet M2M protocol currently set on the device.
1168
+
1169
+ Parameters
1170
+ ----------
1171
+ protocol_enabled : bool
1172
+ Whether the protocol should be enabled or disabled. If None, keeps the settings already on device.
1173
+ port: int
1174
+ The port on which the protocol will communicate. If None, keeps the settins already on device.
1175
+ read_enabled : bool
1176
+ Whether the read only portion of the protocol should be enabled or disabled. If None, keeps the settins
1177
+ already on device.
1178
+ read_auth : Tuple[str, str]
1179
+ Authentication pair tuple for read only in the format ("username", "password") If None, keeps the settins already on device.
1180
+ write_enabled: bool
1181
+ Whether the write only portion of the protocol should be enabled or disabled. If None, keeps the settins
1182
+ already on device.
1183
+ write_auth : Tuple[str, str]
1184
+ Authentication pair tuple for write only in the format ("username", "password") If None,
1185
+ keeps the settins already on device.
1186
+
1187
+ Returns
1188
+ -------
1189
+
1190
+ """
1191
+ pass
1192
+
1193
+ # region XML
1194
+ @abstractmethod
1195
+ def set_xml_api_state(
1196
+ self,
1197
+ protocol_enabled: bool | None = None,
1198
+ read_enable: bool | None = None,
1199
+ write_enable: bool | None = None,
1200
+ read_auth: tuple[str, str] | None = None,
1201
+ write_auth: tuple[str, str] | None = None,
1202
+ ) -> None:
1203
+ """
1204
+ Function for configuring the XML M2M on the device. Any argument left as None keeps the value currently
1205
+ configured on the device.
1206
+
1207
+ Parameters
1208
+ ----------
1209
+ protocol_enabled: bool
1210
+ Toggle of the enabled protocol. Not that if any other protocols are enabled, this one is to take precedence.
1211
+ read_enable: bool
1212
+ Enable Read-Only portion of the API. This uses a different authentication from the Read-Write permissions.
1213
+ write_enable: bool
1214
+ Enable Read-Write portion of the API. Can be enabled regardless of Read-Only.
1215
+ read_auth: tuple[str, str]
1216
+ A tuple of the authentication pair for the Read-Only portion of the API. This does not have to be same as
1217
+ the write_auth.
1218
+ write_auth: tuple[str, str]
1219
+ A tuple of the authentication pair for the Read-Write portion of the API. This does not have to be same as
1220
+ the read_auth.
1221
+
1222
+ Returns
1223
+ -------
1224
+ Bool representing the success of the operation.
1225
+ """
1226
+ pass
1227
+
1228
+ @abstractmethod
1229
+ def get_xml(self, xml_auth: tuple[str, str]) -> Element:
1230
+ """
1231
+ Gets the XML information from the device. This contains full information about the device.
1232
+
1233
+ Parameters
1234
+ ----------
1235
+ xml_auth: tuple
1236
+ Authentication pair tuple
1237
+
1238
+ Returns
1239
+ -------
1240
+ XML as ElementTree containing the device information and related values.
1241
+ """
1242
+ pass
1243
+
1244
+ # endregion
1245
+
1246
+ # endregion
1247
+
1248
+ @abstractmethod
1249
+ def get_rules(self) -> list[dict[str, Any]]:
1250
+ """
1251
+ Gets the list of all rules on the device and their configuration.
1252
+
1253
+ Returns
1254
+ -------
1255
+ A list of all rules, enabled or disabled on the device in JSON format.
1256
+ """
1257
+ pass
1258
+
1259
+ @abstractmethod
1260
+ def get_enabled_rules(self) -> list[dict[str, Any]]:
1261
+ """
1262
+ Gets the list of all enabled rules on the device and their configuration.
1263
+
1264
+ Returns
1265
+ -------
1266
+ A list of all enabled rules on the device in JSON formate.
1267
+ """
1268
+ pass
1269
+
1270
+ @abstractmethod
1271
+ def get_disabled_rules(self) -> list[dict[str, Any]]:
1272
+ """
1273
+ Gets the list of all disabled rules on the device and their configuration.
1274
+
1275
+ Returns
1276
+ -------
1277
+ A list of all disabled rules on the device in JSON format.
1278
+ """
1279
+ pass
1280
+
1281
+ @abstractmethod
1282
+ def get_rule_by_name(self, rule_name: str) -> dict[str, Any]:
1283
+ """
1284
+ Gets a rule based on its name.
1285
+
1286
+ Parameters
1287
+ ----------
1288
+ rule_name : str
1289
+ The name of the rule to fetch.
1290
+
1291
+ Returns
1292
+ -------
1293
+ A JSON object containing the rule information.
1294
+ """
1295
+ pass
1296
+
1297
+ @abstractmethod
1298
+ def get_watchdogs(self) -> list[dict[str, Any]]:
1299
+ """
1300
+ Gets the list of all watchdogs, enabled or disabled on the device.
1301
+
1302
+ Returns
1303
+ -------
1304
+ List of all watchdogs, enabled or disabled on the device in JSON format.
1305
+ """
1306
+ pass
1307
+
1308
+ @abstractmethod
1309
+ def get_enabled_watchdogs(self) -> list[dict[str, Any]]:
1310
+ """
1311
+ Gets all enabled watchdogs on the device.
1312
+
1313
+ Returns
1314
+ -------
1315
+ List of all enabled watchdogs on the device in JSON format.
1316
+ """
1317
+ pass
1318
+
1319
+ @abstractmethod
1320
+ def get_disabled_watchdogs(self) -> list[dict[str, Any]]:
1321
+ """
1322
+ Gets all disabled watchdogs on the device.
1323
+
1324
+ Returns
1325
+ -------
1326
+ List of all disabled watchdogs on the device in JSON format.
1327
+ """
1328
+ pass
1329
+
1330
+ @abstractmethod
1331
+ def get_watchdog_by_name(self, watchdog_name: str) -> dict[str, Any]:
1332
+ """
1333
+ Gets a watchdog based on its name.
1334
+
1335
+ Parameters
1336
+ ----------
1337
+ watchdog_name : str
1338
+ The name of the watchdog to fetch.
1339
+
1340
+ Returns
1341
+ -------
1342
+ A JSON object containing the watchdog information.
1343
+ """
1344
+
1345
+ @abstractmethod
1346
+ def get_schedules(self) -> list[dict[str, Any]]:
1347
+ """
1348
+ Gets the list of all the schedules available on the device.
1349
+
1350
+ Returns
1351
+ -------
1352
+ Returns a list of all schedules on the device in JSON format.
1353
+ """
1354
+ pass
1355
+
1356
+ @abstractmethod
1357
+ def create_schedule(self, name: str, intervals: list[dict]) -> None:
1358
+ """
1359
+ Creates a scedulule on the device given its configuration JSON.
1360
+
1361
+ Parameters
1362
+ ----------
1363
+ name : str
1364
+ Name of the schedule to create. Raises ElementAlreadyExists if a schedule of given name is already present.
1365
+ intervals : list[dict]
1366
+ A list of intervals where the schedule will be active.
1367
+
1368
+ Returns
1369
+ -------
1370
+
1371
+ """
1372
+
1373
+ @abstractmethod
1374
+ def get_schedule_by_name(self, schedule_name: str) -> dict[str, Any]:
1375
+ """
1376
+ Gets a schedule based on its name. Raises ElementNotFound if the schedule isn't found.
1377
+
1378
+ Parameters
1379
+ ----------
1380
+ schedule_name : str
1381
+ The name of the schedule to fetch.
1382
+
1383
+ Returns
1384
+ -------
1385
+ A JSON object containing the schedule information.
1386
+ """
1387
+ pass
1388
+
1389
+ @abstractmethod
1390
+ def get_schedule_id(self, schedule_name: str) -> int:
1391
+ """
1392
+ Gets the schedule ID for a schedule based on its name. Raises ElementNotFound if schedule isn't found.
1393
+
1394
+ Parameters
1395
+ ----------
1396
+ schedule_name : str
1397
+ The name of the schedule to fetch.
1398
+
1399
+ Returns
1400
+ -------
1401
+ An integer representing the schedule ID.
1402
+ """
1403
+ pass
1404
+
1405
+ @abstractmethod
1406
+ def get_schedule_names(self) -> list[str]:
1407
+ """
1408
+ Gets all the schedules available on the device.
1409
+
1410
+ Returns
1411
+ -------
1412
+ A list containing only the names of the available schedules.
1413
+ """
1414
+ pass
1415
+
1416
+ @abstractmethod
1417
+ def get_active_schedules(self) -> list[dict[str, Any]]:
1418
+ """
1419
+ Gets all the schedules that are currently active on the device.
1420
+
1421
+ Returns
1422
+ -------
1423
+ A list of all active schedules on the device in JSON format.
1424
+ """
1425
+ pass
1426
+
1427
+ @abstractmethod
1428
+ def delete_schedule(self, schedule_id: int) -> None:
1429
+ """
1430
+ Deletes a schedule from the device.
1431
+
1432
+ Parameters
1433
+ ----------
1434
+ schedule_id : int
1435
+ The schedule ID to delete.
1436
+
1437
+ Returns
1438
+ -------
1439
+ """
1440
+ pass
1441
+
1442
+ @abstractmethod
1443
+ def delete_schedule_by_name(self, schedule_name: str) -> None:
1444
+ """
1445
+ Deletes a schedule from the device given its name.
1446
+
1447
+ Parameters
1448
+ ----------
1449
+ schedule_name : str
1450
+ The name of the schedule to delete. Raises ElementNotFound if schedule isn't found.
1451
+
1452
+ Returns
1453
+ -------
1454
+ """
1455
+
1456
+ @abstractmethod
1457
+ def get_system_log(self) -> list[dict[str, Any]]:
1458
+ """
1459
+ Gets the system log of the device.
1460
+
1461
+ Returns
1462
+ -------
1463
+ list[dict[str, Any]]
1464
+ A list of JSON objects, where each dictionary contains details of a single system log entry. In the
1465
+ format of {"timestamp": "x", "type": "y", "message": "z"}
1466
+ """
1467
+ pass
1468
+
1469
+ @abstractmethod
1470
+ def clear_system_log(self) -> None:
1471
+ """
1472
+ Clears the system log of the device.
1473
+ Returns
1474
+ -------
1475
+ """
1476
+ pass
1477
+
1478
+ @abstractmethod
1479
+ def get_pabs(self) -> list[dict[str, Any]]:
1480
+ """
1481
+ Gets the list of PABs, enabled or disabled on the device.
1482
+ Returns
1483
+ -------
1484
+ A list of JSON objects, where each dictionary contains details of a single PAB entry from the device.
1485
+ """
1486
+ pass
1487
+
1488
+ @abstractmethod
1489
+ def get_pab_by_name(self, pab_name: str) -> dict[str, Any]:
1490
+ """
1491
+ Gets a PAB and its configuration based on its name. Raises ElementNotFound if the PAB isn't found.
1492
+
1493
+ Parameters
1494
+ ----------
1495
+ pab_name : str
1496
+ The name of the PAB to fetch.
1497
+
1498
+ Returns
1499
+ -------
1500
+ A JSON object containing the PAB information.
1501
+ """
1502
+ pass
1503
+
1504
+ @abstractmethod
1505
+ def get_enabled_pabs(self) -> list[dict[str, Any]]:
1506
+ """
1507
+ Gets the list of enabled PABs on the device.
1508
+
1509
+ Returns
1510
+ -------
1511
+ A list of JSON objects, where each dictionary contains details of a single enabled PAB entry from the device.
1512
+ """
1513
+ pass
1514
+
1515
+ @abstractmethod
1516
+ def get_disabled_pabs(self) -> list[dict[str, Any]]:
1517
+ """
1518
+ Gets the list of disabled PABs on the device.
1519
+
1520
+ Returns
1521
+ -------
1522
+ A list of JSON objects, where each dictionary contains details of a single disabled PAB entry from the device.
1523
+ """
1524
+ pass
1525
+
1526
+ @abstractmethod
1527
+ def delete_pab_by_name(self, pab_name: str) -> None:
1528
+ """
1529
+ Deletes a PAB from the device given its name. Raises ElementNotFound if the PAB isn't found.
1530
+
1531
+ Parameters
1532
+ ----------
1533
+ pab_name : str
1534
+ The name of the PAB to delete.
1535
+
1536
+ Returns
1537
+ -------
1538
+
1539
+ """
1540
+ pass
1541
+
1542
+ @abstractmethod
1543
+ def upload_https_private_key(self, keyfile: str) -> None:
1544
+ pass
1545
+
1546
+ @abstractmethod
1547
+ def upload_https_certificate(self, certfile: str) -> None:
1548
+ pass
1549
+
1550
+ @abstractmethod
1551
+ def get_version_revision(self) -> str:
1552
+ """
1553
+ Fetches the revision of the current firmware version.
1554
+
1555
+ Returns
1556
+ -------
1557
+ str
1558
+ 8-digit hash of the version revision
1559
+ """
1560
+ pass
1561
+
1562
+ @abstractmethod
1563
+ def get_input_list(self) -> dict[str, Any]:
1564
+ pass
1565
+
1566
+ @abstractmethod
1567
+ def get_input_data(self, input_id: int) -> dict[str, Any]:
1568
+ pass
1569
+
1570
+ # TODO: Review method
1571
+ @abstractmethod
1572
+ def get_system_datetime(self) -> dict[str, Any]:
1573
+ """
1574
+ Gets current system date, time, timezone, and NTP configuration.
1575
+ """
1576
+ pass
1577
+
1578
+ # TODO: Review method
1579
+ @abstractmethod
1580
+ def set_system_datetime(
1581
+ self,
1582
+ ntp_enabled: bool | None = None,
1583
+ ntp_server: str | None = None,
1584
+ timezone: str | None = None,
1585
+ time: int | None = None,
1586
+ ) -> None:
1587
+ """
1588
+ Sets system date, time, timezone, and NTP configuration. Any argument left as None keeps the value
1589
+ currently configured on the device.
1590
+
1591
+ Parameters
1592
+ ----------
1593
+ ntp_enabled: bool | None
1594
+ Whether the device synchronises its clock with an NTP server.
1595
+ ntp_server: str | None
1596
+ The NTP server to synchronise with, e.g. "pool.ntp.org".
1597
+ timezone: str | None
1598
+ The timezone name, e.g. "Europe/Prague".
1599
+ time: int | None
1600
+ The device time as a Unix timestamp in seconds.
1601
+ """
1602
+ pass
1603
+
1604
+ # TODO: Review method
1605
+ @abstractmethod
1606
+ def system_reset(self) -> None:
1607
+ """
1608
+ Triggers an immediate system reset (reboot).
1609
+ """
1610
+ pass
1611
+
1612
+ # TODO: Review method
1613
+ @abstractmethod
1614
+ def get_ethernet_settings(self) -> dict[str, Any]:
1615
+ """
1616
+ Gets Ethernet network interface configuration (MAC, networkMode, IP, netmask, gateway, DNS).
1617
+ """
1618
+ pass
1619
+
1620
+ # TODO: Review method
1621
+ @abstractmethod
1622
+ def set_ethernet_settings(
1623
+ self,
1624
+ network_mode: str | None = None,
1625
+ ip: str | None = None,
1626
+ netmask: str | None = None,
1627
+ gateway: str | None = None,
1628
+ dns: str | None = None,
1629
+ ) -> None:
1630
+ """
1631
+ Sets Ethernet network interface configuration (DHCP or static IP parameters).
1632
+ Any argument left as None keeps the value currently configured on the device. When switching from DHCP to
1633
+ "static", ip, netmask and gateway are required.
1634
+
1635
+ Parameters
1636
+ ----------
1637
+ network_mode: str | None
1638
+ Either "dhcp" or "static".
1639
+ ip: str | None
1640
+ The IPv4 address the device should use.
1641
+ netmask: str | None
1642
+ The network mask for the subnet.
1643
+ gateway: str | None
1644
+ Gateway IPv4 for the device.
1645
+ dns: str | None
1646
+ The DNS server the device will use for domain resolution.
1647
+ """
1648
+ pass
1649
+
1650
+ # TODO: Review method
1651
+ @abstractmethod
1652
+ def get_ethernet_status(self) -> dict[str, Any]:
1653
+ """
1654
+ Gets Ethernet interface connection status.
1655
+ """
1656
+ pass
1657
+
1658
+ # TODO: Review method
1659
+ @abstractmethod
1660
+ def get_wifi_status(self) -> dict[str, Any]:
1661
+ """
1662
+ Gets Wi-Fi interface link and connection status.
1663
+ """
1664
+ pass
1665
+
1666
+ # TODO: Review method
1667
+ @abstractmethod
1668
+ def get_server_settings(self) -> dict[str, Any]:
1669
+ """
1670
+ Gets web server HTTP / HTTPS ports and enablement configuration.
1671
+ """
1672
+ pass
1673
+
1674
+ # TODO: Review method
1675
+ @abstractmethod
1676
+ def set_server_settings(
1677
+ self,
1678
+ http_enable: bool | None = None,
1679
+ http_port: int | None = None,
1680
+ https_enable: bool | None = None,
1681
+ https_port: int | None = None,
1682
+ ) -> None:
1683
+ """
1684
+ Sets web server HTTP / HTTPS ports and enablement configuration.
1685
+ """
1686
+ pass
1687
+
1688
+ # TODO: Review method
1689
+ @abstractmethod
1690
+ def get_global_measurement(self) -> dict[str, Any]:
1691
+ """
1692
+ Gets device-wide global power measurements (voltage, frequency, total energy, power factor, etc.).
1693
+ """
1694
+ pass
1695
+
1696
+ # TODO: Review method
1697
+ @abstractmethod
1698
+ def get_outputs_list(self) -> list[dict[str, Any]]:
1699
+ """
1700
+ Gets summary list of outputs with socket types, schedule associations, and status.
1701
+ """
1702
+ pass
1703
+
1704
+ # TODO: Review method
1705
+ @abstractmethod
1706
+ def get_firmware_updates_list(self) -> list[dict[str, Any]]:
1707
+ """
1708
+ Queries available firmware updates from the cloud service.
1709
+ """
1710
+ pass
1711
+
1712
+ # TODO: Review method
1713
+ @abstractmethod
1714
+ def get_system_lock(self) -> dict[str, Any]:
1715
+ """
1716
+ Gets current system lock status (e.g. while performing cloud synchronization).
1717
+ """
1718
+ pass
1719
+
1720
+ # TODO: Review method
1721
+ @abstractmethod
1722
+ def get_system_notifications(self) -> list[dict[str, Any]]:
1723
+ """
1724
+ Gets active system notification/error messages.
1725
+ """
1726
+ pass
1727
+