LightWaveRF Dimming Percentage

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post
Post Reply
jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

LightWaveRF Dimming Percentage

Post by jaminben » Monday 12 December 2016 23:39

Hello,

Version: 3.5877
Build Hash: 15b013c
Compile Date: 2016-11-10 15:44:33
Platform: Windows 10

When setting the dimming level of my LightWaveRF devices via an RFX433 unit in percentages it appears that it sets the wrong value.... for instance if I set 10% it'll set 28% instead.

http://ipaddress/json.htm?type=command& ... =10percent

Many Thanks

Ben

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Tuesday 13 December 2016 9:57

that could be, as it does not have 100 dim levels, i think 16, so it is rounded to the nearest level
You should see this when you move the slider in the web gui
Quality outlives Quantity!

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Tuesday 13 December 2016 13:48

gizmocuz wrote:that could be, as it does not have 100 dim levels, i think 16, so it is rounded to the nearest level
You should see this when you move the slider in the web gui
So the calculation Domoticz is doing is wrong?.. 16 \ 100 * 10 = 1.6 rounded to 2 should be 12.5% and not 28% if my math is correct which it may very well not be :?

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Tuesday 13 December 2016 18:50

Please, i said it could be 16, could also be 31, you can find this in the manual or looking through the source
Quality outlives Quantity!

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Tuesday 13 December 2016 19:21

gizmocuz wrote:Please, i said it could be 16, could also be 31, you can find this in the manual or looking through the source
Ok, I've looked through the manual and can't see any reference to a default value and I don't have the skills to look through the source.

Probably best to wait for a dev to make a comment rather than guessing.

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Tuesday 13 December 2016 20:52

hmmm, this is an open 'source' project
Found it... 32 steps
Quality outlives Quantity!

User avatar
StanHD
Posts: 531
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: LightWaveRF Dimming Percentage

Post by StanHD » Tuesday 13 December 2016 21:34

Within the HA Bridge you can use math replacement constructs like this: ${intensity.math(X/7)}
It's a crude work-around but gives an approximate correction over the range. (Apologies to Devs but I'm not a coder)
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, Broadlink RM2, HA-Bridge with Amazon Echo / Alexa.

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Tuesday 13 December 2016 22:01

gizmocuz wrote:hmmm, this is an open 'source' project
Found it... 32 steps
Is it a bug or not?
StanHD wrote:Within the HA Bridge you can use math replacement constructs like this: ${intensity.math(X/7)}
It's a crude work-around but gives an approximate correction over the range. (Apologies to Devs but I'm not a coder)
Many thanks , I'll give that a shot :D

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Tuesday 13 December 2016 23:26

I've done more testing with a dummy dimmable LightWave device with the following results:
Spoiler: show

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=100percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=90percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=80percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=70percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=60percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=50percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=40percent
would equal 96%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=30percent
would equal 90%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=20percent
would equal 59%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=10percent
would equal 28%

Code: Select all

http://ipaddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=5percent
would equal 12%
Where as using the same HTTP with a Hue device I get more or less the value I would expect (Set 40% = 39%, Set 60% = 59% etc.)

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Wednesday 14 December 2016 9:38

Thats because the hue (or zwave, and others) have 100 steps
Quality outlives Quantity!

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Wednesday 14 December 2016 9:44

Also the level should be between 0 and 31, and should also not include the word percent
When you debug json commands, 99% of the time they are already made/tested before in the web interface
In this case, you could add a dummy hardware, from the light/switches pages add a manual lightwaverf light as dimmer,
then open the 'chrome' developer console, goto the network tab, then operate the dimmer
now you see the json commands
Quality outlives Quantity!

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Wednesday 14 December 2016 10:19

Ok, so I see the command in chrome developer console is (set using 50% from the percentage scale):

Code: Select all

json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=17
So it's not actually a percentage as I originally thought.

Am I correct in thinking then that I can't set a raw percentage but I've got to use StanHD's example of ${intensity.math(X/7)} and calculate it?

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Wednesday 14 December 2016 10:24

yes, it's not a percentage (it looks like a percentage for zwave dimmers because they go from 0-100)
if you query the light status via json, you also get the max. dim level steps (in this case 31 or 32)
so your value should be

(31/100.0f)*dimpercentage
Quality outlives Quantity!

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Wednesday 14 December 2016 10:40

gizmocuz wrote:yes, it's not a percentage (it looks like a percentage for zwave dimmers because they go from 0-100)
if you query the light status via json, you also get the max. dim level steps (in this case 31 or 32)
so your value should be

(31/100.0f)*dimpercentage
Cool, thank you for being patient with me... will try this when I get home tonight :D

jaminben
Posts: 13
Joined: Saturday 10 December 2016 0:57
Target OS: Windows
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by jaminben » Wednesday 14 December 2016 19:00

Many Thanks to both gizmocuz and StanHD... it's working as expected now :)

Code: Select all

http://IpAddress/json.htm?type=command&param=switchlight&idx=70&switchcmd=Set%20Level&level=${intensity.math(X/7.5)})

madrian
Posts: 191
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: LightWaveRF Dimming Percentage

Post by madrian » Wednesday 11 January 2017 18:04

Maybe someone can help me there. I am trying to use LightWaveRF dimmer in "new frontpage.html skin", bu it is not implemented.

For minus button I used the following formula: var d = Math.round((level / 100.0) * 32); //where level is item["LevelInt"].

This works, but I have no idea about plus button (increase value), the original formula is:

var d = ((level + 10)/100 * 16) + 0.5;

..but this is for 1-16 dimmers.

Code: Select all

//Dimmer, only works with 1-16 dimmer for now
function ChangeStatus(OpenDicht,level,idx,currentlevel)
	{
	//When switched off return to previous level, no matter if plus or min pressed
	if (level == txt_off) {
		if (currentlevel == 1) {
			currentlevel++;
		}
		//console.log("In uit",currentlevel);
		$.ajax({
		url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + currentlevel,
		async: false,
		dataType: 'json',
		success: function(){
		console.log('SUCCES');
		},
		error: function(){
		console.log('ERROR');
		}
		});
	}
	else {
		level = level * 1;
		console.log(OpenDicht,level);
		if (OpenDicht == "plus")
			{
				//not working
			var d = ((level + 10)/100 * 16) +  0.5;
			
			console.log("in plus",d,level);
			if(d > 32) {
				d = 32;
			}
			$.ajax({
			url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + d,
			async: false,
			dataType: 'json',
			success: function(){
			console.log('SUCCES');
			},
			error: function(){
			console.log('ERROR');
			}
			});
		}
		else {
			var d = Math.round((level / 100.0) * 32);
			console.log("in min",d,level);
			if( d < 0 ){
				d = 0;
			}
			$.ajax({
			url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + d,
			async: false,
			dataType: 'json',
			success: function(){
			console.log('SUCCES');
			},
			error: function(){
			console.log('ERROR');
			}
			});
		}
	}
	RefreshData();
	}

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: LightWaveRF Dimming Percentage

Post by gizmocuz » Thursday 12 January 2017 8:53

i think it could be

d = (32/100)*level
Quality outlives Quantity!

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests