Skip to content

Home Connect add WasherDryer support#90673

Merged
frenck merged 6 commits into
home-assistant:devfrom
stickpin:home_connect_washer_dryer
Apr 30, 2023
Merged

Home Connect add WasherDryer support#90673
frenck merged 6 commits into
home-assistant:devfrom
stickpin:home_connect_washer_dryer

Conversation

@stickpin
Copy link
Copy Markdown
Contributor

@stickpin stickpin commented Apr 2, 2023

Proposed change

Add WasherDryer support. #90520
This PR also handles multi-type programs issues discussed in this thread: DavidMStraub/homeassistant-homeconnect#119
I cannot fully test it myself as I don't have a WasherDryer appliance.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Apr 2, 2023

Hey there @DavidMStraub, mind taking a look at this pull request as it has been labeled with an integration (home_connect) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of home_connect can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign home_connect Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@BraveChicken1
Copy link
Copy Markdown
Contributor

This change probably has the same issue as DavidMStraub/homeassistant-homeconnect#119

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented Apr 10, 2023

@BraveChicken1 Thanks for pointing that out. Yes, I guess you are right.
It seems that the only way to resolve it, it's to make a breaking change.
Unfortunately, I cannot test it myself, as I don't have a WasherDryer.

desc = " ".join(["Program", program_name.split(".")[-1]])

I need to see how to change the PR so it will only affect the WasherDryer.

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented Apr 10, 2023

@BraveChicken1, I think I have a solution.

For appliance types like WasherDryer programs will be displayed with a program type and program name.

As I don't have WasherDryer I did POC with my Dishwasher.

For example: if the full program name is Dishcare.Dishwasher.Program.Auto2 the program will be displayed as Program Dishwasher Auto2 this will solve the issue for multi-type program appliances.

Here is the result in Home Assistant:
Screenshot 2023-04-10 at 19 01 36

I will submit the PR in a few minutes.

@stickpin
Copy link
Copy Markdown
Contributor Author

@BraveChicken1 submitted the fix. Thanks for pointing this out once again! :)

@DavidMStraub
Copy link
Copy Markdown
Contributor

What about #89113?

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented Apr 10, 2023

@DavidMStraub it's outdated. I already commented there.
It's still using an "old" static programs list and doesn't have a fix for WasherDryer program names.

@BraveChicken1
Copy link
Copy Markdown
Contributor

I think this should work. Thank you!

Copy link
Copy Markdown
Contributor

@BraveChicken1 BraveChicken1 left a comment

Choose a reason for hiding this comment

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

Not tested but looks good to me

@DennisGaida
Copy link
Copy Markdown

Can't test right now, but I'm one of the persons that own a WasherDryer. Will test once I get back - if still necessary then. The PR looks simple enough though.

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented Apr 11, 2023

Hi @DennisGaida,

Yes, it will be great if you can test it with a real appliance.
Please let me know in case of any issues.

Thanks a lot! :)

@MoeweX
Copy link
Copy Markdown

MoeweX commented Apr 30, 2023

Hi @stickpin, I only started to use HomeAssistant today and landed quite quickly on this PR because my WashDryer was not found. I now also have finally managed to get your branch running and validated that the WashDryer shows up. As I do not know to much about HomeAssistant yet, I don't know if what I see is what one would expect, so please find attached a screenshot of the device overview. Should I test something else? Is it normal that "duration" is not available?

Bildschirm­foto 2023-04-30 um 12 52 17

If I were to toggle the Power or Program switch, is the program that actually aborted? I do not dare to try that right now.

Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @stickpin 👍

../Frenck

@frenck frenck merged commit 9317ddb into home-assistant:dev Apr 30, 2023
raman325 added a commit to raman325/home-assistant that referenced this pull request Apr 30, 2023
* dev: (581 commits)
  Only store and pass around coordinator in Rituals Perfume Genie (home-assistant#92298)
  Avoid returning statistics columns that the metadata knows are impossible (home-assistant#92095)
  Add `date` platform (home-assistant#81948)
  Prevent pysnmp from being installed as it does not work with newer python (home-assistant#92292)
  Use SnapshotAssertion in Renault tests (home-assistant#90778)
  Home Connect add WasherDryer support (home-assistant#90673)
  Move lastfm constants to separate file (home-assistant#92289)
  Fix august lock state when API reports locking and locked with the same timestamp (home-assistant#92276)
  Ensure onvif webhook can be registered (home-assistant#92295)
  Bump beacontools to fix conflict with construct<2.10 and >=2.8.16 (home-assistant#92293)
  Bump pynina to 0.3.0 (home-assistant#92286)
  Fix mqtt not available when starting snips (home-assistant#92296)
  Extract Rituals Perfume Genie DataUpdateCoordinator into module (home-assistant#92284)
  Bump bleak to 0.20.2 (home-assistant#92294)
  Add missing fstrings in Local Calendar (home-assistant#92288)
  Remove myself from switcher_kis codeowners (home-assistant#92277)
  Handle AttributeError from wrong port in ONVIF config flow (home-assistant#92272)
  Auto repair incorrect collation on MySQL schema (home-assistant#92270)
  Update orjson to 3.8.11 (home-assistant#92228)
  Update coverage to 7.2.4 (home-assistant#92229)
  ...
@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented May 1, 2023

@frenck thanks! :)

Hi @MoeweX,

Thanks a lot for reporting back!
Interesting that integration found only one program for you. I guess you added the integration when your appliance was running.
Can you please try to turn on the device and restart the Home Assitant? Integration should fetch all the available programs for your device. It should be much more than one. :)

Regarding the behavior. I don't have WasherDryer to test it with but in general, If you switch off the program, the current running operation will be aborted. If you power off the device, it will turn off and the program will be resumed once you turn it on. At least that's what's happening with my Dishwasher.

@MoeweX
Copy link
Copy Markdown

MoeweX commented May 1, 2023

Hi @stickpin ,

yes I initially onboarded it while running a program, now I tried again and many more programs showed up :).

While playing around with the controls, I noticed the power button is not working:

Logger: homeassistant.components.home_connect.switch
Source: components/home_connect/switch.py:132
Integration: Home Connect (documentation, issues)
First occurred: 13:55:57 (2 occurrences)
Last logged: 13:56:00

Error while trying to turn off device: {'description': 'Key BSH.Common.Setting.PowerState has unknown enum type or enum member BSH.Common.EnumType.PowerState.Off.', 'key': 'SDK.Error.InvalidSettingValue'}

Once I switch of the machine via physical controls, interestingly the log indicates the real state while the button still shows that it is turned on

Bildschirm­foto 2023-05-01 um 14 01 51

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented May 2, 2023

Hi @MoeweX,

It seems like you disabled a Remote control. At least this is what Log is reporting on your screenshot. In this case, your actual appliance status will not be reflected in Home Assistant. As well as you wouldn't be able to control your appliance remotely.

Try to re-enable the Remote control on the appliance again and after that try to turn on/off your appliance, the actual status should be reflected in the Home Assistant as well.

P.S. Just out of my curiosity, can you please post the full Programs list screenshot?

Thanks a lot! :)

@DennisGaida
Copy link
Copy Markdown

DennisGaida commented May 2, 2023

I promised I would test, only now got the time for it. Works for me - Duration also seems empty, though remaining program time is filled.

A full screenshot here:
image

Checking the API response, I also don't see any duration, the relevant API response is:

      {
        "key": "BSH.Common.Option.ProgramProgress",
        "value": 94,
        "unit": "%",
        "name": "Current program progress"
      },
      {
        "key": "BSH.Common.Option.RemainingProgramTime",
        "value": 801,
        "unit": "seconds",
        "name": "Remaining program running time"
      },
      {
        "key": "BSH.Common.Option.RemainingProgramTimeIsEstimated",
        "value": true,
        "name": "Estimated remaining program time"
      },

As far as I can tell duration is not used with the WasherDryer device class, but would be used with an oven. Example reponse for an oven:

{
  "data": {
    "key": "Cooking.Oven.Program.HeatingMode.HotAir",
    "options": [
      {
        "key": "Cooking.Oven.Option.SetpointTemperature",
        "value": 230,
        "unit": "°C"
      },
      {
        "key": "BSH.Common.Option.Duration",
        "value": 1200,
        "unit": "seconds"
      }
    ]
  }
}

so maybe some checking logic might be nice, i.e. "is duration available? then create sensor, otherwise don't"

@stickpin
Copy link
Copy Markdown
Contributor Author

stickpin commented May 2, 2023

Thanks for reporting back @DennisGaida!
Strangely it's not showing a proper naming in your case... hmmm... did you rename it manually?

@DennisGaida
Copy link
Copy Markdown

Could very well be - I previously implemented this myself: #89113. Didn't care about device creation now anyways, just wanted to see if it works (which it does since you can see the live updates of the times / current program etc).

@github-actions github-actions Bot locked and limited conversation to collaborators May 3, 2023
@frenck frenck added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed integration: home_connect new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) Quality Scale: No score small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants