diff --git a/miio/integrations/dreame/vacuum/dreamevacuum_miot.py b/miio/integrations/dreame/vacuum/dreamevacuum_miot.py index 75c9dbb12..ef1337c20 100644 --- a/miio/integrations/dreame/vacuum/dreamevacuum_miot.py +++ b/miio/integrations/dreame/vacuum/dreamevacuum_miot.py @@ -523,42 +523,42 @@ def status(self) -> DreameVacuumStatus: @command() def start(self) -> None: """Start cleaning.""" - return self.call_action("start_clean") + return self.call_action_from_mapping("start_clean") @command() def stop(self) -> None: """Stop cleaning.""" - return self.call_action("stop_clean") + return self.call_action_from_mapping("stop_clean") @command() def home(self) -> None: """Return to home.""" - return self.call_action("home") + return self.call_action_from_mapping("home") @command() def identify(self) -> None: """Locate the device (i am here).""" - return self.call_action("locate") + return self.call_action_from_mapping("locate") @command() def reset_mainbrush_life(self) -> None: """Reset main brush life.""" - return self.call_action("reset_mainbrush_life") + return self.call_action_from_mapping("reset_mainbrush_life") @command() def reset_filter_life(self) -> None: """Reset filter life.""" - return self.call_action("reset_filter_life") + return self.call_action_from_mapping("reset_filter_life") @command() def reset_sidebrush_life(self) -> None: """Reset side brush life.""" - return self.call_action("reset_sidebrush_life") + return self.call_action_from_mapping("reset_sidebrush_life") @command() def play_sound(self) -> None: """Play sound.""" - return self.call_action("play_sound") + return self.call_action_from_mapping("play_sound") @command() def fan_speed(self): @@ -651,7 +651,7 @@ def forward(self, distance: int) -> None: "Given distance is invalid, should be [%s, %s], was: %s" % (self.MANUAL_DISTANCE_MIN, self.MANUAL_DISTANCE_MAX, distance) ) - self.call_action( + self.call_action_from_mapping( "move", [ { @@ -678,7 +678,7 @@ def rotate(self, rotatation: int) -> None: "Given rotation is invalid, should be [%s, %s], was %s" % (self.MANUAL_ROTATION_MIN, self.MANUAL_ROTATION_MAX, rotatation) ) - self.call_action( + self.call_action_from_mapping( "move", [ { @@ -731,7 +731,7 @@ def set_voice(self, url: str, md5sum: str, size: int, voice_id: str): {"piid": 5, "value": md5sum}, {"piid": 6, "value": size}, ] - result_status = self.call_action("set_voice", params=params) + result_status = self.call_action_from_mapping("set_voice", params=params) if result_status["code"] == 0: click.echo("Installation complete!") diff --git a/miio/integrations/ijai/vacuum/pro2vacuum.py b/miio/integrations/ijai/vacuum/pro2vacuum.py index 6f35e3a5e..d0c303dab 100644 --- a/miio/integrations/ijai/vacuum/pro2vacuum.py +++ b/miio/integrations/ijai/vacuum/pro2vacuum.py @@ -286,17 +286,17 @@ def status(self) -> Pro2Status: @command() def home(self): """Go Home.""" - return self.call_action("home") + return self.call_action_from_mapping("home") @command() def start(self) -> None: """Start Cleaning.""" - return self.call_action("start") + return self.call_action_from_mapping("start") @command() def stop(self): """Stop Cleaning.""" - return self.call_action("stop") + return self.call_action_from_mapping("stop") @command( click.argument("fan_speed", type=EnumType(FanSpeedMode)), diff --git a/miio/integrations/mijia/vacuum/g1vacuum.py b/miio/integrations/mijia/vacuum/g1vacuum.py index 38eeea4bb..59826fe41 100644 --- a/miio/integrations/mijia/vacuum/g1vacuum.py +++ b/miio/integrations/mijia/vacuum/g1vacuum.py @@ -340,22 +340,22 @@ def cleaning_summary(self) -> G1CleaningSummary: @command() def home(self): """Home.""" - return self.call_action("home") + return self.call_action_from_mapping("home") @command() def start(self) -> None: """Start Cleaning.""" - return self.call_action("start") + return self.call_action_from_mapping("start") @command() def stop(self): """Stop Cleaning.""" - return self.call_action("stop") + return self.call_action_from_mapping("stop") @command() def find(self) -> None: """Find the robot.""" - return self.call_action("find") + return self.call_action_from_mapping("find") @command(click.argument("consumable", type=G1Consumable)) def consumable_reset(self, consumable: G1Consumable): @@ -364,11 +364,11 @@ def consumable_reset(self, consumable: G1Consumable): CONSUMABLE=main_brush_life_level|side_brush_life_level|filter_life_level """ if consumable.name == G1Consumable.MainBrush: - return self.call_action("reset_main_brush_life_level") + return self.call_action_from_mapping("reset_main_brush_life_level") elif consumable.name == G1Consumable.SideBrush: - return self.call_action("reset_side_brush_life_level") + return self.call_action_from_mapping("reset_side_brush_life_level") elif consumable.name == G1Consumable.Filter: - return self.call_action("reset_filter_life_level") + return self.call_action_from_mapping("reset_filter_life_level") @command( click.argument("fan_speed", type=EnumType(G1FanSpeed)), diff --git a/miio/integrations/mmgg/petwaterdispenser/device.py b/miio/integrations/mmgg/petwaterdispenser/device.py index b4afb191c..a2e543398 100644 --- a/miio/integrations/mmgg/petwaterdispenser/device.py +++ b/miio/integrations/mmgg/petwaterdispenser/device.py @@ -119,12 +119,12 @@ def set_mode(self, mode: OperatingMode) -> List[Dict[str, Any]]: @command(default_output=format_output("Resetting sponge filter")) def reset_sponge_filter(self) -> Dict[str, Any]: """Reset sponge filter.""" - return self.call_action("reset_filter_life") + return self.call_action_from_mapping("reset_filter_life") @command(default_output=format_output("Resetting cotton filter")) def reset_cotton_filter(self) -> Dict[str, Any]: """Reset cotton filter.""" - return self.call_action("reset_cotton_life") + return self.call_action_from_mapping("reset_cotton_life") @command(default_output=format_output("Resetting all filters")) def reset_all_filters(self) -> List[Dict[str, Any]]: @@ -134,12 +134,12 @@ def reset_all_filters(self) -> List[Dict[str, Any]]: @command(default_output=format_output("Resetting cleaning time")) def reset_cleaning_time(self) -> Dict[str, Any]: """Reset cleaning time counter.""" - return self.call_action("reset_clean_time") + return self.call_action_from_mapping("reset_clean_time") @command(default_output=format_output("Resetting device")) def reset(self) -> Dict[str, Any]: """Reset device.""" - return self.call_action("reset_device") + return self.call_action_from_mapping("reset_device") @command( click.argument("timezone", type=click.IntRange(-12, 12)), diff --git a/miio/integrations/roidmi/vacuum/roidmivacuum_miot.py b/miio/integrations/roidmi/vacuum/roidmivacuum_miot.py index 7330fd166..b5874fcb5 100644 --- a/miio/integrations/roidmi/vacuum/roidmivacuum_miot.py +++ b/miio/integrations/roidmi/vacuum/roidmivacuum_miot.py @@ -589,7 +589,7 @@ def cleaning_summary(self) -> RoidmiCleaningSummary: @command() def start(self) -> None: """Start cleaning.""" - return self.call_action("start") + return self.call_action_from_mapping("start") # @command(click.argument("roomstr", type=str, required=False)) # def start_room_sweep_unknown(self, roomstr: str=None) -> None: @@ -613,17 +613,17 @@ def start(self) -> None: @command() def stop(self) -> None: """Stop cleaning.""" - return self.call_action("stop") + return self.call_action_from_mapping("stop") @command() def home(self) -> None: """Return to home.""" - return self.call_action("home") + return self.call_action_from_mapping("home") @command() def identify(self) -> None: """Locate the device (i am here).""" - return self.call_action("identify") + return self.call_action_from_mapping("identify") @command(click.argument("on", type=bool)) def set_station_led(self, on: bool): @@ -757,7 +757,7 @@ def set_lidar_collision_sensor(self, lidar_collision: bool): @command() def start_dust(self) -> None: """Start base dust collection.""" - return self.call_action("start_station_dust_collection") + return self.call_action_from_mapping("start_station_dust_collection") # @command(click.argument("voice", type=str)) # def set_voice_unknown(self, voice: str) -> None: @@ -770,19 +770,19 @@ def start_dust(self) -> None: @command() def reset_filter_life(self) -> None: """Reset filter life.""" - return self.call_action("reset_filter_life") + return self.call_action_from_mapping("reset_filter_life") @command() def reset_mainbrush_life(self) -> None: """Reset main brush life.""" - return self.call_action("reset_main_brush_life") + return self.call_action_from_mapping("reset_main_brush_life") @command() def reset_sidebrush_life(self) -> None: """Reset side brushes life.""" - return self.call_action("reset_side_brushes_life") + return self.call_action_from_mapping("reset_side_brushes_life") @command() def reset_sensor_dirty_life(self) -> None: """Reset sensor dirty life.""" - return self.call_action("reset_sensor_dirty_life") + return self.call_action_from_mapping("reset_sensor_dirty_life")