Xiaomi Gateway - Setting light color

Post Reply
misfit
Posts: 10
Joined: Wednesday 29 November 2017 12:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Xiaomi Gateway - Setting light color

Post by misfit » Sunday 03 December 2017 14:26

I can dim the light with 'level (%)' but how to set RGB color? (Tried to put hex value in 'number' block but seems thats not the right way :)

Thanks!

DAVIZINHO
Posts: 67
Joined: Sunday 27 August 2017 18:00
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by DAVIZINHO » Sunday 03 December 2017 15:54

i make it in dzvents scripts with this code:

Code: Select all

 local sceneCmd = 'curl -s -i -H "Accept: application/json" "http://192.168.1.4:8084/json.htm?type=command&param=setcolbrightnessvalue&idx=20&hue=236&brightness=1&iswhite=false"'
os.execute(sceneCmd)
change the ip and port to conect
change the idx (20 in my case)
change de colour (236 in my case)
and change the brightness (1 in my case)

misfit
Posts: 10
Joined: Wednesday 29 November 2017 12:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by misfit » Monday 04 December 2017 20:07

I see this skeleton when creating a new dzvents script:

Code: Select all

return {
	on = {
		devices = {
			'myDevice'
		}
	},
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
	end
}
How to utilize your code, if lets say i want to set the color when a user variable changing? (I set the variable with a timed blocky event.)

Schorschi
Posts: 13
Joined: Thursday 30 November 2017 23:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by Schorschi » Wednesday 06 December 2017 7:58

Hi,

i also try to set the colour of the Xiaomi Gateway with a LUA Script.
But i can only set the brightness with:

commandArray['Xiaomi RGB Gateway']='Set Level:100'

I also tried to set RGB values with Set Level but it does not work.
I don't know which command is needed to set this configuration.

Can some one explain me how to find out this information? Maybe also basicaly how to do it on other devices?

Logfile only shows Set Level if i change the colour in the web interface.

thx.

Schorschi
Posts: 13
Joined: Thursday 30 November 2017 23:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by Schorschi » Wednesday 06 December 2017 15:00

Hello,

i am again.

I also tried this in my lua script:

Code: Select all

        	local sceneCmd = 'curl -s -i -H "Accept: application/json" "http://192.168.178.55:9898/json.htm?type=command&param=setcolbrightnessvalue&idx=1&hue=236&brightness=100&iswhite=false"'
			exec_success = os.execute(sceneCmd)
But the LED light don't switch on and the variable exec_success is nul.

How can i test this os command separately?
If i try it on my console and get no error.

Domosticz is running on an raspi 1. And connected to Xiaomi Gateway V2.

Any ideas?

Thx.

DAVIZINHO
Posts: 67
Joined: Sunday 27 August 2017 18:00
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by DAVIZINHO » Wednesday 06 December 2017 15:19

y use this comand in a dzvents script and works perfect

Schorschi
Posts: 13
Joined: Thursday 30 November 2017 23:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi Gateway - Setting light color

Post by Schorschi » Thursday 07 December 2017 11:15

Hi,

i get running this command in my lua device script.
But sometimes i get an error => scirpt run for more then 10 seconds ....

Is my raspi 1 to slow???
Some one same experiance? Maybe any ideas?

Thx.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests