Python framework - Set Color - Brightness

Python and python framework

Moderator: leecollings

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

Python framework - Set Color - Brightness

Post by pipiche »

When Set Color is used as documented here are the information we can received:
https://www.domoticz.com/wiki/DzVents:_ ... .2FApplamp
"m":3, Color Mode
"t":0, Kelvin Temp
"r":0, Red
"g":0, Green
"b":50, Blue
"cw":0, Cold white level
"ww":0, Warm white level (also used as level for monochrome white)
br:100 Brightness

However 'br' seems to be never sent to the plugin via the onCommand() call

Set Color for Device: 6b6d EPout: 0b Unit: 31 DeviceType: ColorControlFull Level: 100 Color: {"b":43,"cw":27,"g":255,"m":4,"r":44,"t":227,"ww":215}


How can we get the Brighness level which is mainly provided when using the RGBWWWZ ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python framework - Set Color - Brightness

Post by waaren »

pipiche wrote: Tuesday 10 December 2019 21:22 When Set Color is used as documented here are the information we can received:
https://www.domoticz.com/wiki/DzVents:_ ... .2FApplamp
How can we get the Brighness level which is mainly provided when using the RGBWWWZ ?
Not sure why you goto dzVents wiki for this. the setcolor method described there is not the same as the domoticz API (described here )
the API is

Code: Select all

http:// <domoticz ip>:<domoticz port>/json.htm?type=command&param=setcolbrightnessvalue&idx=<id>&color={"m":3,"t":0,"r":<r>,"g":<g>,"b":<b>,"cw":0,"ww":0}&brightness=<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: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python framework - Set Color - Brightness

Post by pipiche »

Nevertheless the Brightness is not reaching the python plugin Framework which is our problem ?

SO imagine you have a Domoticz Widget created as an RGBWWZ Type, the brightness part is not coming to the onCommand() callback function
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python framework - Set Color - Brightness

Post by waaren »

pipiche wrote: Tuesday 10 December 2019 21:49 Nevertheless the Brightness is not reaching the python plugin Framework which is our problem ?

SO imagine you have a Domoticz Widget created as an RGBWWZ Type, the brightness part is not coming to the onCommand() callback function
Can't you just use the sValue ? (is state aka level)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python framework - Set Color - Brightness

Post by pipiche »

waaren wrote: Tuesday 10 December 2019 21:55
pipiche wrote: Tuesday 10 December 2019 21:49 Nevertheless the Brightness is not reaching the python plugin Framework which is our problem ?

SO imagine you have a Domoticz Widget created as an RGBWWZ Type, the brightness part is not coming to the onCommand() callback function
Can't you just use the sValue ? (is state aka level)
Ok, let me explain.
You have an RGBWWZ device . In Domoticz you can set the 5 channels R G B CW WW and BR , then it is send to the Python Plugin Framework, so a python plugin get a call back on onCommand() and receive 4 parameters and nothing more:
Parameter 1 is the Unit (of the device)
Parameter 2 is the Command ( in that case 'Set Color')
Parameter 3 is the Level
Parameter 4 is the Color is a json format

For more information this is documented https://www.domoticz.com/wiki/Developin ... hon_plugin

Currently it looks like the Python Framework is only proving to the onCommand call back Color RGB,CW,WW,T,M but the brightness is omitted !
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python framework - Set Color - Brightness

Post by waaren »

pipiche wrote: Tuesday 10 December 2019 22:00 Parameter 3 is the Level
If this isn't the sValue of the device do you know what it is ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python framework - Set Color - Brightness

Post by pipiche »

waaren wrote: Tuesday 10 December 2019 22:20
pipiche wrote: Tuesday 10 December 2019 22:00 Parameter 3 is the Level
If this isn't the sValue of the device do you know what it is ?
I’m afraid we are not talking to the same thing.

I’m talking about a plugin developed in python and the issue is when the plugin get the onCommand() call back.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python framework - Set Color - Brightness

Post by waaren »

pipiche wrote: Thursday 12 December 2019 22:57 I’m afraid we are not talking to the same thing.
Probably a language thing but I just want to understand what this Level parm is. Where does it come from and what is it used for ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python framework - Set Color - Brightness

Post by pipiche »

waaren wrote: Thursday 12 December 2019 23:06
pipiche wrote: Thursday 12 December 2019 22:57 I’m afraid we are not talking to the same thing.
Probably a language thing but I just want to understand what this Level parm is. Where does it come from and what is it used for ?
When from the DOmoticz UI you change the Level ( Dimmer ) , this is refelected into the Python Plugin Framework into a callback function onCommand() which is called with 4 parameters:
Parameter 1 is the Unit (of the device)
Parameter 2 is the Command ( in that case 'Set Color')
Parameter 3 is the Level
Parameter 4 is the Color is a json format

Now how the Level is calculated/computed this is into the Python Framework code and I have no clue. Is that reflecting the Brightness I'm not sure if you have a RGBWWZ subtype.
Post Reply