Feature request: Newly available Oven Control functions
Closed this issue · 27 comments
Now that Home Connect have made the Oven control scope available to all devs and users, are their any plans to expand the functionality of this integration to include oven controls. I ask as an eager beta tester
The email announcing this make it seem like this would be enabled automatically, although if I try to turn my oven on I get the same error as before about oven control being out of scope
From the built in home assistant - home connect integration I can turn my oven on (although I am not 100% if this was possible previously). I would assume switching a device on would be part of the -control scope.
I believe in order to set the oven to heat it requires a number of parameters such as time, temperature and mode.
Interesting!
From the built in home assistant - home connect integration I can turn my oven on (although I am not 100% if this was possible previously). I would assume switching a device on would be part of the -control scope.
No, switching on has always been possible, but not starting programs. I also get Error while trying to start program: {'key': 'insufficient_scope', 'description': 'Insufficient scope for this resource'}
when I try.
What I suspect is that one has to re-trigger the authentication, because this is where the scope of the authentication token is defined. Can you try that? In principle, there should be nothing in the integration that has to be changed.
I just removed and re-added the integration (so that I had to go through the config flow again), and I can now control my ovens. The pre-set programmes (and all the switches for them) are of limited use, I'd imagine that the service calls would be far more flexible, but this is progress
Awesome, thanks!
I'd imagine that the service calls would be far more flexible, but this is progress
Why "would be", don't they work for you?
@DavidMStraub I am not sure where you are getting those logs from are they in the Home Assistant logs, I am not seeing them? They look more like the logs you get when using postman and the home connect dev tools. I think @anthonyangel might be correct I think when you first auth you define the scope so if your token is from prior to this permissions change you might need to generate a new token with extended scope. Also as far as performing calls from Home Assistant I think the Home connect API requires time, temperature and mode in a single call so flicking the different mode probably wont work as you would be sending a call without the temperature and time. I don't have experience of any of the other home connect products to know if they work in a similar way. I am sure I can build and test some example API calls outside of Home Assistant to do some tests like turning the oven on at 200C for 20 minutes if that helps? But I am still learning when it comes to Home Assistant
Awesome, thanks!
I'd imagine that the service calls would be far more flexible, but this is progress
Why "would be", don't they work for you?
I'm using the version in HA core at the moment, not the beta from this repo
Oh god I had forgotten I never made a pull request for this 🤦
I don't know if this helps but I am trying to assist with my limited HA knowledge. So I have just been able to turn my oven on for 20 minutes at 200C with the below call, I have removed my HAID and TOKEN for security but this was all generated via https://apiclient.home-connect.com/ although I ran the call from the machine my HA is installed. Let me know if it helps if I uninstall the built in integration and install this Beta?
curl -X PUT "https://api.home-connect.com/api/homeappliances/MYHAID/programs/active" -H "accept: application/vnd.bsh.sdk.v1+json" -H "authorization: Bearer BLABLABLA" -H "Content-Type: application/vnd.bsh.sdk.v1+json" -d "{ "data": { "key": "Cooking.Oven.Program.HeatingMode.HotAir", "options": [ { "key": "Cooking.Oven.Option.SetpointTemperature", "value": 200, "unit": "°C" }, { "key": "BSH.Common.Option.Duration", "value": 1200, "unit": "seconds" } ] }}"
Hi,
yes, with the beta integration you should be able to do this as a service call.
I just update the repo to include all the changes from upstream. It would be great if somebody could test it, then I could prepare a PR with the service call feature.
Hi @DavidMStraub,
I have successfully installed the beta integration and can see the exposed services in developer tools. If I try and add the below data to the "Home Connect: set_option_active"
{ "key": "Cooking.Oven.Program.HeatingMode.HotAir", "options": [ { "key": "Cooking.Oven.Option.SetpointTemperature", "value": 200, "unit": "°C" }, { "key": "BSH.Common.Option.Duration", "value": 1200, "unit": "seconds" } ] }
The YAML looks like the below
service: home_connect_beta.set_option_active
data:
key: Cooking.Oven.Program.HeatingMode.HotAir
options:
- key: Cooking.Oven.Option.SetpointTemperature
value: 200
unit: °C
- key: BSH.Common.Option.Duration
value: 1200
unit: seconds
With the above I get the error below
I get the error [140480689137648] Error handling message: extra keys not allowed @ data['options']. Got None required key not provided @ data['entity_id']. Got None required key not provided @ data['value']. Got None
I will continue to see if I can find some simpler calls and let you know the results
Hi, can you please format your YAML with ```yaml so the spaces are preserved?
If I understood you correctly I have now entered the below but get the same error, in my previous post the github chat stripped the spaces but I believe the spacing was correct in the service call. Are you able to get this call to work? It is the same call I made through curl in a previous post. I am guessing it is failover building the call rather than failing after it is sent. Its it possible to debug the call that is being made as a result of this call to see how it matches up with the Curl call.
key: Cooking.Oven.Program.HeatingMode.HotAir
options:
``-`key: Cooking.Oven.Option.SetpointTemperature````unit: °C ``-`key: BSH.Common.Option.Duration ````value: 1200 ````unit: seconds
You are not using the right schema for the call. And the error message is telling you so.
set_option_active:
description: Sets an option for the active program.
fields:
entity_id:
description: Name of an entity associated with the home appliance.
example: "switch.dryer_power"
key:
description: Option key.
example: "LaundryCare.Dryer.Program.Cotton"
value:
description: Value of the option.
example: "LaundryCare.Dryer.Program.Cotton"
OK I will have to play around with it, I have a dryer so have tried the example yaml but still not working, although it might be a different error. I did play around with it and got the error below
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'Oven' object has no attribute 'entities'
I suspect this is because the set_option_active is only valid for ovens which is odd that the example is for a dryer. It did make me think however I am missing the entity_id in my previous tests, I assume your script uses this to identify the HAID of the device that is a required part of the API call. I will keep playing around and see if I can get anything to work.
Oh, this might actually a bug of the new version, I will look into it.
Can you please try again using the latest commit?
Had a little more success this time. I get a different error with the dryer now so that might be fixed, need to do more testing there. Back to the oven however I think I have made a bit of a breakthrough in understanding. I think maybe the service calls and structure dont relate directly to the API. For example I have used Start Program to get the oven to switch on a specific program for 1 minute but the "start program" call doesn't seem to exist in https://apiclient.home-connect.com/
So the service data I used for this was
entity_id: switch.oven_power
program: Cooking.Oven.Program.HeatingMode.HotAir
option_key: Cooking.Oven.Option.SetpointTemperature
option_value: 200
option_unit: °C
However, how do a specify two options so I can specify time and temperature? I tried the below but got an error. Does the service support two options as stated previously I feel this is some what critical to the oven and maybe not relevant to the likes of a washer or dryer?
entity_id: switch.oven_power
program: Cooking.Oven.Program.HeatingMode.HotAir
option_key: Cooking.Oven.Option.SetpointTemperature
option_value: 200
option_unit: °C
option_key: BSH.Common.Option.Duration
option_value: 1200
option_unit: seconds
You are right. Options support was added in #122 that was merged recently, but this implementation doesn't make sense as we need to allow multiple options. I hadn't noticed this before merging.
@DavidMStraub any idea when you might be able to add support for multiple options? From what I can tell from the documentation for the oven at least, there would be no more than 4 options in a single call. These would be temp, duration, start time and fast preheat.
No, I don't want to make any promises. Very little time these days, unfortunately. Although this is a feature I would be using myself...
I just managed to start a program on my oven with 2 options:
entity_id: switch.backofen_power
program: Cooking.Oven.Program.HeatingMode.BottomHeating
options:
- key: Cooking.Oven.Option.SetpointTemperature
value: 250
unit: °C
- key: BSH.Common.Option.Duration
value: 30
unit: seconds
So I think this issue can be closed 🚀 But please do tell me whether it worked for you as well!
Did you test that using the home_connect_beta.set_option_active
service?
No, home_connect_beta.start_program
Thanks David, works perfect for me, I was even able to test with 3 options which also worked fine. Thanks for your efforts.
Is there any sort of schedule on when the beta features find there way into the main hassio integration? Not really a big deal, just curious.
Is there any sort of schedule on when the beta features find there way into the main hassio integration? Not really a big deal, just curious.
No, no schedule; I've neglected it in the last year or so but now there are enough (tested) improvements that I should do another PR, hopefully very soon. It might be a bit complicated by the fact that there is another, unrelated PR open for Home Connect in core at the moment.