Page 1 of 1

Get Device Colour

Posted: Sunday 24 September 2017 13:49
by solidum90
Hi to everyone,
I'm desperate for a chance to get the color set on an RGB device. Via API is not possible, but is there another way to intercept color change command from LUA / dzVents / etc ..?

I would be very useful for me!

Thanks to everyone, have a good Sunday :)

Re: Get Device Colour

Posted: Sunday 24 September 2017 21:49
by zicht
Sorry ... not enough information to have a constructive answer.
What kind of rgb device, does it have a webpage or interface somehow ?
What device are we writing about ?

Re: Get Device Colour

Posted: Sunday 24 September 2017 22:40
by solidum90
Hi zicht,
I have several rgb devices, mostly MiLight (5 rgb stripes, 12 rgb+cct GU10 + 8 e27, connected to domoticz via 2 MiLight wifi bridges),
I also have several xiaomi bulbs and stripes, I also had several Philips Hue but I went completely to MiLigh considering great value for money! :D

My purpose is get the color set from domoticz (from scene or dashboard).
From dashboard, for now, I make a workaround:
I use my little dashboard writted in php, when it set a color saves in an xml file along with the device idx, but if the color is set by a domoticz scene I have no way of getting it :'(

Obviously if I set the color by MiLight remote controller or by xiaomi app I do not expect to get, but i'm not interested since I use for 99% domoticz! :mrgreen:
Is it clear now?

Thanks very much!

Re: Get Device Colour

Posted: Monday 25 September 2017 14:48
by zicht
Yes i get the goal, but i do not have these devices :( so its a bit difficult to evaluate.
I suppose you use it similar to https://baptiste-wicht.com/posts/2017/0 ... ystem.html

Thinking out loud :
If the wifi bridge contains a webpage with status of all devices you could read it there. (basically you need to have a source to read the data from)
Or if there is a webpage with an account online there could be an api (i did not find it with google)
Without a source to get the data you are looking for, it will be impossible,
or you need to capture the device signals and store the values somewhere.

If there is a source with data and no api then all depends on the level of security that is involved.

Re: Get Device Colour

Posted: Monday 25 September 2017 15:10
by solidum90
Thanks again zicht :)

I guess MiLight bridge does not hold anything in it's memory (milight software is not really the best).

But what I can not do is much simpler! Know the color that domoticz sent to the device! :geek:

As I said, I do not expect to know the exactly color set by the MiLight remote, but the one that domoticz sends, for me is the simplest solution.
It works for any RGB device (as it already does with brightness, for example) without having to do something ad-hoc for MiLight, rather than Yeelight, Philips Hue, etc.
Am I wrong?

Just that I just can not intercept the color change event to be able to store it somewhere :(


Regards!

Re: Get Device Colour

Posted: Monday 25 September 2017 17:31
by zicht
Then set a uservariable at the same time you set the color ?
Do you set the color with a device switch or with a script or blocky ?

example :

Code: Select all

If <colorset condition> then commandArray['Variable:color']]="blue" end
or if it is a selector switch :

Code: Select all

if devicechanged['<slectorswitch>']=="blue" then commandArray['Variable:color']]="blue" end
for a physical switch you can get the value by

Code: Select all

otherdevices{'<name>'] 
or detect a change by

Code: Select all

devicechanged['<name>'}
if you use openurl it could be

Code: Select all

commandArray["OpenURL"] = "<linkf or blue>"
commandArray['Variable:color']]="blue"

it is depending on how you set the color :)

Re: Get Device Colour

Posted: Monday 25 September 2017 22:25
by solidum90
Thanks again zicht ! :)

I try this solution but on print both devicechanged['<name>'] or otherdevices{'<name>'] it always print "Set Level", also in logs :'(

Can you try on your domoticz??

Re: Get Device Colour

Posted: Monday 25 September 2017 23:21
by zicht
Do you use a selector switch ?
in that case Each selector value gives back a unique level.
like :
blue set level 10
red set level 20
etc...
just try and see the diff values...
Once you get it, its straight forward :)
Have a couple of them


or do you have 3 diff color sliders ? Then read the set value for all, the combination of them makes a color (RGB levels)
Sorry i do not have such a device (yet :evil: )...so i cant test right now.
But there has to be a way to discover.
Just make a couple of print to the log with values.

Re: Get Device Colour

Posted: Monday 25 September 2017 23:35
by solidum90
I use a dimmer (attach two screenshots).

Thanks again! :)

Re: Get Device Colour

Posted: Tuesday 26 September 2017 8:46
by zicht
Well if you do not get a value somewhere : I do not see how to get the value in a normal way...
Sorry to say i can't help you with this one... maybe somebody else ?

Re: Get Device Colour

Posted: Tuesday 26 September 2017 9:17
by solidum90
Thanks anyway zicht, you have been very kind! :)
Both milight and yeelight devices are managed through that type of Dimmer, also the Philips Hue if I remember right...

We are waiting for someone to "enlighten"us :D

Re: Get Device Colour

Posted: Thursday 05 October 2017 15:33
by solidum90
There aren't any solutions?

Re: Get Device Colour

Posted: Friday 20 October 2017 16:47
by solidum90
UPPP