WiFi LED Binding+Xiaomi Cube

I can not configure the bundle of the Xiaomi cube and the WIFI LED controller. The task is to rotate the cube to smoothly adjust the brightness of the LED strip. For example, when turning left, the tape faded from 100% to 0% and vice versa when turning right. How can I do that? There is no separate Item brightness. So far I have only been able to make a fixed brightness, like this:
rule “Xiaomi Cube LevelUp”
when
Channel “mihome:sensor_cube:158d00029a58b7:action” triggered ROTATE_RIGHT
then
FamilyRoom_Light5.sendCommand(“355,100,100”)
end
//…
rule “Xiaomi Cube LevelDown”
when
Channel “mihome:sensor_cube:158d00029a58b7:action” triggered ROTATE_LEFT
then
FamilyRoom_Light5.sendCommand(“355,100,50”)
end
//…
I am new to OH, trying to master it. But I can’t solve such problems. Can you help?

Hi,

you need the angle of the cube and convert it to your brightness.
Here’s my rule:

rule "AQMC_Dimmer"                                                                                                       
when                                                                                                                     
        Item AqaraMQ_AQC_Angle received update                                                                           
then                                                                                                                     
                                                                                                                         
        var Number newBri                                                                                                
        logInfo("lights.rules", "State: " + GF_Light.state + " changed by " + ((AqaraMQ_AQC_Angle.state as Number).intVal
ue() * 100/180))                                                                                                         
        newBri = (GF_Light.state as Number).intValue() + (((AqaraMQ_AQC_Angle.state as Number).intValue() * 100/180))    
        logInfo("lights.rules", "newBri " + newBri)                                                                      
        logInfo("lights.rules", "SideUp " + AqaraMQ_AQC_SideUp.state)                                                    
        if((AqaraMQ_AQC_Angle.state as Number) > 0.0){                                                                   
                newBri = Math.min(newBri,100)                                                                            
                logInfo("lights.rules", "newBri corr + " + newBri)                                                       
                //GF_LivingRoom_Light.sendCommand(newBri.intValue())                                                     
        }                                                                                                                
        else{                                                                                                            
                                                                                                                         
                if((AqaraMQ_AQC_Angle.state as Number) < 0.0){                                                           
                        newBri = Math.max(newBri,0)                                                                      
                        logInfo("lights.rules", "newBri corr - " + newBri)                                               
                }                                                                                                        
        }                                                                                                                
        if((AqaraMQ_AQC_Angle.state as Number) != 0.0){                                                                  
                if((AqaraMQ_AQC_SideUp.state as Number) == 3.0){                                                         
                        GF_LivingRoom_Light.sendCommand(newBri.intValue())                                               
                }                                                                                                        
                if((AqaraMQ_AQC_SideUp.state as Number) == 4.0){                                                         
                        GF_EZDining_Light.sendCommand(newBri.intValue())                                                 
                }                                                                                                        
                if((AqaraMQ_AQC_SideUp.state as Number) == 1.0){                                                         
                        GF_Kitchen_Light.sendCommand(newBri.intValue())                                                  
                }                                                                                                        
        }                                                                                                                
                                                                                                                         
end