Xiaomi RGB Gateway

Moderator: leecollings

Post Reply
marcot
Posts: 2
Joined: Wednesday 26 September 2018 10:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Xiaomi RGB Gateway

Post by marcot »

I've a Domoticz version 4.9700 running and a Xiaomi RGB Gateway on firmware 1.4.1_157.0143.

What I did found out is that you can control the brightness of build-in RGB light with:
commandArray['Xiaomi RGB Gateway']='Set Level:'..tostring(10) -

You can turn on/off the light with:
commandArray['Xiaomi RGB Gateway']='On'

But how do you change the color of the RGB gateway via Lua?

Thanks!

Marco
marcot
Posts: 2
Joined: Wednesday 26 September 2018 10:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi RGB Gateway

Post by marcot »

Ok will answer my own question then:

function changeRGBGatewayColor(rgbColor, brightness)
gatewayName = '<NAME OF YOUR XIAOMI RGB GATEWAY>'
gatewayIDX = otherdevices_idx[gatewayName]
url = 'http://<YOUR DOMOTICZ IP ADDRESS>:<YOUR DOMOTICZ PORT NUMBBER>/json.htm?type=command&param=setcolbrightnessvalue&idx='..tostring(gatewayIDX)..'&hex='..rgbColor..'&brightness='..tostring(brightness)..'&iswhite=false'
commandArray['OpenURL']= url
commandArray[gatewayName] ='Off AFTER 10' -- switch it off after 10 seconds
end
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest