Philips Hue Dimmer Switch via MQTT controlling Osram Lightify and Ucomen Plug

Hi OpenHAB’ers,

I’m a newbie to this world and try to learn how to swim :slight_smile:

I’m using OpenHAB 2.5.5 and MQTT/mosquitto 1.6.10 and zigbee2mqtt 1.13.0 on a Raspberry Pi with some 15+ MQTT controlled devices. So far, so good. Now I want to use a Philips Hue Dimmer Switch to control an Osram Lightify bulb and a Ucomen switch (current Tasmota firmware 8.3.1 patched). All three devices are available using MQTT and controllable via openHAB. Where do I want to be? The remote ON/OFF switches both devices on/off. The remote dimmer brightens/darkens the Lightify bulb and the plug is switched ON if dimming value > 0.

My current rule:

rule "LivingDining Lamp Remote Control on/off"
when
Item iGFL_LivingDining_LampRemoteControl_RemoteControl_PhilipsHueDimmerSwitch_action     received update
then
switch(triggeringItem.state.toString) {
    case "on-press": {
        iGFL_LivingDining_FloorLamp_Lamp_OsramLightify_power.sendCommand(ON)
        iGFL_LivingDining_Trolley_Lamp_Ucomen_power.sendCommand(ON)
    }
    case "off-press": {
        iGFL_LivingDining_FloorLamp_Lamp_OsramLightify_power.sendCommand(OFF)
        iGFL_LivingDining_Trolley_Lamp_Ucomen_power.sendCommand(OFF)
    }
}
end

The things:

Thing topic tGFL_LivingDining_FloorLamp_Lamp_OsramLightify "Floor Lamp" @ "Ground Floor Living Dining"
{
    Channels:
        Type switch : state "Power"              [ stateTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/state", commandTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/set/state", on="ON", off="OFF" ]
        Type number : linkquality "Link Quality" [ stateTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/linkquality" ]               
        Type dimmer : brightness "Brightness"    [ stateTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/brightness", commandTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/set/brightness_percent", min = 0, max = 100, step = 1 ]               
        Type string : update_available "Update"  [ stateTopic = "zigbee2mqtt/GFL/LivingDining/FloorLamp/Lamp/OsramLightify/update_available" ]
}
Thing topic tGFL_LivingDining_LampRemoteControl_RemoteControl_PhilipsHueDimmerSwitch "Remote Control" @ "Ground Floor Living Dining"
{
    Channels:
        Type string : action "Action"            [ stateTopic = "zigbee2mqtt/GFL/LivingDining/LampRemoteControl/RemoteControl/PhilipsHueDimmerSwitch/action" ]
        Type number : linkquality "Link Quality" [ stateTopic = "zigbee2mqtt/GFL/LivingDining/LampRemoteControl/RemoteControl/PhilipsHueDimmerSwitch/linkquality" ]               
        Type number : brightness "Brightness"    [ stateTopic = "zigbee2mqtt/GFL/LivingDining/LampRemoteControl/RemoteControl/PhilipsHueDimmerSwitch/brightness", min = 0, max = 255, step = 1 ]               
        Type string : update_available "Update"  [ stateTopic = "zigbee2mqtt/GFL/LivingDining/LampRemoteControl/RemoteControl/PhilipsHueDimmerSwitch/update_available" ]
}

But how do I use the the brightness values in case of a brightness change?

Thanks for any helpful ideas :slight_smile:
Berny

Here is an example of what you can do…