-
Notifications
You must be signed in to change notification settings - Fork 15
Split washer and dryer class #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e59e153
Split washer and dryer class
a68c952
Missed committing 1 change.
5b6b7cd
Change the dryer SAID to what is expected
71390d6
Split words per PR comment
f3f5038
Reverse machine state map per PR comment
432d137
Remove unneeded function per PR comment
0dc1749
Merge branch 'master' into split_washer_dryer
lllucius d5b450e
Per PR comment, shorten ATTR and function names
21e9834
Updates based on PR comments
6d153ff
Changes based on PR comments
bfd3479
Changes request in PR
22facc9
Additional changes as requested in PR
19a9544
Fix RUFF errors
4b338d1
Make corrections based on PR comments
899da5e
Rename methods/attrs
abmantis c929d22
Merge branch 'split_washer_dryer' of github.com:lllucius/whirlpool-si…
abmantis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,74 @@ | ||
import json | ||
|
||
import aioconsole | ||
|
||
from whirlpool.dryer import Dryer | ||
|
||
|
||
async def show_dryer_menu(dr: Dryer) -> None: | ||
def print_menu(): | ||
print("\n") | ||
print(30 * "-", "MENU", 30 * "-") | ||
print("u. Update status from server") | ||
print("p. Print status") | ||
print("v. Print raw status") | ||
print("c. Custom command") | ||
print("q. Exit") | ||
print(67 * "-") | ||
|
||
def print_status(dr: Dryer): | ||
print(f"online: {dr.get_online()}") | ||
print(f"state: {dr.get_machine_state()}") | ||
print(f"door open: {dr.get_door_open()}") | ||
print(f"est time remaining: {dr.get_est_time_remaining()}") | ||
print(f"extra power changeable: {dr.get_extra_power_changeable()}") | ||
print(f"steam changeable: {dr.get_steam_changeable()}") | ||
print(f"cycle select: {dr.get_cycle_changeable()}") | ||
print(f"dryness: {dr.get_dryness_changeable()}") | ||
print(f"manual dry time: {dr.get_manual_dry_time_changeable()}") | ||
print(f"static guard: {dr.get_static_guard_changeable()}") | ||
print(f"temperature: {dr.get_temperature_changeable()}") | ||
print(f"wrinkle shield: {dr.get_wrinkle_shield_changeable()}") | ||
print(f"airflow status: {dr.get_cycle_status_airflow_status()}") | ||
print(f"cool down: {dr.get_cycle_status_cool_down()}") | ||
print(f"damp: {dr.get_cycle_status_damp()}") | ||
print(f"drying: {dr.get_cycle_status_drying()}") | ||
print(f"limited cycle: {dr.get_cycle_status_limited_cycle()}") | ||
print(f"sensing: {dr.get_cycle_status_sensing()}") | ||
print(f"static reduce: {dr.get_cycle_status_static_reduce()}") | ||
print(f"steaming: {dr.get_cycle_status_steaming()}") | ||
print(f"wet: {dr.get_cycle_status_wet()}") | ||
print(f"cycle count: {dr.get_cycle_count()}") | ||
|
||
print(f"set dryness: {dr.get_dryness()}") | ||
print(f"set manual dry time: {dr.get_manual_dry_time()}") | ||
print(f"set cycle select: {dr.get_cycle()}") | ||
print(f"set temperature: {dr.get_temperature()}") | ||
print(f"set wrinkle shield: {dr.get_wrinkle_shield()}") | ||
|
||
def attr_upd(): | ||
print("Attributes updated") | ||
|
||
dr.register_attr_callback(attr_upd) | ||
|
||
loop = True | ||
while loop: | ||
print_menu() | ||
choice = await aioconsole.ainput("Enter your choice: ") | ||
|
||
if choice == "p": | ||
print_status(dr) | ||
elif choice == "u": | ||
await dr.fetch_data() | ||
print_status(dr) | ||
elif choice == "v": | ||
print(json.dumps(dr._data_dict, indent=4)) | ||
elif choice == "c": | ||
cmd = await aioconsole.ainput("Command: ") | ||
val = await aioconsole.ainput("Value: ") | ||
await dr.send_attributes({cmd: val}) | ||
elif choice == "q": | ||
print("Bye") | ||
loop = False | ||
else: | ||
print("Wrong option selection. Enter any key to try again..") |
This file contains hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
from whirlpool.appliancesmanager import AppliancesManager | ||
from whirlpool.dryer import ( | ||
Cycle, | ||
Dryness, | ||
MachineState, | ||
Temperature, | ||
WrinkleShield, | ||
) | ||
|
||
|
||
async def test_attributes(appliances_manager: AppliancesManager): | ||
dryer = appliances_manager.dryers[0] | ||
assert dryer.get_machine_state() == MachineState.Standby | ||
assert not dryer.get_door_open() | ||
assert dryer.get_est_time_remaining() == 1800 | ||
assert not dryer.get_drum_light_on() | ||
assert dryer.get_steam_changeable() | ||
assert not dryer.get_cycle_changeable() | ||
assert dryer.get_dryness_changeable() | ||
assert dryer.get_manual_dry_time_changeable() | ||
assert dryer.get_steam_changeable() | ||
assert dryer.get_wrinkle_shield_changeable() | ||
assert dryer.get_dryness() == Dryness.High | ||
assert dryer.get_manual_dry_time() == 1800 | ||
assert dryer.get_cycle() == Cycle.TimedDry | ||
assert not dryer.get_cycle_status_airflow_status() | ||
assert not dryer.get_cycle_status_cool_down() | ||
assert not dryer.get_cycle_status_damp() | ||
assert not dryer.get_cycle_status_drying() | ||
assert not dryer.get_cycle_status_limited_cycle() | ||
assert not dryer.get_cycle_status_sensing() | ||
assert not dryer.get_cycle_status_static_reduce() | ||
assert not dryer.get_cycle_status_steaming() | ||
assert not dryer.get_cycle_status_wet() | ||
assert dryer.get_cycle_count() == 195 | ||
assert dryer.get_damp_notification_tone_volume() == 0 | ||
assert dryer.get_alert_tone_volume() == 0 | ||
assert dryer.get_temperature() == Temperature.Cool | ||
assert dryer.get_wrinkle_shield() == WrinkleShield.Off |
lllucius marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,19 @@ | ||
from whirlpool.appliancesmanager import AppliancesManager | ||
from whirlpool.washer import MachineState | ||
|
||
|
||
async def test_attributes(appliances_manager: AppliancesManager): | ||
washer = appliances_manager.washers[0] | ||
|
||
assert washer.get_machine_state() == MachineState.Standby | ||
assert washer.get_cycle_status_sensing() is False | ||
assert washer.get_cycle_status_filling() is False | ||
assert washer.get_cycle_status_soaking() is False | ||
assert washer.get_cycle_status_washing() is False | ||
assert washer.get_cycle_status_rinsing() is False | ||
assert washer.get_cycle_status_spinning() is False | ||
assert washer.get_dispense_1_level() == 4 | ||
assert washer.get_door_open() is True | ||
assert washer.get_time_remaining() == 4080 | ||
|
||
|
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.