Skip to content

v2 quirk for Bosch light/cover control relay II (BMCT-SLC / RBSH-MMS-ZB-EU) #4052

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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

jeverley
Copy link
Contributor

@jeverley jeverley commented May 8, 2025

Proposed change

This quirk also overrides the window_covering_type from the tilt only Shade type, to Tilt_blind_tilt_and_lift because the device is a generic relay supporting commands for both lift and tilt.

Uses https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/bosch.ts as reference for exposing the device's configuration and status entities.

zigbee2mqtt supports the ability to manage entity availability depending on a device attribute value (in this case it exposes light entities when the device is in light mode, and the cover entity when in shade mode).
ZHA can't currently do this, so instead users will need to disable the redundant entities based on their configuration.

Additional information

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

Uses https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/bosch.ts for reference

Overrides the window_covering_type from `Shade` (tilt) to `Tilt_blind_tilt_and_lift` because the device is a generic relay supporting commands for both lift and tilt.

pre-commit fixes
Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.22%. Comparing base (5556090) to head (33d3185).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4052      +/-   ##
==========================================
+ Coverage   91.19%   91.22%   +0.02%     
==========================================
  Files         335      336       +1     
  Lines       10886    10921      +35     
==========================================
+ Hits         9928     9963      +35     
  Misses        958      958              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeverley
Copy link
Contributor Author

jeverley commented May 8, 2025

Looping in initial testing feedback from home-assistant/core#143875 (comment)

Hi @stylefish, the duration entities should now be working (latest version in https://github.com/zigpy/zha-device-handlers/pull/4052/files).
They were missing the multiplier value - please can you confirm they now reflect your configured value in the UI?

I've also updated the motor_state to use the sensor entity type.

oh wow - thank you @jeverley !

yes, the shutters are working again! :)

i've attached a screenshot of one device:

https://github.com/user-attachments/assets/0da1479a-cda6-4338-9ff6-5e750f7fb05e

https://github.com/user-attachments/assets/9aa008f2-4e93-4bb3-b20b-d0e84d1be794

i would've liked to attach another diagnostic json, but somehow i'm getting an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 301, in get
    data = await info.device_diagnostics(hass, config_entry, device)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/diagnostics.py", line 114, in async_get_device_diagnostics
    diagnostics_json: dict[str, Any] = zha_device_proxy.device.get_diagnostics_json()
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/zha/zigbee/device.py", line 1378, in get_diagnostics_json
    "state": platform_entity.state,
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/zha/application/platforms/number/__init__.py", line 284, in state
    response["state"] = self.native_value
                        ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/zha/application/platforms/number/__init__.py", line 290, in native_value
    value = self._cluster_handler.cluster.get(self._attribute_name)
  File "/usr/local/lib/python3.13/site-packages/zigpy/quirks/__init__.py", line 412, in get
    attr_def = self.find_attribute(key)
  File "/usr/local/lib/python3.13/site-packages/zigpy/zcl/__init__.py", line 240, in find_attribute
    raise ValueError(  # noqa: TRY004
    ...<2 lines>...
    )
ValueError: Attribute must be either a string or an integer, not ZCLAttributeDef(id=0x0002, name='calibration_opening_time', type=, zcl_type=, access=, mandatory=False, is_manufacturer_specific=True) (

is this related or is this another issue?

anyway, it would be great if this could be mainlined! the shutters are working great, though i noticed, that "opening_duration" and "closing_duration" and some other options are "disabled" with the info This entity is no longer being provided by the zha integration. If the entity is no longer in use, delete it in settings.

is this due to the previous quirk?

the settings can be read/write from the "manage device" dialog, this was also the case for the previous quirk:

https://github.com/user-attachments/assets/e92e2fc9-e03b-4def-9090-a69b64d52a90

i'm happy to help to integrate this into mainline.

thanks again, i'm very happy with my working shutters on 2025.5.0 :)

@stylefish
Copy link

sorry for commenting on the issue, i've read the edit after start composing my reply.

no luck, the fields are still empty:

image

they're looking like this when opened:

image

and i'm still unable to get the diagnostic json.

@jeverley jeverley force-pushed the Bosch.RBSH-MMS-ZB-EU branch from cc04727 to 2139c07 Compare May 8, 2025 14:36
@jeverley
Copy link
Contributor Author

jeverley commented May 8, 2025

no luck, the fields are still empty:

Thanks for checking @stylefish, 253ebd2 should resolve this.

@stylefish
Copy link

yes, it works now - i have changed the values and they're persisted:

image

the disabled ones are from the old quirk and can be removed, right?

@jeverley
Copy link
Contributor Author

jeverley commented May 8, 2025

the disabled ones are from the old quirk and can be removed, right?

Yes that's correct.

@jeverley jeverley marked this pull request as ready for review May 8, 2025 15:47
@TomF79
Copy link

TomF79 commented May 8, 2025

Many thanks for your fantastic Support and work on this @jeverley and @stylefish

So i dont need the custom quirk folder and py file anymore when this PR is merged and in the next Core Update from Home Assistant?

@TheJulianJES TheJulianJES added the needs review This PR should be reviewed soon, as it generally looks good. label May 9, 2025
@TomF79
Copy link

TomF79 commented May 18, 2025

@jeverley
@stylefish

Is it possible to integrate settings for:

  1. tilt angel: 90 or 180 degrees
  2. opening/closing time for tilt angel

These two options also included in the settings from the Bosch smart Home App, so they are should configurable on the device.

@jeverley
Copy link
Contributor Author

@jeverley @stylefish

Is it possible to integrate settings for:

  1. tilt angel: 90 or 180 degrees
  2. opening/closing time for tilt angel

These two options also included in the settings from the Bosch smart Home App, so they are should configurable on the device.

Hi @TomF79, my understanding from the z2m quirk attribute mappings is that you should be able to use the 'Opening duration' and 'Closing duration' Configuration entities that I've exposed to manage the opening/closing time.

When you say tilt angle 90 or 180 degrees, would you be able to share a screenshot of Bosch setting you're referring to?
Is this controlling the device tilt position, or configuring open/closed points?

@TomF79
Copy link

TomF79 commented May 19, 2025

When you say tilt angle 90 or 180 degrees, would you be able to share a screenshot of Bosch setting you're referring to? Is this controlling the device tilt position, or configuring open/closed points?

I will send a Screenshot at the evening.

Yes this will controlling the device tilt position.

There is one option to Control up and down with opening/closing time and one option to Control the tilt Position with Travel time in the Bosch App under the device.

I think the Travel time makes a different especially for tilt if it is for 90 or 180 degrees.

@TomF79
Copy link

TomF79 commented May 19, 2025

@jeverley

Here are some Screenshots:

Bildschirmfoto 2025-05-19 um 17 56 56 jpeg

Bildschirmfoto 2025-05-19 um 17 57 25 jpeg

Bildschirmfoto 2025-05-19 um 17 58 23 jpeg

Bildschirmfoto 2025-05-19 um 17 58 43 jpeg

I have copy your actual v2 quirk file to my custom quirk folder. The Relay Lift is working up and down correctly, but the Tilt doesnt works for me. Maybe @stylefish can also test this?

@stylefish
Copy link

sorry - no. my shutters do not support tilt.

@TomF79
Copy link

TomF79 commented May 22, 2025

Thanks for reply.

Maybe @sopelt could help to get the tilt working?

@jeverley
Copy link
Contributor Author

jeverley commented May 22, 2025

@TomF79 we'll need to identify the attribute IDs for controlling this configuration (z2m doesn't seem to have identified them).

Are you able to move the tilt at all using the home assistant tilt commands?

These should be visible on the right if you click on the cover like below:

Image

I can try and make some experimental versions of the quirk to try and find the right IDs to control the tilt config.

@TomF79
Copy link

TomF79 commented May 22, 2025

Are you able to move the tilt at all using the home assistant tilt commands?

I am not able to move the tilt at all using the home assistant tilt commands.

Tilt only works in the Bosch App and in HA with BoschSHC Integration when the relay is connected to the Bosch Controller.

@JPVenson
Copy link

JPVenson commented Jun 1, 2025

Test using

Bosch Smart Home Licht-/ Rollladensteuerung II

On external motor operated blinds.
Up/Down works. Stop Works, Rocker Switch still works.
Awesome work thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review This PR should be reviewed soon, as it generally looks good.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants