Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambient Light not detected if hood switched off (Bosch DWF97RW65) #24

Closed
josiasmontag opened this issue May 1, 2020 · 18 comments
Closed
Labels
bug Something isn't working

Comments

@josiasmontag
Copy link

josiasmontag commented May 1, 2020

Description of Issue

If the hood and the ambient light is switched off and I start Homebridge, the plugin does not detect the ambient light. The settings for color and brightness are missing. Only the on/off switch for the ambient light is available.

It seems the BSH.Common.Setting.AmbientLightBrightness and BSH.Common.Setting.AmbientLightCustomColor settings are only available via the API, if the ambient light is currently switched on.

Workaround:

  • Delete homebridge-homeconnect cache
  • Switch on ambient light on hood and set custom color
  • Restart homebridge

Plugin Version

0.17.2

Home Connect Appliance(s)

BOSCH-DWF97RW65

HomeKit App(s)

/

Log File

/

@josiasmontag josiasmontag added the bug Something isn't working label May 1, 2020
@thoukydides
Copy link
Owner

Thank you @josiasmontag for reporting this problem and diagnosing the cause.

You are probably the first person to try this feature. I do not have access to a Home Connect equipped Hood, the simulator does not include a Hood appliance, and the other users who tested the Hood support do not have ambient lights in their appliances.

Does the ambient light support otherwise work as expected? Having checked the API documentation again I spot a note that "the brightness can't be set if the ambient light color is set to CustomColor" so I suspect that there might be other issues.

The Home Connect API is very frustrating. There is no suggestion in the documentation that these settings can only be queried when the ambient light is switched on... although it is consistent with the way that the settings for programs behave. There are also significant differences between appliances in how they implement the API. The API is clearly designed for use by a phone app or website, where the UI can be dynamically modified. Some other projects require the user to manually configure the capabilities of each appliance for this reason...

I am thinking that probably the best way to handle this issue is to temporarily switch the ambient light on when the plugin is first used. This is similar to the way that program settings are now handled. Unfortunately, this is going to add complexity to a section of the code that I am unable to test myself... and based on previous experience of implementing Hood support it will probably take a few attempts to get right...

@josiasmontag
Copy link
Author

Hi @thoukydides, thanks for these insights.

Yes, other than that, the ambient light is working fine via HomeKit. I just wanted to note this down for others facing the same issue wondering why their color settings are missing. I don't see any easy way to fix this either.

Thanks a lot for your work on this plugin!

@thoukydides
Copy link
Owner

@josiasmontag, is there any chance that you could provide a debug log (with homebridge -D) for starting with the cache deleted and the ambient light switched off? Alternatively, a copy of the cache file for the Hood appliance would be almost as useful. You can email them to me if you are not comfortable posting them here.

Do NOT share the 94a08da1fecbb6e8b46990538c7b50b2 cache file since that holds your OAuth tokens.

I would like to see whether these settings are missing from the GET /homeappliances/{haid}/settings response, or whether they are present but return an error (and what that error is) when queried using /homeappliances/{haid}/settings/{settingkey}.

Hopefully it is the latter because that almost provides sufficient information for the plugin to create the appropriate HomeKit services and characteristics. The only thing that would be missing is the brightness range, and if necessary that can be updated later when the setting is available.

@josiasmontag
Copy link
Author

josiasmontag commented May 6, 2020

@thoukydides You have mail.

Not really related to this issue: If the ambient light is detected correctly, I see the following error in the log:

[5/6/2020, 6:03:10 PM] [HomeConnect] [Dunstabzugshaube] rgb is not defined
[5/6/2020, 6:03:10 PM] [HomeConnect] [Dunstabzugshaube] Update emit BSH.Common.Setting.AmbientLightCustomColor=#00d5ff

It works fine though.

@JerGitHub
Copy link

Good news is....there seems to be major updates to the API coming soon. Bad news is....it may break things for us and @thoukydides will have to fix it! : P

https://developer.home-connect.com/changelog

Home Connect Developer Portal Newsletter 12020.pdf

@thoukydides
Copy link
Owner

@thoukydides You have mail.

Thank you. Unfortunately the provided files confirm that the BSH.Common.Setting.AmbientLightBrightness and BSH.Common.Setting.AmbientLightCustomColor settings are completely missing from the GET /homeappliances/{haid}/settings response. Those settings can only be discovered when the light is switched on.

Not really related to this issue: If the ambient light is detected correctly, I see the following error in the log:

[5/6/2020, 6:03:10 PM] [HomeConnect] [Dunstabzugshaube] rgb is not defined
[5/6/2020, 6:03:10 PM] [HomeConnect] [Dunstabzugshaube] Update emit BSH.Common.Setting.AmbientLightCustomColor=#00d5ff

It works fine though.

I suspect that you will find that changes to the colour of the light made outside of HomeKit will not be shown in HomeKit. That error occurs due to use of an incorrect variable in the log statement just before the Hue and Saturation characteristics are updated. At least that's an easy fix - should be sorted in v0.17.3.

Still need to do something about discovering the ambient light capabilities if it is switched off when the plugin is first started...

@thoukydides
Copy link
Owner

Good news is....there seems to be major updates to the API coming soon.

Actually, the "Major Updates" they are pre-announcing are for the Developer Portal (developer tools and documentation). They have not actually announced any major updates to the API.

Bad news is....it may break things for us and @thoukydides will have to fix it! : P
https://developer.home-connect.com/changelog

Possible, but I suspect that they will be quite conservative with changes to the API. It is more likely to be a case of new capabilities that I will have to decide whether to support.

The newsletter does not actually promise any new API features though. It only highlights that they have "been adding new programs and options for our appliances". So, let's take a quick look at the change log to see the API changes they have released so far this year...

February 7, 2020

Simulator

  • Fix authorization issue if one of the following scope is used
  • CookProcessor-Control
  • FridgeFreezer-Control
  • Change structure of OAuth errors to be more consistent to real appliance API

These changes only affect the simulated appliances that I use for developing the plugin. They have no affect on real physical appliances. All of these changes are actually to fix issues that I reported.

April 6, 2020

Simulator

  • Support new endpoint to monitor all appliances which are paired to an account (in dependence of the used scope)
  • Update style of OAuth flow
  • Change handling of open door event to be more consistent to real appliances
  • Send value update events if fridge freezer settings have been changed
  • Use refresh token handling of real appliance API

Again, these changes only affect the simulated appliances, and are mostly to fix issues that I reported.

April 21, 2020

API

  • Support new features to get or change unit settings
    • Liquid Volume Unit
    • Temperature Unit

These just allow selection of the units used by the API to measure liquid volumes (coffee fill levels) and temperatures. They are not relevant to HomeKit since Apple has not defined any characteristics for oven temperatures or coffee sizes. The only impact on the plugin is for the configuration schema to allow customisation of programs, and I am not going to bother supporting different units for that.

Not exactly major updates to the API during the first third of 2020.

@JerGitHub
Copy link

All good points @thoukydides . I was hoping the changes would make things easier and better for you and bring some more reliability to their API and services. They made it sound more impressive than it really is.

@thoukydides
Copy link
Owner

@josiasmontag version 0.18.0 now attempts to switch Hood/Dishwasher functional and ambient lights on before reading the settings that they support.

This has only had rudimentary testing because, as mentioned previously, I do not have access to an appliance with either of these features...

@thoukydides thoukydides added the waiting for feedback Further information is requested label May 9, 2020
@josiasmontag
Copy link
Author

Thanks for working on that.
Unfortunately, it does not seem to work. Log file:

[5/12/2020, 9:52:42 AM] [HomeConnect] Home Connect request #2: OK +3103ms 
[5/12/2020, 9:52:42 AM] [HomeConnect] Found 3 appliances
[5/12/2020, 9:52:42 AM] [HomeConnect] Scheduling configuration schema write
[5/12/2020, 9:52:42 AM] [HomeConnect] Connecting accessory 'Kochfeld'
[5/12/2020, 9:52:42 AM] [HomeConnect] [Kochfeld] Bosch Hob (E-Nr: PXY875KW1E/14)
[5/12/2020, 9:52:42 AM] [HomeConnect] Connecting accessory 'Backofen'
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Bosch Oven (E-Nr: HBG856XC6/63)
[5/12/2020, 9:52:42 AM] [HomeConnect] Connecting accessory 'Dunstabzugshaube'
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] Bosch Hood (E-Nr: DWF97RW65/01)
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Connected, so reading appliance state...
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] Connected, so reading appliance state...
[5/12/2020, 9:52:42 AM] [HomeConnect] Home Connect request #3: GET https://api.home-connect.com/api/homeappliances/BOSCH-HBG856XC6-68A40E337274
[5/12/2020, 9:52:42 AM] [HomeConnect] Home Connect request #4: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] No cache found
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance power' does not exist in cache
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance fan' does not exist in cache
[5/12/2020, 9:52:42 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance settings' does not exist in cache
[5/12/2020, 9:52:42 AM] [HomeConnect] [Kochfeld] Cache loaded (1 entries)
[5/12/2020, 9:52:42 AM] [HomeConnect] [Kochfeld] Cache 'Appliance power' [de-DE, updated 402834 seconds ago] is too old
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Cache loaded (15 entries)
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Cache 'Appliance power' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Restored details of 11 programs
[5/12/2020, 9:52:42 AM] [HomeConnect] [Backofen] Can be switched off
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #4: OK +125ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #5: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/status
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #3: OK +132ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #6: GET https://api.home-connect.com/api/homeappliances/BOSCH-HBG856XC6-68A40E337274/status
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #5: OK +107ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Status.LocalControlActive=false (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Status.OperationState=BSH.Common.EnumType.OperationState.Inactive (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Status.RemoteControlActive=true (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Status.RemoteControlStartAllowed=true (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #7: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Remote operation enabled (remote control activated, remote start allowed)
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #6: OK +110ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Status.DoorState=BSH.Common.EnumType.DoorState.Closed (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Door closed
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Status.LocalControlActive=false (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Status.RemoteControlStartAllowed=false (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Status.RemoteControlActive=true (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Status.OperationState=BSH.Common.EnumType.OperationState.Inactive (2 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Inactive (Inactive)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cooking.Oven.Status.CurrentCavityTemperature=60 °C (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #8: GET https://api.home-connect.com/api/homeappliances/BOSCH-HBG856XC6-68A40E337274/settings
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Remote operation NOT enabled (remote control activated, remote start disallowed)
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #7: OK +115ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.PowerState=BSH.Common.EnumType.PowerState.Off (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Off
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=false (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=10 % (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=false (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #9: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/programs/selected
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #8: OK +112ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] BSH.Common.Setting.PowerState=BSH.Common.EnumType.PowerState.Standby (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Off
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #10: GET https://api.home-connect.com/api/homeappliances/BOSCH-HBG856XC6-68A40E337274/programs/selected
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #9: There is no program selected [SDK.Error.NoProgramSelected] +110ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Ignoring GET active program in BSH.Common.EnumType.OperationState.Inactive
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Successfully read all appliance state
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] connected=true (5 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Connected
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #11: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/BSH.Common.Setting.PowerState
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #12: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/programs/available
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #13: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #10: There is no program selected [SDK.Error.NoProgramSelected] +124ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Ignoring GET active program in BSH.Common.EnumType.OperationState.Inactive
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Successfully read all appliance state
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] connected=true (4 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Connected
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance programs' [de-DE, updated 1288 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #14: GET https://api.home-connect.com/api/homeappliances/BOSCH-HBG856XC6-68A40E337274/programs/available
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #14: OK +114ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Passively reading options for 10 programs
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.TopBottomHeating' [de-DE, updated 1288 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.HotAirEco' [de-DE, updated 1288 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.TopBottomHeatingEco' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.HotAirGrilling' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.PizzaSetting' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.SlowCook' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.BottomHeating' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.Defrost' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.KeepWarm' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache 'Appliance program Cooking.Oven.Program.HeatingMode.PreheatOvenware' [de-DE, updated 1287 seconds ago]
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] 'Program details' written to cache
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #12: OK +140ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance fan' written to cache
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #11: OK +144ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.PowerState=BSH.Common.EnumType.PowerState.Off (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Off
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance power' written to cache
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #13: OK +143ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.PowerState=BSH.Common.EnumType.PowerState.Off (1 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Off
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=false (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=10 % (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=false (0 listeners)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance settings' written to cache
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cache saved (3 entries)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Can be switched off
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance fan manual program' does not exist in cache
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Switching Functional Light on to read settings
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #15: PUT https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/Cooking.Common.Setting.Lighting
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #16: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/programs/available/Cooking.Common.Program.Hood.Venting
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Cache saved (15 entries)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Finished reading available program options
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Adding services for 0 programs
[5/12/2020, 9:52:43 AM] [HomeConnect] [Backofen] Removing services for 11 programs
[5/12/2020, 9:52:43 AM] [HomeConnect] Home Connect request #16: OK +210ms 
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance fan manual program' written to cache
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Cache saved (4 entries)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube] Fan suppports 3 venting levels + 2 intensive levels + auto mode
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube]     20% (Cooking.Hood.EnumType.Stage.FanStage01)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube]     25% (Cooking.Hood.EnumType.Stage.FanStage02) = Siri 'low'
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube]     50% (Cooking.Hood.EnumType.Stage.FanStage03) = Siri 'medium'
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube]     80% (Cooking.Hood.EnumType.IntensiveStage.IntensiveStage1)
[5/12/2020, 9:52:43 AM] [HomeConnect] [Dunstabzugshaube]     100% (Cooking.Hood.EnumType.IntensiveStage.IntensiveStage2) = Siri 'high'
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #15: OK +958ms 
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=true (0 listeners)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance Functional Light on' does not exist in cache
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #17: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/Cooking.Common.Setting.Lighting
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (2 items)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=true (0 listeners)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=50 % (0 listeners)
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #17: OK +107ms 
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=true (0 listeners)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance Functional Light on' written to cache
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cache saved (5 entries)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance Functional Light brightness' does not exist in cache
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #18: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/Cooking.Common.Setting.LightingBrightness
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #18: OK +104ms 
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=50 % (0 listeners)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance Functional Light brightness' written to cache
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cache saved (6 entries)
[5/12/2020, 9:52:44 AM] [HomeConnect] Home Connect request #19: PUT https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/Cooking.Common.Setting.Lighting
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (1 item)
[5/12/2020, 9:52:44 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=78 % (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (2 items)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=false (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=58 % (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #19: OK +802ms 
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.Lighting=false (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance settings' [de-DE, updated 1 seconds ago]
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Switching Ambient Light on to read settings
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #20: PUT https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/BSH.Common.Setting.AmbientLightEnabled
[5/12/2020, 9:52:45 AM] [HomeConnect] Scheduled configuration schema write complete
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (3 items)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=true (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightColor=BSH.Common.EnumType.AmbientLightColor.CustomColor (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightCustomColor=#00d1ff (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #20: OK +276ms 
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=true (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cache 'Appliance Ambient Light on' does not exist in cache
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #21: GET https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/BSH.Common.Setting.AmbientLightEnabled
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #21: OK +108ms 
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=true (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] 'Appliance Ambient Light on' written to cache
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Cache saved (7 entries)
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #22: PUT https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/BSH.Common.Setting.AmbientLightEnabled
[5/12/2020, 9:52:46 AM] [HomeConnect] Home Connect request #22: OK +255ms 
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=false (0 listeners)
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (1 item)
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=false (1 listeners)
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] Light Ambient Light off
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (1 item)
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=26 % (1 listeners)
[5/12/2020, 9:52:46 AM] [HomeConnect] [Dunstabzugshaube] Light Functional Light 26% brightness
[5/12/2020, 9:52:47 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (1 item)
[5/12/2020, 9:52:47 AM] [HomeConnect] [Dunstabzugshaube] Cooking.Common.Setting.LightingBrightness=10 % (1 listeners)
[5/12/2020, 9:52:47 AM] [HomeConnect] [Dunstabzugshaube] Light Functional Light 10% brightness

@thoukydides
Copy link
Owner

Thank you for trying that @josiasmontag. I have spotted the stupid mistake - even though the plugin is now switching the light on, it is still only attempting to read the details of settings that existed previously. Oops.

I have also just realised that it will repeat switching the light on every time that the plugin is started, even if the settings have been previously read and cached. I need to do something about that too...

When I have a bit more time I will check the log that you provided for any other issues that I need to address at the same time...

@thoukydides
Copy link
Owner

Looking at the provided log more carefully, it looks like there is a further complication:

[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Switching Ambient Light on to read settings
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #20: PUT https://api.home-connect.com/api/homeappliances/BOSCH-DWF97RW65-68A40E37AB6A/settings/BSH.Common.Setting.AmbientLightEnabled
[5/12/2020, 9:52:45 AM] [HomeConnect] Scheduled configuration schema write complete
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] Event NOTIFY (3 items)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightEnabled=true (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightColor=BSH.Common.EnumType.AmbientLightColor.CustomColor (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] [Dunstabzugshaube] BSH.Common.Setting.AmbientLightCustomColor=#00d1ff (0 listeners)
[5/12/2020, 9:52:45 AM] [HomeConnect] Home Connect request #20: OK +276ms 

When the plugin switched the ambient light on the events stream did not provide a value for BSH.Common.Setting.AmbientLightBrightness. This is presumably because a CustomColor is selected, and confirms what I suspected (and that the API documentation suggests). The ambient light basically supports two control modes:

  • BSH.Common.Setting.AmbientLightColor = BSH.Common.EnumType.AmbientLightColor.CustomColor:

    • BSH.Common.Setting.AmbientLightBrightness not supported.
    • BSH.Common.Setting.AmbientLightCustomColor sets brightness, not just colour.
  • BSH.Common.Setting.AmbientLightColor = BSH.Common.EnumType.AmbientLightColor.Color[1 .. 99]:

    • BSH.Common.Setting.AmbientLightBrightness sets brightness.
    • BSH.Common.Setting.AmbientLightCustomColor not supported. (The API documentation only says that it cannot be set, but presumably it is not readable either.)

Currently the plugin attempts to use BSH.Common.Setting.AmbientLightCustomColor for just the Hue and Saturation, and always uses BSH.Common.Setting.AmbientLightBrightness for Brightness. Clearly that is wrong.

To actually determine all of the ambient light's supported settings it looks like the following will be required:

  • If the ambient light is off, then switch it on.
  • Read the supported values for BSH.Common.Setting.AmbientLightColor .
  • If BSH.Common.EnumType.AmbientLightColor.CustomColor is supported then assume that BSH.Common.Setting.AmbientLightCustomColor is supported.
  • If any other colours are supported then:
    • If BSH.Common.EnumType.AmbientLightColor.CustomColor is currently selected then set any of the supported non-custom colours.
    • Read the BSH.Common.Setting.AmbientLightBrightness setting to determine the supported brightness range.
  • Restore BSH.Common.EnumType.AmbientLightColor.CustomColor, if changed.
  • Restore BSH.Common.Setting.AmbientLightEnabled, if changed.

(Additional special cases are required to keep the code common between the functional and ambient lights...)

Given that the non-custom colours cannot be properly supported, I then propose to:

  • Home Connect API events:

    • BSH.Common.Setting.AmbientLightBrightness changed: Set Brightness characteristic, as currently.
    • BSH.Common.Setting.AmbientLightCustomColor changed: Set the Hue and Saturation characteristics as currently. Also use its value to set the Brightness characteristic.
    • Ignore the value of BSH.Common.Setting.AmbientLightColor, and rely on the API only reporting one of the above settings as appropriate. The Hue and Saturation will be left unchanged, which will be incorrect for non-custom colours... but there doesn't appear to be any way to handle that correctly.
  • HomeKit characteristics written:

    • If Brightness written while BSH.Common.Setting.AmbientLightColor = BSH.Common.EnumType.AmbientLightColor.Color[1 .. 99] (or no colour control supported): Set BSH.Common.Setting.AmbientLightBrightness directly from the Brightness.
    • Otherwise: Set BSH.Common.Setting.AmbientLightColor to BSH.Common.EnumType.AmbientLightColor.CustomColor and use the Brightness, Hue, and Saturation characteristics to set BSH.Common.Setting.AmbientLightCustomColor. This adds use of the Brightness value.

@thoukydides thoukydides removed the waiting for feedback Further information is requested label May 17, 2020
@josiasmontag
Copy link
Author

Yes seems correct for me. Additionally, when automatically switching on the light, the plugin should set AmbientLightColor to CustomColor. The AmbientLightCustomColor setting is only available via API, if the AmbientLightColor setting is set to CustomColor 🙄

@thoukydides
Copy link
Owner

Yes seems correct for me.

Thanks for checking.

Additionally, when automatically switching on the light, the plugin should set AmbientLightColor to CustomColor. The AmbientLightCustomColor setting is only available via API, if the AmbientLightColor setting is set to CustomColor 🙄

The plugin already does that when the Saturation or Value is written.

@thoukydides
Copy link
Owner

@josiasmontag, hopefully version 0.18.1 will fix the discovery of ambient light capabilities and also properly support its brightness (both with custom and non-custom colours).

@thoukydides thoukydides added the waiting for feedback Further information is requested label May 24, 2020
@thoukydides thoukydides changed the title Ambient Light not detected if hood switched off Ambient Light not detected if hood switched off (Bosch DWF97RW65) May 25, 2020
@thoukydides
Copy link
Owner

@josiasmontag, have you had the opportunity to try version 0.18.1 yet to see whether it fixes the handling of the Hood ambient light?

@josiasmontag
Copy link
Author

josiasmontag commented Jul 24, 2020

Sorry for the delay. Yes, it seems to work fine for me. The light was detected correctly after several Homebridge restarts.
I didn't test to complete remove the cache and starting from starting from scratch though.

If I see further issues I will reopen this.

Thanks!

@thoukydides thoukydides removed the waiting for feedback Further information is requested label Jul 24, 2020
@thoukydides
Copy link
Owner

Wonderful! Thank you for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants