ekutner / home-connect-hass

Alternative (and improved) Home Connect integration for Home Assistant
MIT License
511 stars 53 forks source link

Request to add switch/translations for missing Bosch Dishwasher Option - "Zeolite Dry" #257

Closed kwbeck closed 10 months ago

kwbeck commented 10 months ago

Describe the bug

The "Zeolite Dry" option/switch for my Dishwasher is not available in the integration, although for some reason, the binary sensor does appear.

(Screenshot attached. FYI, friendly name changed to "Crystal Dry" since that it what that option is actually called on my Dishwasher.)

Screenshot 2023-09-18 201925

Version of the custom_component

0.6.5

Configuration

home_connect_alt:
  client_id: !secret home_connect_alt_client_id
  client_secret: !secret home_connect_alt_client_secret
  name_template: $appliance $name

Debug log

"appliances": {
"013050536224082720": {
"name": "Dishwasher",
"brand": "Bosch",
"vib": "SHX78B75UC",
"connected": true,
"type": "Dishwasher",
"enumber": "SHX78B75UC/38",
"haId": "xxxxxxxxxxxxxxxxxxxxx",
"uri": "/api/homeappliances/xxxxxxxxxxxxxxxxx",
"available_programs": {
"Dishcare.Dishwasher.Program.Intensiv70": {
"key": "Dishcare.Dishwasher.Program.Intensiv70",
"name": null,
"options": {},
"execution": "selectandstart",
"active": false
}
},
"active_program": {
"key": "Dishcare.Dishwasher.Program.Intensiv70",
"name": null,
"options": {
"BSH.Common.Option.StartInRelative": {
"key": "BSH.Common.Option.StartInRelative",
"value": 0,
"type": null,
"name": null,
"unit": "seconds",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.HygienePlus": {
"key": "Dishcare.Dishwasher.Option.HygienePlus",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.HalfLoad": {
"key": "Dishcare.Dishwasher.Option.HalfLoad",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.IntensivZone": {
"key": "Dishcare.Dishwasher.Option.IntensivZone",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.ZeoliteDry": {
"key": "Dishcare.Dishwasher.Option.ZeoliteDry",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"BSH.Common.Option.ProgramProgress": {
"key": "BSH.Common.Option.ProgramProgress",
"value": 84,
"type": null,
"name": null,
"unit": "%",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"BSH.Common.Option.RemainingProgramTime": {
"key": "BSH.Common.Option.RemainingProgramTime",
"value": 1260,
"type": null,
"name": null,
"unit": "seconds",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"BSH.Common.Option.RemainingProgramTimeIsEstimated": {
"key": "BSH.Common.Option.RemainingProgramTimeIsEstimated",
"value": true,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"BSH.Common.Option.EnergyForecast": {
"key": "BSH.Common.Option.EnergyForecast",
"value": 80,
"type": null,
"name": null,
"unit": "%",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"BSH.Common.Option.WaterForecast": {
"key": "BSH.Common.Option.WaterForecast",
"value": 93,
"type": null,
"name": null,
"unit": "%",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
}
},
"execution": null,
"active": false
},
"selected_program": {
"key": "Dishcare.Dishwasher.Program.Intensiv70",
"name": null,
"options": {
"BSH.Common.Option.StartInRelative": {
"key": "BSH.Common.Option.StartInRelative",
"value": 0,
"type": null,
"name": null,
"unit": "seconds",
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.HygienePlus": {
"key": "Dishcare.Dishwasher.Option.HygienePlus",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.HalfLoad": {
"key": "Dishcare.Dishwasher.Option.HalfLoad",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.IntensivZone": {
"key": "Dishcare.Dishwasher.Option.IntensivZone",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
"Dishcare.Dishwasher.Option.ZeoliteDry": {
"key": "Dishcare.Dishwasher.Option.ZeoliteDry",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
}
},
"execution": null,
"active": false
},
"status": {
"BSH.Common.Status.RemoteControlStartAllowed": {
"key": "BSH.Common.Status.RemoteControlStartAllowed",
"value": true,
"name": null,
"displayvalue": null,
"unit": null
},
"BSH.Common.Status.RemoteControlActive": {
"key": "BSH.Common.Status.RemoteControlActive",
"value": true,
"name": null,
"displayvalue": null,
"unit": null
},
"BSH.Common.Status.DoorState": {
"key": "BSH.Common.Status.DoorState",
"value": "BSH.Common.EnumType.DoorState.Closed",
"name": null,
"displayvalue": null,
"unit": null
},
"BSH.Common.Status.OperationState": {
"key": "BSH.Common.Status.OperationState",
"value": "BSH.Common.EnumType.OperationState.Run",
"name": null,
"displayvalue": null,
"unit": null
}
},
"settings": {
"BSH.Common.Setting.PowerState": {
"key": "BSH.Common.Setting.PowerState",
"value": "BSH.Common.EnumType.PowerState.On",
"type": "BSH.Common.EnumType.PowerState",
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": [
"BSH.Common.EnumType.PowerState.Off",
"BSH.Common.EnumType.PowerState.On"
],
"execution": null,
"liveupdate": null,
"access": "readWrite"
}
},
"commands": {
"BSH.Common.Command.AcknowledgeEvent": {
"key": "BSH.Common.Command.AcknowledgeEvent",
"name": null
}
},
"startonly_options": null,
"startonly_program": null,
"_active_program_fail_count": 0
}
}
}
ekutner commented 10 months ago

If it was available in the API a switch would have been automatically created for it.;

kwbeck commented 10 months ago

@ekutner Understood, and that's definitely been the case for every other program and option, so I was very confused that this option was not being created as a switch, but WAS being created as a binary sensor.

Since I could see it in the debug file (included at the end) I thought perhaps it was because this option was not in the translation files. So I added the option to my local en.json file, but of course, that didn't fix it.

Then, having no experience with APIs, but as a sanity check for myself, I looked at the output of the API for my dishwasher, and saw that all of the available programs and options, including Dishcare.Dishwasher.Option.ZeoliteDry were listed, but ONLY under api/homeappliances/{haId}/programs/selected, NOT api/homeappliances/{haId}/programs/available/{programkey}. (screenshots of "Auto2" program below)

I confirmed that this is the case for all 3 of the programs supported by my dishwasher which also support the "Zeolite Dry" option. (Intensiv70, Auto2, and Eco50, aka, Heavy, Auto, and Normal on my machine)

Therefore, I'm concluding the problem is in the API.

This also fits with my (very) limited understanding of how the integration handles switch and binary sensor creation, i.e. it looks like the integration checks selected_program and selected_program.options (as well as the active_ equivalents) for binary sensors, but available.programs for switches. Which, given the API behavior, means it would create the ZeoliteDry binary sensor, but not the switch. Am I correct in this understanding?

Long winded way of saying that you're correct. :) i.e. If it were supported (properly) in the API, the switch would have been automatically created. Unfortunately, it's only half/inconsistently implemented in the API....

Thoughts? I assume this means the API needs to be fixed?

If you agree with my findings, I'll be glad to submit feedback through the Home Connect Developer site.

( I don't know if "Zeolite Dry" is a relatively new option, since I just got the dishwasher, but FYI, it's not listed in the documentation either - https://api-docs.home-connect.com/programs-and-options/#dishwasher)

In any case, thank you for the fabulous work on the integration. Much appreciated.

Screenshot 2023-09-19 121633

Screenshot 2023-09-19 121817

Debug log entry for Zeolite Dry

},
"Dishcare.Dishwasher.Option.ZeoliteDry": {
"key": "Dishcare.Dishwasher.Option.ZeoliteDry",
"value": false,
"type": null,
"name": null,
"unit": null,
"displayvalue": null,
"min": null,
"max": null,
"stepsize": null,
"allowedvalues": null,
"execution": null,
"liveupdate": null,
"access": null
},
ekutner commented 10 months ago

For someone who has no experience with APIs you have a pretty good understanding of how it works. The thing is that options under the "selected" or "active" programs are not settable in the API. As far as I can tell they are there only for informational purposes but trying to change their value always fails. That's the reason that only "available" options are creating settable entities in HA. Bottom line is that it is indeed a limitation of the API.

kwbeck commented 10 months ago

Much appreciated. I'm was a motivated learner in this case, but it did take me a while to figure all of that out. Good experience, though.

I completely understand what you are saying. If it's not in "available", it's not settable, and hence a limitation. Well and succinctly put....

But my next (rhetorical) questions, which didn't occur to me until I read your reply are:

Is it a limitation because the designers meant it to be (for some reason)?
Or, is it a limitation because it is broken and they forgot to put that option in the "available" section?

I suspect you (or anyone not working for Home Connect) can't answer that, so I'll submit it to them as feedback/a bug report and see if I get an answer. Will report back in this thread if I do.

Thank you again.

ekutner commented 10 months ago

I really don't know but there are many cases of options that are only available for reading under the selected/active programs and not under the available programs. My assumption has always been that it is by design but I never asked them and will be happy to find out it was just a bug. Good luck.

kwbeck commented 10 months ago

Good to know. Thank you again. I've submitted the question through the Home Connect developer's site, and will let you know if I hear back from them.

kwbeck commented 10 months ago

I got a reply. They said:

"Dishcare.Dishwasher.Option.ZeoliteDry option is not supported currently, but we’re going to add it in the upcoming 1-1.5 months. If you’d like to see something else supported feel free to let me know and we’ll review if it’s possible (not everything is)."

Good news indeed. Thanks again for the help.

kwbeck commented 8 months ago

FYI, looks like they have finally added this to the API, and the switch is showing up (and working).