mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-29 13:30:26 -07:00
Added a data directory with known values for washers/dryers.
Also added temp_control and time_Dry properties to dryer status.
This commit is contained in:
parent
53f736b5c6
commit
48684c14fd
1830
data/dryer-US-RV13B6AM_D_US_WIFI.json
Normal file
1830
data/dryer-US-RV13B6AM_D_US_WIFI.json
Normal file
File diff suppressed because it is too large
Load Diff
2287
data/dryer-US-RV13B6ES_D_US_WIFI.json
Normal file
2287
data/dryer-US-RV13B6ES_D_US_WIFI.json
Normal file
File diff suppressed because it is too large
Load Diff
2618
data/washer-US-F3L2CNV4W_WIFI.json
Normal file
2618
data/washer-US-F3L2CNV4W_WIFI.json
Normal file
File diff suppressed because it is too large
Load Diff
2785
data/washer-US-F3L2CYV5W_WIFI.json
Normal file
2785
data/washer-US-F3L2CYV5W_WIFI.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,26 +2,27 @@ import json
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from wideq.client import Client, DeviceInfo
|
from wideq.client import Client, DeviceInfo
|
||||||
from wideq.dryer import DryerDevice, DryLevel, DryerState, DryerStatus
|
from wideq.dryer import (
|
||||||
|
DryerDevice, DryLevel, DryerState, DryerStatus, TempControl, TimeDry)
|
||||||
|
|
||||||
|
|
||||||
POLL_DATA = {
|
POLL_DATA = {
|
||||||
'Course': '5',
|
'Course': '2',
|
||||||
'CurrentDownloadCourse': '100',
|
'CurrentDownloadCourse': '100',
|
||||||
'DryLevel': '0',
|
'DryLevel': '3',
|
||||||
'Error': '0',
|
'Error': '0',
|
||||||
'Initial_Time_H': '0',
|
'Initial_Time_H': '0',
|
||||||
'Initial_Time_M': '1',
|
'Initial_Time_M': '55',
|
||||||
'LoadItem': '0',
|
'LoadItem': '0',
|
||||||
'MoreLessTime': '0',
|
'MoreLessTime': '0',
|
||||||
'Option1': '64',
|
'Option1': '0',
|
||||||
'Option2': '168',
|
'Option2': '168',
|
||||||
'PreState': '4',
|
'PreState': '1',
|
||||||
'Remain_Time_H': '0',
|
'Remain_Time_H': '0',
|
||||||
'Remain_Time_M': '1',
|
'Remain_Time_M': '54',
|
||||||
'SmartCourse': '0',
|
'SmartCourse': '0',
|
||||||
'State': '0',
|
'State': '50',
|
||||||
'TempControl': '0',
|
'TempControl': '4',
|
||||||
'TimeDry': '0',
|
'TimeDry': '0',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,14 +48,16 @@ class DryerStatusTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_properties(self):
|
def test_properties(self):
|
||||||
status = DryerStatus(self.dryer, POLL_DATA)
|
status = DryerStatus(self.dryer, POLL_DATA)
|
||||||
self.assertEqual(DryerState.OFF, status.state)
|
self.assertEqual(DryerState.DRYING, status.state)
|
||||||
self.assertEqual(DryerState.END, status.previous_state)
|
self.assertEqual(DryerState.INITIAL, status.previous_state)
|
||||||
self.assertEqual(DryLevel.OFF, status.dry_level)
|
self.assertEqual(DryLevel.NORMAL, status.dry_level)
|
||||||
self.assertFalse(status.is_on)
|
self.assertTrue(status.is_on)
|
||||||
self.assertEqual('0', status.remain_time_hours)
|
self.assertEqual('0', status.remain_time_hours)
|
||||||
self.assertEqual('1', status.remain_time_minutes)
|
self.assertEqual('54', status.remain_time_minutes)
|
||||||
self.assertEqual('0', status.initial_time_hours)
|
self.assertEqual('0', status.initial_time_hours)
|
||||||
self.assertEqual('1', status.initial_time_minutes)
|
self.assertEqual('55', status.initial_time_minutes)
|
||||||
self.assertEqual('Delicates', status.course)
|
self.assertEqual('Towels', status.course)
|
||||||
self.assertEqual('Off', status.smart_course)
|
self.assertEqual('Off', status.smart_course)
|
||||||
self.assertEqual('No Error', status.error)
|
self.assertEqual('No Error', status.error)
|
||||||
|
self.assertEqual(TempControl.MID_HIGH, status.temperature_control)
|
||||||
|
self.assertEqual(TimeDry.OFF, status.time_dry)
|
||||||
|
@ -54,6 +54,28 @@ class DryerError(enum.Enum):
|
|||||||
ERROR_TE6 = '@WM_US_DRYER_ERROR_TE6_W'
|
ERROR_TE6 = '@WM_US_DRYER_ERROR_TE6_W'
|
||||||
|
|
||||||
|
|
||||||
|
class TempControl(enum.Enum):
|
||||||
|
"""Represents temperature control setting."""
|
||||||
|
|
||||||
|
OFF = '-'
|
||||||
|
ULTRA_LOW = '@WM_DRY27_TEMP_ULTRA_LOW_W'
|
||||||
|
LOW = '@WM_DRY27_TEMP_LOW_W'
|
||||||
|
MEDIUM = '@WM_DRY27_TEMP_MEDIUM_W'
|
||||||
|
MID_HIGH = '@WM_DRY27_TEMP_MID_HIGH_W'
|
||||||
|
HIGH = '@WM_DRY27_TEMP_HIGH_W'
|
||||||
|
|
||||||
|
|
||||||
|
class TimeDry(enum.Enum):
|
||||||
|
"""Represents a timed dry setting."""
|
||||||
|
|
||||||
|
OFF = '-'
|
||||||
|
TWENTY = '20'
|
||||||
|
THIRTY = '30'
|
||||||
|
FOURTY = '40'
|
||||||
|
FIFTY = '50'
|
||||||
|
SIXTY = '60'
|
||||||
|
|
||||||
|
|
||||||
class DryerDevice(Device):
|
class DryerDevice(Device):
|
||||||
"""A higher-level interface for a dryer."""
|
"""A higher-level interface for a dryer."""
|
||||||
|
|
||||||
@ -114,6 +136,18 @@ class DryerStatus(object):
|
|||||||
attr = 'DryLevel'
|
attr = 'DryLevel'
|
||||||
return DryLevel(self.dryer.model.enum_name(attr, self.data[attr]))
|
return DryLevel(self.dryer.model.enum_name(attr, self.data[attr]))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def temperature_control(self) -> TempControl:
|
||||||
|
"""Get the temperature control setting."""
|
||||||
|
attr = 'TempControl'
|
||||||
|
return TempControl(self.dryer.model.enum_name(attr, self.data[attr]))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def time_dry(self) -> TimeDry:
|
||||||
|
"""Get the time dry setting."""
|
||||||
|
attr = 'TimeDry'
|
||||||
|
return TimeDry(self.dryer.model.enum_name(attr, self.data[attr]))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Check if the dryer is on or not."""
|
"""Check if the dryer is on or not."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user