Xiaomi Gateway - Setting light color
Moderator: leecollings
-
- Posts: 18
- Joined: Wednesday 29 November 2017 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Xiaomi Gateway - Setting light color
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!
Thanks!
-
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Xiaomi Gateway - Setting light color
i make it in dzvents scripts with this code:
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)
Code: Select all
local sceneCmd = 'curl -s -i -H "Accept: application/json" "http://192.168.1.4:8084/json.htm?type=command¶m=setcolbrightnessvalue&idx=20&hue=236&brightness=1&iswhite=false"'
os.execute(sceneCmd)
change the idx (20 in my case)
change de colour (236 in my case)
and change the brightness (1 in my case)
-
- Posts: 18
- Joined: Wednesday 29 November 2017 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
I see this skeleton when creating a new dzvents script:
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.)
Code: Select all
return {
on = {
devices = {
'myDevice'
}
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
end
}
-
- Posts: 25
- Joined: Thursday 30 November 2017 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
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.
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.
-
- Posts: 25
- Joined: Thursday 30 November 2017 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
Hello,
i am again.
I also tried this in my lua script:
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.
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¶m=setcolbrightnessvalue&idx=1&hue=236&brightness=100&iswhite=false"'
exec_success = os.execute(sceneCmd)
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.
-
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Xiaomi Gateway - Setting light color
y use this comand in a dzvents script and works perfect
-
- Posts: 25
- Joined: Thursday 30 November 2017 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
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.
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.
-
- Posts: 38
- Joined: Monday 12 February 2018 12:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Xiaomi Gateway - Setting light color
Hi,
Can you add some printscreens = examples how they work?
Thanks
Can you add some printscreens = examples how they work?
Thanks
-
- Posts: 25
- Joined: Thursday 30 November 2017 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
Hi,
here an example of my lua script.
Addapt your ip and port of your domoticz device
here an example of my lua script.
Addapt your ip and port of your domoticz device
Code: Select all
Red = 0xFF0000 --(255,0,0)
GatewayColour = Red
local sceneCmd = 'curl -s -i -H "Accept: application/json" "http://192.168.10.1:8080/json.htm?type=command¶m=setcolbrightnessvalue&idx=1&hex=0x'..string.format("%x", GatewayColour)..'&brightness=100&iswhite=false"'
os.execute(sceneCmd)
-
- Posts: 38
- Joined: Monday 12 February 2018 12:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Xiaomi Gateway - Setting light color
Thanks mate, but i am absolute beginner , try to write first script ever .Can you add complete from A to Z script?
-
- Posts: 38
- Joined: Monday 12 February 2018 12:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Xiaomi Gateway - Setting light color
hekm77 many thanks. Domoticz Xiaomi Wiki must including your script because it's very helpful.
-
- Posts: 18
- Joined: Sunday 24 September 2017 12:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10199
- Location: Destelbergen Belgium
- Contact:
Re: Xiaomi Gateway - Setting light color
On a Synology i got an error :
2018-06-04 02:37:37.094 Error: dzVents: Error: ...icz/var/scripts/dzVents/generated_scripts/Xiaomi RGB.lua:26: attempt to index field 'utils' (a nil value)
2018-06-04 02:37:37.094 Error: dzVents: Error: ...icz/var/scripts/dzVents/generated_scripts/Xiaomi RGB.lua:26: attempt to index field 'utils' (a nil value)
-
- Posts: 25
- Joined: Thursday 30 November 2017 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Gateway - Setting light color
Hi,
to set color for the xiaomi gateway is not working in the last domoticz beta and current gateway fw.
I try it with my old script but can't change the color. The gateway switch always to the last manually selected color.
any idea?
to set color for the xiaomi gateway is not working in the last domoticz beta and current gateway fw.
I try it with my old script but can't change the color. The gateway switch always to the last manually selected color.
Code: Select all
---------------------------------------------------------------------------------------------------
-- Gateway Colour
commandArray['Xiaomi_RGB_Gateway']='Set Level:'..tostring(GatewayBrightness) -- set brightness LED light from Gateway
-- change colour of gateway
local sceneCmd = 'curl -s -i -H "Accept: application/json" "http://192.168.178.62:8083/json.htm?
type=command¶m=setcolbrightnessvalue&idx=1&hex=0x'..string.format("%x", GatewayColour)..'&brightness=100&iswhite=false"'
os.execute(sceneCmd)
Who is online
Users browsing this forum: No registered users and 1 guest