boschshcpy icon indicating copy to clipboard operation
boschshcpy copied to clipboard

include support for "Bosch light / shutter control II" (deviceModel: "MICROMODULE_LIGHT_CONTROL")

Open DFS-90 opened this issue 1 year ago • 3 comments

As I installed another "Bosch light / shutter control II" in my home, I used the opportunity to create a Postman excerpt with a configuration as light switch (as initial setup allows to configure the switch as either light or shutter control) before.

I tried to include support for "Bosch light / shutter control II" (deviceModel: "MICROMODULE_LIGHT_CONTROL").

Excerpts from Postman:

{
    "@type": "device",
    "rootDeviceId": "xx-xx-xx-xx-xx-xx",
    "id": "hdm:ZigBee:dc8exxxxxxxxxxxx",
    "deviceServiceIds": [
        "CommunicationQuality",
        "PowerMeter",
        "ElectricalFaults",
        "SwitchConfiguration"
    ],
    "manufacturer": "BOSCH",
    "deviceModel": "MICROMODULE_LIGHT_CONTROL",
    "serial": "DC8Exxxxxxxxxxxx",
    "profile": "GENERIC",
    "name": "LightMM_dc8exxxxxxxxxxxx",
    "status": "AVAILABLE",
    "childDeviceIds": [
        "hdm:ZigBee:dc8exxxxxxxxxxxx#3",
        "hdm:ZigBee:dc8exxxxxxxxxxxx#2"
    ]
}

This is a configuration for two connected lights:

    {
        "@type": "device",
        "rootDeviceId": "xx-xx-xx-xx-xx-xx",
        "id": "hdm:ZigBee:dc8exxxxxxxxxxxx#3",
        "deviceServiceIds": [
            "PowerSwitch",
            "ChildProtection",
            "PowerSwitchProgram"
        ],
        "manufacturer": "BOSCH",
        "roomId": "hz_8",
        "deviceModel": "MICROMODULE_LIGHT_ATTACHED",
        "serial": "DC8EXXXXXXXXXXXX",
        "profile": "GENERIC",
        "iconId": "icon_mm_light_generic",
        "name": "test2",
        "status": "AVAILABLE",
        "parentDeviceId": "hdm:ZigBee:dc8exxxxxxxxxxxx",
        "childDeviceIds": []
    },
    {
        "@type": "device",
        "rootDeviceId": "xx-xx-xx-xx-xx-xx",
        "id": "hdm:ZigBee:dc8exxxxxxxxxxxx#2",
        "deviceServiceIds": [
            "PowerSwitch",
            "ChildProtection",
            "PowerSwitchProgram"
        ],
        "manufacturer": "BOSCH",
        "roomId": "hz_8",
        "deviceModel": "MICROMODULE_LIGHT_ATTACHED",
        "serial": "DC8EXXXXXXXXXXXX",
        "profile": "GENERIC",
        "iconId": "icon_mm_light_generic",
        "name": "test",
        "status": "AVAILABLE",
        "parentDeviceId": "hdm:ZigBee:dc8exxxxxxxxxxxx",
        "childDeviceIds": []
    },

This is a configuration for a single connected light:

{
        "@type": "device",
        "rootDeviceId": "xx-xx-xx-xx-xx-xx",
        "id": "hdm:ZigBee:dc8exxxxxxxxxxxx#2",
        "deviceServiceIds": [
            "PowerSwitch",
            "ChildProtection",
            "PowerSwitchProgram"
        ],
        "manufacturer": "BOSCH",
        "roomId": "hz_8",
        "deviceModel": "MICROMODULE_LIGHT_ATTACHED",
        "serial": "DC8Exxxxxxxxxxxx",
        "profile": "GENERIC",
        "iconId": "icon_mm_light_generic",
        "name": "test3",
        "status": "AVAILABLE",
        "parentDeviceId": "hdm:ZigBee:dc8exxxxxxxxxxxx",
        "childDeviceIds": []
    },

I'm not sure if the correct deviceModel has to be "MICROMODULE_LIGHT_CONTROL" or "MICROMODULE_LIGHT_ATTACHED".

I guess that the correct term has to be "MICROMODULE_LIGHT_ATTACHED", so I implemented it that way. Still, please review / test and correct as needed.

Thanks!

DFS-90 avatar Dec 01 '22 12:12 DFS-90

