usage of setKelvin  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

usage of setKelvin

Post 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/
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: usage of setKelvin

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: usage of setKelvin

Post 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 ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: usage of setKelvin

Post 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
 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: usage of setKelvin

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: usage of setKelvin  [Solved]

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: usage of setKelvin

Post by pipiche »

@Waaren, yep I did it.
Follow-up on https://www.domoticz.com/forum/viewtopi ... 65&t=29949
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest