|
8 | 8 | from .click_common import EnumType, command, format_output |
9 | 9 | from .device import Device, DeviceStatus |
10 | 10 | from .exceptions import DeviceException |
| 11 | +from .utils import deprecated |
11 | 12 |
|
12 | 13 | _LOGGER = logging.getLogger(__name__) |
13 | 14 |
|
@@ -97,8 +98,14 @@ def mode(self) -> Optional[PowerMode]: |
97 | 98 | return PowerMode(self.data["mode"]) |
98 | 99 | return None |
99 | 100 |
|
100 | | - @property |
| 101 | + @property # type: ignore |
| 102 | + @deprecated("Use led instead of wifi_led") |
101 | 103 | def wifi_led(self) -> Optional[bool]: |
| 104 | + """True if the wifi led is turned on.""" |
| 105 | + return self.led |
| 106 | + |
| 107 | + @property |
| 108 | + def led(self) -> Optional[bool]: |
102 | 109 | """True if the wifi led is turned on.""" |
103 | 110 | if "wifi_led" in self.data and self.data["wifi_led"] is not None: |
104 | 111 | return self.data["wifi_led"] == "on" |
@@ -182,13 +189,24 @@ def set_power_mode(self, mode: PowerMode): |
182 | 189 | # green, normal |
183 | 190 | return self.send("set_power_mode", [mode.value]) |
184 | 191 |
|
| 192 | + @deprecated("use set_led instead of set_wifi_led") |
185 | 193 | @command( |
186 | 194 | click.argument("led", type=bool), |
187 | 195 | default_output=format_output( |
188 | 196 | lambda led: "Turning on WiFi LED" if led else "Turning off WiFi LED" |
189 | 197 | ), |
190 | 198 | ) |
191 | 199 | def set_wifi_led(self, led: bool): |
| 200 | + """Set the wifi led on/off.""" |
| 201 | + self.set_led(led) |
| 202 | + |
| 203 | + @command( |
| 204 | + click.argument("led", type=bool), |
| 205 | + default_output=format_output( |
| 206 | + lambda led: "Turning on LED" if led else "Turning off LED" |
| 207 | + ), |
| 208 | + ) |
| 209 | + def set_led(self, led: bool): |
192 | 210 | """Set the wifi led on/off.""" |
193 | 211 | if led: |
194 | 212 | return self.send("set_wifi_led", ["on"]) |
|
0 commit comments