-
Notifications
You must be signed in to change notification settings - Fork 28
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 - Add Cycle State #32
Conversation
This reverts commit adc2e36.
Codecov Report
@@ Coverage Diff @@
## main #32 +/- ##
==========================================
- Coverage 89.52% 88.52% -1.00%
==========================================
Files 6 6
Lines 563 584 +21
==========================================
+ Hits 504 517 +13
- Misses 59 67 +8
Continue to review full report at Codecov.
|
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.
Left some comments about naming stuff properly.
Also, do we understand now what each dry level property means in practice? I'm not sure about the meaning based on the discussion in #5
@@ -234,7 +234,10 @@ def unique_id(self) -> str: | |||
@property | |||
def state(self) -> StateType: | |||
status: TumbleDryerStatus = self.coordinator.data | |||
return str(status.program_state) | |||
if status.program_state in [DryerProgramState.STOPPED]: |
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 don't think it's a good idea to mix two properties in a single sensor. For other appliances, there are a separate sensor for the main machine state and eg. the wash program 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.
The other tumble dryer PR (#29) creates a separate sensor for the dry level, I think that's a better approach.
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.
More sensors, more resources. And in this case, the tumble_cycle_status's sensor is almost useless because is overlapped by tumble_dryer.
It would be much more consistent, IMHO, to harmonize it to wash_cycle_status.
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.
Okay, I can see that it makes sense for the dryer that only has 3 program states (the washing machine has 10)
@@ -113,10 +113,33 @@ def __str__(self): | |||
return "%s" % self | |||
|
|||
|
|||
class DryerCycleState(Enum): |
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.
If the values of this enum are different dry levels, I don't think DryerCycleState
is a good name for the enum itself. I would suggest something like DryLevel
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.
That's a cycle. Tumble dryer start is cycle from 1 and ends with the level set. IMHO that's more mnemonic.
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.
Makes sense, thanks!
I've done some tests. Starting dryer cycles and look API vars. What tumble dryer display says it's different from API and Candy's APP. For instance, when with API I reach DryLev 2 (Hang Dry), there is a mismatch with physical tumble display (reach Store Dry). Maybe others tumble dryer model, have this function, or there is a bug with this function. Anyway either API and Candy's APP are consistent, but physical machine's display show different -> this is a bug. |
Thanks for the explanation @terminet85, this is indeed weird. Let's stick to one interpretation of the values for now, then later we can iterate on it, maybe other owners chime in as well. |
With this commit I've added the level state (DryLev) to the CandyTumbleStatusSensor. When DryerProgramState is STOPPED we set the reached dry level.