ofalvai / home-assistant-candy

Unofficial Candy/Haier appliance integration for Home Assistant
123 stars 30 forks source link

0.6.2 - Can't handle 'DryerProgramState' #59

Open GilbyDettori opened 2 years ago

GilbyDettori commented 2 years ago
image

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

ofalvai commented 2 years ago

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 commented 2 years ago

2022-02-10 13:35:54 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /homeassistant/restart request Server disconnected Capture d’écran 2022-02-10 134701

`2022-02-10 13:35:17 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 0.3s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)]) 2022-02-10 13:35:20 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 1.5s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)]) 2022-02-10 13:35:23 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 2.0s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)]) 2022-02-10 13:35:26 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 1.6s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)]) 2022-02-10 13:35:29 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 10.9s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)]) 2022-02-10 13:35:43 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 19.3s Why does it not detect when the dryer is off? This creates a lot of errors in home assistant ..... It would be nice to solve the problem otherwise I will have to remove this extension.

(aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)])`

2022-02-10 13:34:44 INFO (MainThread) [custom_components.candy.client] Backing off status_with_retry(...) for 5.4s (aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.47:80 ssl:default [Connect call failed ('192.168.1.47', 80)])

Alex2zl commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

There is some extra magic in the "Dryer cycle status" sensor: https://github.com/ofalvai/home-assistant-candy/blob/79cf5dbc1878e2007ec51b779f0d2fd17d796e26/custom_components/candy/sensor.py#L243-L247

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.