-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Range device clean-up and minor review - Added "network type" check - Implemented device factory
- Loading branch information
Showing
8 changed files
with
141 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
from .ac import AirConditionerDevice | ||
from .dishwasher import DishWasherDevice | ||
from .dryer import DryerDevice | ||
from .range import RangeDevice | ||
from .refrigerator import RefrigeratorDevice | ||
from .styler import StylerDevice | ||
from .washer import WasherDevice | ||
|
||
from .device import UNIT_TEMP_CELSIUS, DeviceInfo, DeviceType, NetworkType | ||
|
||
|
||
def get_lge_device(client, device: DeviceInfo, temp_unit=UNIT_TEMP_CELSIUS): | ||
"""Return a device based on the device type.""" | ||
|
||
device_type = device.type | ||
network_type = device.network_type | ||
|
||
if network_type != NetworkType.WIFI: | ||
return None | ||
|
||
if device_type == DeviceType.AC: | ||
return AirConditionerDevice(client, device, temp_unit) | ||
if device_type == DeviceType.DISHWASHER: | ||
return DishWasherDevice(client, device) | ||
if device_type in [DeviceType.DRYER, DeviceType.TOWER_DRYER]: | ||
return DryerDevice(client, device) | ||
if device_type == DeviceType.RANGE: | ||
return RangeDevice(client, device) | ||
if device_type == DeviceType.REFRIGERATOR: | ||
return RefrigeratorDevice(client, device) | ||
if device_type == DeviceType.STYLER: | ||
return StylerDevice(client, device) | ||
if device_type in [DeviceType.WASHER, DeviceType.TOWER_WASHER]: | ||
return WasherDevice(client, device) | ||
|
||
return None |
Oops, something went wrong.