gvigroux / hon

Support of all Haier, Candy, Hoover appliances integrated in the official hOn mobile app. Direct access to all possible services and parameters
MIT License
118 stars 45 forks source link

[FEATURE REQUEST]: allow passing `prCode` (predefined program) to `washingmachine_start` service #65

Closed ndom91 closed 1 year ago

ndom91 commented 1 year ago

It seems to be possible to pass the prCode (predefined program) to the Haier backend when calling the service start. This would avoid manually defining the water temperature, rinse cycles, etc. For example, I often just use the "Eco 40-60" predefined program from the hOn app (prCode: 136).

We would just need to add a field to the service and pass it through.

See prCode parameter in this method:

https://github.com/gvigroux/hon/blob/f0a944373fa7df8cb543ed4030d7d64eb48d96f0/__init__.py#L171-L184

More info: https://github.com/gvigroux/hon/issues/62#issuecomment-1483847712

slegars56 commented 1 year ago

Hey, I'm working on it.

image

One same prCode can be used for different programs with a few variation of settings like the spin speed. I use the programName instead:

image

There are a bunch of programs! I hope to make a PR this week.

FYI, the service has been renamed "turn_on_washingmachine" in the refactored version.

slegars56 commented 1 year ago

progam settings example:

 { "prCode": "89",
    "name": "Ariel Cold Clean",
    "programName": "IOT_WASH_ARIEL_COLD_CYCLE",
    "spinSpeed": "1000",
    "temp": "30",
    "rinseIterations": "2",
    "mainWashTime": "10",
    "duration": 74
    },
ndom91 commented 1 year ago

Ah okay, program name is even easier to recognize though and doesn't require some trial & error to setup correctly. So, nice change!

Regarding the change in the service name - was that required? What was it before?

ndom91 commented 1 year ago

@slegars56 do you have a branch or something where you're working on this? I saw your PR adding the Mode field to the washing machines as well (Thanks btw - was missing this for automations :blush:).

Let me knwo if you want a hand with the service program field :+1:

gvigroux commented 1 year ago

@ndom91 , @slegars56 , I've made a the first proposal to activate any program and change any parameters :) please test. If you prefer a different way to integrate, you can propose by opening a new issue :)

ndom91 commented 1 year ago

@slegars56 @gvigroux I've updated to the latest version (0.4.1), but I still don't see an option for the program in the turn_on_washingmachine job. See screenshot:

Screenshot_2023-04-23-15-08-04-67.jpg

I did notice a new job called something like hOn.start_program. But this seems to be device type independent and take a manually entered program name, which can be easy to mistype.

Is there anyway we can add the program selection to the primary "start washingmachine" service, as an alternative to the temp/cycles/etc. settings.

And in addition, I remember reading here that you could provide the list of program names, so a user can auto-fill the name or just select it in a dropdown. Was it not possible to query all available program names/labels?

EDIT: nevermind, saw the notifications after update for all the programs. That answers some of my questions haha. But definitely not an ideal wya to do that 😉