-
Notifications
You must be signed in to change notification settings - Fork 31
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
Tumble Dryer - Improve DryLevel #29
Conversation
Aded DryLevelState class. Several tests.
Codecov Report
@@ Coverage Diff @@
## main #29 +/- ##
==========================================
- Coverage 88.82% 88.68% -0.15%
==========================================
Files 6 6
Lines 555 592 +37
==========================================
+ Hits 493 525 +32
- Misses 62 67 +5
Continue to review full report at Codecov.
|
@@ -132,11 +156,11 @@ def from_json(cls, json): | |||
return cls( | |||
machine_state=MachineState(int(json["StatoTD"])), | |||
program_state=DryerProgramState(int(json["PrPh"])), | |||
dry_level_state=DryLevelState(int(json["DryingManagerLevel"])), | |||
program=int(json["Pr"]), | |||
remaining_minutes=int(json["RemTime"]), | |||
remote_control=json["StatoWiFi"] == "1", | |||
dry_level=int(json["DryLev"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest calling this target_dry_level
to make it obvious the difference
@@ -202,10 +203,12 @@ def extra_state_attributes(self) -> Mapping[str, Any]: | |||
|
|||
attributes = { | |||
"program": status.program, | |||
"machine_state": str(status.machine_state), | |||
"program_state": str(status.program_state), | |||
"dry_level_state": str(status.dry_level_state), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"dry_level_state": str(status.dry_level_state), | |
"current_dry_level": str(status.dry_level_state), |
'icon': 'mdi:tumble-dryer' | ||
} | ||
|
||
|
||
async def test_sensors_device_info(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the new sensor to this test case too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks for the extra test cases too! I had a few minor comments.
I'm closing this PR as #32 added support for the same thing |
I've created a mapper for DryLevel with the values found in candy simply-fi code.
I've improved the DryLevel state by creating a new sensor (dryer_current_dry_level). This could be usefull to create automations based in the dry level of the machine.
Also i've added several new tests for the machine.