Bosch BMCT-SLZ: Various enhancements and fixes
#9852
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes various enhancements and fixes for the Bosch
BMCT-SLZ(Light/shutter control unit II).Here is a list of the changes I made and the reasons behind them:
decoupledandonly_short_press_decoupledoptions are not available when using the device for shutter control.BMCT-SLZreports any switch changes as a command to the coordinator. Unfortunately, there is no real separation between the inputs as Bosch uses the same command for both. This results in only one action attribute with several states depending on the used switch type, the input and what happened lastly. If there are any suggestions on how I can improve that situation, I'm open for comments!BMCT-SLZvia the Bosch app, you can automatically turn off each light. This is based on a time schedule for regular changes (which are being stored and executed on the Bosch SHC) as well as two separate attributes on theBMCT-SLZitself for more short-term changes. The latter is being supported by this pull request. To use it, it's necessary to set the desired amount of time to disable the light as well as enable the feature. If the light is already on when enabling the feature, the internal counter starts from that moment. Otherwise, it's counted from the moment the light is turned on.seMeteringandhaElectricalMeasurementto 1: By default, theelectricityMeterfunction uses a minimum change for theseMeteringandhaElectricalMeasurementclusters of 5. As lights may use very little energy, this may be a bit high. Therefore, I change the minimum change value to 1 as that fits the use case better, in my opinion (and the Bosch SHC uses it as well).BMCT-SLZis under the impression it falls off the network every 10 minutes. The reason is an unansweredzclVersionread from theBMCT-SLZto the coordinator. As Z2M uses the reportedzclVersionfrom the device, this information isn't available during the interview stage, which explains why the request isn't answered at all. To mitigate that, I created acustomReadResponsefunction and mimicked the answer from the Bosch Smart Home Controller II.on_offstate for both light outputs wasn't updated reliably. I fixed that by using theforce_multiendpointversion of theon_offconverter.noneas switch type: Bosch officially supports the use of theBMCT-SLZwithout any switch connected to it. This wasn't possible with Z2M up until now as the required value couldn't be set as switch type.configurationstage. As it's quite irritating when options are in such an "undefined" state, I included them in theconfigurefunction. Since I was already there, I also split the configurations into separate functions to make it clear what is being used for which mode (light or shutter). Unfortunately, there is no possibility to trigger a reconfiguration programmatically when setting thedeviceMode. In that case, we wouldn't have attributes in the state that don't fit into the selecteddeviceMode. This was the initial reason I did the separation in the first place (until I realized that it was not possible) to be honest.BMCT-SLZ, I didn't want to make any real change here. But I tried to document any findings and guesses in the code for someone else to continue as I have to return the devices now.This (partially) fixes #9129 and #9768.