diff --git a/miio/airconditioningcompanion.py b/miio/airconditioningcompanion.py index d4a19e3a9..7012cca09 100644 --- a/miio/airconditioningcompanion.py +++ b/miio/airconditioningcompanion.py @@ -267,7 +267,7 @@ class AirConditioningCompanion(Device): ) def status(self) -> AirConditioningCompanionStatus: """Return device status.""" - status = self.send("get_model_and_state", []) + status = self.send("get_model_and_state") return AirConditioningCompanionStatus(status) @command( @@ -298,7 +298,7 @@ def learn(self, slot: int=STORAGE_SLOT_ID): ) def learn_result(self): """Read the learned command.""" - return self.send("get_ir_learn_result", []) + return self.send("get_ir_learn_result") @command( click.argument("slot", type=int), diff --git a/miio/chuangmi_plug.py b/miio/chuangmi_plug.py index 8dfcfbd93..a031f36c9 100644 --- a/miio/chuangmi_plug.py +++ b/miio/chuangmi_plug.py @@ -131,7 +131,7 @@ def status(self) -> ChuangmiPlugStatus: properties_count, values_count) if self.model == MODEL_CHUANGMI_PLUG_V3: - load_power = self.send("get_power", []) # Response: [300] + load_power = self.send("get_power") # Response: [300] if len(load_power) == 1: properties.append('load_power') values.append(load_power[0] * 0.01) @@ -145,7 +145,7 @@ def status(self) -> ChuangmiPlugStatus: def on(self): """Power on.""" if self.model == MODEL_CHUANGMI_PLUG_V1: - return self.send("set_on", []) + return self.send("set_on") return self.send("set_power", ["on"]) @@ -155,7 +155,7 @@ def on(self): def off(self): """Power off.""" if self.model == MODEL_CHUANGMI_PLUG_V1: - return self.send("set_off", []) + return self.send("set_off") return self.send("set_power", ["off"]) @@ -164,14 +164,14 @@ def off(self): ) def usb_on(self): """Power on.""" - return self.send("set_usb_on", []) + return self.send("set_usb_on") @command( default_output = format_output("Powering USB off"), ) def usb_off(self): """Power off.""" - return self.send("set_usb_off", []) + return self.send("set_usb_off") @command( click.argument("wifi_led", type=bool), diff --git a/miio/cooker.py b/miio/cooker.py index bdef7a4e4..f552ef66b 100644 --- a/miio/cooker.py +++ b/miio/cooker.py @@ -817,7 +817,7 @@ def get_temperature_history(self) -> TemperatureHistory: The temperature is only available while cooking. Approx. six data points per minute. """ - data = self.send('get_temp_history', []) + data = self.send('get_temp_history') return TemperatureHistory(data[0]) diff --git a/miio/device.py b/miio/device.py index a1c9598f7..29c845019 100644 --- a/miio/device.py +++ b/miio/device.py @@ -230,6 +230,8 @@ def send(self, command: str, parameters: Any=None, retry_count=3) -> Any: if parameters is not None: cmd["params"] = parameters + else: + cmd["params"] = [] send_ts = self._device_ts + datetime.timedelta(seconds=1) header = {'length': 0, 'unknown': 0x00000000, @@ -314,7 +316,7 @@ def info(self) -> DeviceInfo: """Get miIO protocol information from the device. This includes information about connected wlan network, and harware and software versions.""" - return DeviceInfo(self.send("miIO.info", [])) + return DeviceInfo(self.send("miIO.info")) def update(self, url: str, md5: str): """Start an OTA update.""" @@ -329,11 +331,11 @@ def update(self, url: str, md5: str): def update_progress(self) -> int: """Return current update progress [0-100].""" - return self.send("miIO.get_ota_progress", [])[0] + return self.send("miIO.get_ota_progress")[0] def update_state(self): """Return current update state.""" - return UpdateState(self.send("miIO.get_ota_state", [])[0]) + return UpdateState(self.send("miIO.get_ota_state")[0]) def configure_wifi(self, ssid, password, uid=0, extra_params=None): """Configure the wifi settings.""" diff --git a/miio/wifirepeater.py b/miio/wifirepeater.py index bef6eec8d..8a0c5b33b 100644 --- a/miio/wifirepeater.py +++ b/miio/wifirepeater.py @@ -94,7 +94,7 @@ class WifiRepeater(Device): ) def status(self) -> WifiRepeaterStatus: """Return the associated stations.""" - return WifiRepeaterStatus(self.send("miIO.get_repeater_sta_info", [])) + return WifiRepeaterStatus(self.send("miIO.get_repeater_sta_info")) @command( default_output=format_output( @@ -107,7 +107,7 @@ def status(self) -> WifiRepeaterStatus: def configuration(self) -> WifiRepeaterConfiguration: """Return the configuration of the accesspoint.""" return WifiRepeaterConfiguration( - self.send("miIO.get_repeater_ap_info", [])) + self.send("miIO.get_repeater_ap_info")) @command( click.argument("wifi_roaming", type=bool),