Page 1 of 1

usage of setKelvin

Posted: Tuesday 29 October 2019 11:23
by pipiche
When using the setKevin( temp ) function to set a device operated via a python plugin, it looks like a brightness value is given.
Where thise brightness value is coming from ?

here after is the simple dzVent script

Code: Select all

return {
        active = true,
        on = {
                ['timer'] = {
                        'every minute',
                }
        },

        execute = function(dz, Item, info)

                local lamp = dz.devices( 'DIN-Zigate - ColorControlWW-90fd9ffffe86c7a1-01')
                lamp.setKelvin(80)
        end
}
if then you enable debug in your python plugin, you'll see in the onCommand the following information:

Code: Select all

Command: Set Color
Level: 86
Color: {"b":0,"cw":51,"g":0,"m":2,"r":0,"t":204,"ww":204}
The question is , where Level is coming from as it is not set in the setKelvin function


PS/

Re: usage of setKelvin

Posted: Tuesday 29 October 2019 14:30
by waaren
pipiche wrote: Tuesday 29 October 2019 11:23 When using the setKevin( temp ) function to set a device operated via a python plugin, it looks like a brightness value is given.
Where this brightness value is coming from ?
I checked the dzVents setKelvin method but do not see this behavior.
A dz.devices(156).setKelvin(10) does a

Code: Select all

http://127.0.0.1:8084/json.htm?param=setkelvinlevel&type=command&idx=156&kelvin=10
behind the scenes. On my system (V4.11403) that does not influence the level / brightness.

Re: usage of setKelvin

Posted: Tuesday 29 October 2019 14:34
by pipiche
waaren wrote: Tuesday 29 October 2019 14:30
pipiche wrote: Tuesday 29 October 2019 11:23 When using the setKevin( temp ) function to set a device operated via a python plugin, it looks like a brightness value is given.
Where this brightness value is coming from ?
I checked the dzVents setKelvin method but do not see this behavior.
A dz.devices(156).setKelvin(10) does a

Code: Select all

http://127.0.0.1:8084/json.htm?param=setkelvinlevel&type=command&idx=156&kelvin=10
behind the scenes. On my system (V4.11403) that does not influence the level / brightness.
Waaren, is your device based on a Native plugin, or a Python plugin ?

Re: usage of setKelvin

Posted: Tuesday 29 October 2019 15:01
by waaren
pipiche wrote: Tuesday 29 October 2019 14:34 @waaren, is your device based on a Native plugin, or a Python plugin ?
It's a native plugin (Hue) but for as far dzVents is used to execute the setKelvin that does not make a difference to the url send.
There is only one setKelvin method available in dzVents and it use the same URL for all devices for which it is available.
You can look in <domoticz dir>/dzVents/runtime/device-adapters/rgbw_device.lua where you will find

Code: Select all

		if (device.deviceSubType == 'RGBWW') or (device.deviceSubType == 'WW')  then
			function device.setKelvin(kelvin)
				local url
				url = domoticz.settings['Domoticz url'] ..
						'/json.htm?param=setkelvinlevel&type=command&idx=' .. device.id .. '&kelvin=' .. tonumber(kelvin)
				return domoticz.openURL(url)
			end
		end
 

Re: usage of setKelvin

Posted: Tuesday 29 October 2019 15:04
by pipiche
My worry is that indeed there is only one API on the dzVent, but the way it is translated by the Python Framework might be different.
Why I'm saying that is because the onCommand() method called when a command is made receive 2 parameters, Level and Color.
If the Level is not part of the setKelvin(), where is it coming from

Re: usage of setKelvin  [Solved]

Posted: Tuesday 29 October 2019 19:43
by waaren
pipiche wrote: Tuesday 29 October 2019 15:04 My worry is that indeed there is only one API on the dzVent, but the way it is translated by the Python Framework might be different.
Why I'm saying that is because the onCommand() method called when a command is made receive 2 parameters, Level and Color.
If the Level is not part of the setKelvin(), where is it coming from
dzVents only interacts with domoticz. Probably better to ask this in a Python framework sub-forum.

Re: usage of setKelvin

Posted: Tuesday 29 October 2019 19:45
by pipiche
@Waaren, yep I did it.
Follow-up on https://www.domoticz.com/forum/viewtopi ... 65&t=29949