Thanks for providing this PR. For the light switch, the MICROMODULE_LIGHT_ATTACHED is the correct one, as it is providing the service PowerSwitch for turning the switch on and off. However if you want to track the energy demand of the connected lights, we also need to register the device MICROMODULE_LIGHT_CONTROL, as this device is providing the service PowerMeter.

tschamm avatar Dec 03 '22 16:12 tschamm

I will not merge, as your code would lead to errors as a light switch (BSM model) is expected to provide both services (as written in the comment before). Hence the HA component will create entites for switch, power, and energy for all devices returned by calling property light_switches. This will not work if the device would be a MM.

So we need to implement both models MICROMODULE_LIGHT_ATTACHED and MICROMODULE_LIGHT_CONTROL as separate devices, and add two new functions to call mm_light_attached and mm_light_control. Then it should be ok.

tschamm avatar Dec 03 '22 16:12 tschamm

I will not merge, as your code would lead to errors as a light switch (BSM model) is expected to provide both services (as written in the comment before). Hence the HA component will create entites for switch, power, and energy for all devices returned by calling property light_switches. This will not work if the device would be a MM.

So we need to implement both models MICROMODULE_LIGHT_ATTACHED and MICROMODULE_LIGHT_CONTROL as separate devices, and add two new functions to call mm_light_attached and mm_light_control. Then it should be ok.

Thanks for your reply and your explanations! As I already integrated my switch as a MICROMODULE_SHUTTER_CONTROL into my smart home system and I have very little time at the moment, I won't be able to try this out for now...

Maybe somebody else using the switch as a MICROMODULE_LIGHT_CONTROL can make use of the Postman excerpts posted above?

Thanks and best regards, David

DFS-90 avatar Dec 06 '22 11:12 DFS-90

@DFS-90 , @tschamm, any idea when this addition of the Light Control would become available? I would be very grateful for having the Shutter/Light Control II available through the Home Assistant Bosch Integration :) regards, mel

melianor avatar Jan 15 '23 14:01 melianor

How can I set my HACS SHC custom component to use this branch instead of master? I'd be happy to test the new Micromodule implementation with both shutter II and light II devices in HA.

basslet avatar Jan 20 '23 22:01 basslet

How can I set my HACS SHC custom component to use this branch instead of master? I'd be happy to test the new Micromodule implementation with both shutter II and light II devices in HA.

Count me in for testing as well!

melianor avatar Jan 20 '23 22:01 melianor

I've installed a light II today and would be very happy to test the HA integration.

MatthiasDod avatar Jan 21 '23 16:01 MatthiasDod

Thanks!

tschamm avatar Jan 21 '23 21:01 tschamm

Support for MICROMODULE_LIGHT_CONTROL and MICROMODULE_LIGHT_ATTACHED is now added to bosch_shc custom component.

tschamm avatar Jan 21 '23 22:01 tschamm

First of all thanks for adding the light II device so quickly!

I've updated my HA installation by update of the content of the bosch_shc directory. After restart of HA I've got 2 new devices (MICROMODULE_LIGHT_ATTACHED, MICROMODULE_LIGHT_CONTROL) and 3 new sensor entities.

Detailed testing of the functionality resulted in the following findings:

  1. The devices seems to be swapped: The MICROMODULE_LIGHT_ATTACHED is created as switch and the MICROMODULE_LIGHT_CONTROL as sensors (see attached screenshots)

  2. The default names of the power/energy sensors are somehow unhandy (sensor.lightmm_f4b3b1fffe03bef2_energy, sensor.lightmm_f4b3b1fffe03bef2_power) whereas the name of the switch sensor is ok (switch.schalter_gartenstom - which is the device name in the Bosch App)

  3. All sensors show correct values and react immediatelly on changes

  4. The switch is not working and produces an error message. Details see attached logfile.

log.txt 2023-01-22_11h56_00 2023-01-22_11h37_20

MatthiasDod avatar Jan 22 '23 10:01 MatthiasDod

Hi @MatthiasDod, let me shortly respond to your questions:

  1. The MICROMODULE_LIGHT_CONTROL is equal to the micromodule device you put into your wall. It provides the energy power meter as well as connection quality (see above). The MICROMODULE_LIGHT_ATTACHED is basically the light control for every attached light. Don't ask me why BSH has chosen that naming, but I just follow their naming.
  2. You can change the device names in Home Assistant after first configuration. I'll just take the name from what the device reports, nothing I can change here.
  3. that's perfect
  4. I'm aware of that, please see https://github.com/tschamm/boschshcpy/issues/22

Best, Thomas

tschamm avatar Jan 22 '23 19:01 tschamm