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

0.6.2 - Can't handle 'DryerProgramState' #59

Open
GilbyDettori opened this issue Feb 8, 2022 · 6 comments
Open

0.6.2 - Can't handle 'DryerProgramState' #59

GilbyDettori opened this issue Feb 8, 2022 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@GilbyDettori
Copy link

image

Retrying setup: Error communicating with API: ValueError("Unrecognized code when parsing <enum 'DryerProgramState'>: 1")

@ofalvai
Copy link
Owner

ofalvai commented Feb 8, 2022

The code that handles dryers can't parse the state of 1: https://github.com/ofalvai/home-assistant-candy/blob/main/custom_components/candy/client/model.py#L72

If you help me understand what this state means (and validate if the other state values are correct for your device) then I can make a fix. This state value is called PrPh in the raw JSON response.

@Mick51

This comment was marked as off-topic.

@Alex2zl
Copy link

Alex2zl commented Nov 14, 2022

Good afternoon!
Need your help with the same error. What information should I provide to correct this error?
There is a Hoover H7A1TKEX-07 (Candy H7A1TCEX-07) dryer, connected it to integration, when you turn the control wheel and select the operating mode (cotton, dark clothes, etc.), it shows that the machine is turned on and the drying status changes, everything is ok. But as soon as I run the selected program, an error appears in the integration: Error communicating with API: ValueError("Unrecognized code when parsing <enum 'DryerProgramState'>: 1").
The error is not shown only in one mode (anti-odor)

@ofalvai
Copy link
Owner

ofalvai commented Nov 14, 2022

@Alex2zl I recommend observing the JSON response of the device in various states. Seems like the status value of 1 means something like "running", but the value of 2 also means "running" according to previous contributors.

See this about how to read the raw JSON response.

@Alex2zl
Copy link

Alex2zl commented Nov 14, 2022

Thank you.
I tried to change RUNNING = (2, "Running") to RUNNING = (1, "Running") in model.py, it helped, there is no error, but the "Running" value is now substituted in the Dryer cycle status field, then it changes to "end", but the machine is still running. Then, after some time, the work is completed, finished appears in the Tumble dryer field, and Hang Dry in the DryerCycleState (or another value that corresponds to dry drying)
It seems that the parser confuses the DryerProgramState and DryerCycleState fields

@ofalvai
Copy link
Owner

ofalvai commented Nov 19, 2022

There is some extra magic in the "Dryer cycle status" sensor:

status: TumbleDryerStatus = self.coordinator.data
if status.program_state in [DryerProgramState.STOPPED]:
return str(status.cycle_state)
else:
return str(status.program_state)

If you think the CycleState, MachineState and the ProgramState enums are confusing and don't make sense, please create a PR with better values :) I don't personally own a Candy dryer, and this appliance was contributed to this repo, so I rely on others to make sense of the API response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants