Skip to content
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

Closed
wants to merge 8 commits into from
Closed

Conversation

thorin8k
Copy link
Contributor

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.

@codecov
Copy link

codecov bot commented Oct 16, 2021

Codecov Report

Merging #29 (54a381e) into main (e799fc6) will decrease coverage by 0.14%.
The diff coverage is 81.57%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
custom_components/candy/client/model.py 79.67% <63.15%> (-0.80%) ⬇️
custom_components/candy/const.py 100.00% <100.00%> (ø)
custom_components/candy/sensor.py 98.90% <100.00%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e799fc6...54a381e. Read the comment docs.

@thorin8k thorin8k mentioned this pull request Oct 16, 2021
@@ -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"]),
Copy link
Owner

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),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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):
Copy link
Owner

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

Copy link
Owner

@ofalvai ofalvai left a 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.

@ofalvai
Copy link
Owner

ofalvai commented Nov 14, 2022

I'm closing this PR as #32 added support for the same thing

@ofalvai ofalvai closed this Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants