File tree 2 files changed +25
-0
lines changed
miio/integrations/roborock/vacuum
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 47
47
CarpetModeStatus ,
48
48
CleaningDetails ,
49
49
CleaningSummary ,
50
+ ConnectivityStatus ,
50
51
ConsumableStatus ,
51
52
DNDStatus ,
52
53
MapList ,
@@ -155,6 +156,7 @@ def __init__(
155
156
self ._map_enum_cache = None
156
157
self ._status_helper = UpdateHelper (self .vacuum_status )
157
158
self ._status_helper .add_update_method ("consumables" , self .consumable_status )
159
+ self ._status_helper .add_update_method ("connectivity" , self .connectivity_status )
158
160
self ._status_helper .add_update_method ("dnd_status" , self .dnd_status )
159
161
self ._status_helper .add_update_method ("clean_history" , self .clean_history )
160
162
self ._status_helper .add_update_method ("last_clean" , self .last_clean_details )
@@ -620,6 +622,11 @@ def dnd_status(self) -> DNDStatus:
620
622
# 'start_hour': 22, 'end_hour': 8}], 'id': 1}
621
623
return DNDStatus (self .send ("get_dnd_timer" )[0 ])
622
624
625
+ @command ()
626
+ def connectivity_status (self ) -> ConnectivityStatus :
627
+ """Returns WiFi connectivity information."""
628
+ return ConnectivityStatus (self .info (skip_cache = True ))
629
+
623
630
@command (
624
631
click .argument ("start_hr" , type = int ),
625
632
click .argument ("start_min" , type = int ),
Original file line number Diff line number Diff line change 8
8
from pytz import BaseTzInfo
9
9
10
10
from miio .device import DeviceStatus
11
+ from miio .deviceinfo import DeviceInfo
11
12
from miio .devicestatus import sensor , setting
12
13
from miio .identifiers import VacuumId , VacuumState
13
14
from miio .utils import pretty_seconds , pretty_time
@@ -1062,3 +1063,20 @@ def enabled(self) -> bool:
1062
1063
def dry_time (self ) -> timedelta :
1063
1064
"""Return mop dry time."""
1064
1065
return pretty_seconds (self .data ["on" ]["dry_time" ])
1066
+
1067
+
1068
+ class ConnectivityStatus (DeviceStatus ):
1069
+ def __init__ (self , info : DeviceInfo ) -> None :
1070
+ self .info = info
1071
+
1072
+ @property
1073
+ @sensor (
1074
+ "Wifi Signal Strengh" ,
1075
+ unit = "dBm" ,
1076
+ icon = "mdi:wifi-strength-2" , # TODO: Make this dynamic?
1077
+ device_class = "signal_strength" ,
1078
+ entity_category = "diagnostic" ,
1079
+ )
1080
+ def total_duration (self ) -> timedelta :
1081
+ """Total cleaning duration."""
1082
+ return self .info .accesspoint ["rssi" ]
You can’t perform that action at this time.
0 commit comments