Page 1 of 1
If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 18:49
by dalhoj
Hi I'm trying to make a Blockly where when I press a button, first it turns on a lamp at 90% then next time i push the button it goes to 10% and 3. time I push the button it set the lamp to 0%
Then pushbutton has a auto off, so when I push it, it turns on.
But it dont seem to work, can you see what is wrong?
Regards
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 18:55
by HBrandt
I tried something similar with Philips hue. Don't know what lamps you have. But with Philips hue I cold only activate scenes created in the hue app, not set level direct.
Mvh Henrik
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 19:21
by sisaenkov
Blocky can't check dimmer's level. It is only for setting level by Do action.
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 19:52
by dalhoj
Ahh OK, maybe we can hope for this in the future
and for the record i'm I using the Fibaro RGBW and the Fibaro Dimmer 2
Regards
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 20:35
by Egregius
This s possible with a script.
I use a remote in the bedroom:
First press = dimmer to 17%
Second press = dimmer to 13 % and set home to sleep mode
Third press = dimmer to 10% and slowly dim to off, each minute a percent darker.
Code: Select all
function remoteslapen(){global $a,$s,$i;
if($a=="On"){
$kamer=filter_var($s['kamer'],FILTER_SANITIZE_NUMBER_INT);
if($s['slapen']=='Off'&&$kamer!=16)sl($i['kamer'],17);
elseif($s['slapen']=='Off'&&$kamer==16){sl($i['kamer'],13);minihall1s();}
elseif($s['slapen']=='On'&&$kamer==12){sl($i['kamer'],11);cset('dimmerkamer',1);}
}else minihall3s();}
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 20:45
by Derik
Egregius wrote:This s possible with a script.
I use a remote in the bedroom:
First press = dimmer to 17%
Second press = dimmer to 13 % and set home to sleep mode
Third press = dimmer to 10% and slowly dim to off, each minute a percent darker.
Code: Select all
function remoteslapen(){global $a,$s,$i;
if($a=="On"){
$kamer=filter_var($s['kamer'],FILTER_SANITIZE_NUMBER_INT);
if($s['slapen']=='Off'&&$kamer!=16)sl($i['kamer'],17);
elseif($s['slapen']=='Off'&&$kamer==16){sl($i['kamer'],13);minihall1s();}
elseif($s['slapen']=='On'&&$kamer==12){sl($i['kamer'],11);cset('dimmerkamer',1);}
}else minihall3s();}
mmm New feature for me...
Please a short how to?
Lua?
Or?
How to activate?
THANKS!!
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 20:47
by Derik
The level check in Blockley do i mis to..
Hope someone can build this function into blockley..
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 21:08
by tozzke
You also could use a variable. You'll get something like:
Code: Select all
If A == On and B == Off and 'var C' == 0
Do Set B = level (%) 90
Set 'var C' = 90
Elseif A == On and B != Off and 'var C' == 90
Do Set B = level (%) 10
Set 'var C' = 10
Elseif A == On and B != Off and 'var C' == 10
Do Set B = Off
Set 'var C' = 0
Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 21:30
by Egregius
Derik wrote:
mmm New feature for me...
Please a short how to?
Lua?
Or?
How to activate?
THANKS!!
Search for lua pass2php
Or click my signature

Re: If Dimmer = Level xx% Then ....
Posted: Monday 21 November 2016 21:47
by dalhoj
maybe I should try Lua, I have not started on that jet. The reason I left Vera was because of Blockly.
So would this work:
Code: Select all
commandArray = {}
Button = ‘Test 4 Tryk_Knap_1’;
Dimmer = ‘TV_Stue_RGBW_Højre Højtaler’;
if devicechanged[Button] then
if(devicechanged[Button]==‘On’) and (devicechanged[Dimmer]==‘0’) then
commandArray[‘Dimmer’]=’90’;
end
if devicechanged[Button] then
if(devicechanged[Button]==‘On’) and (devicechanged[Dimmer]==‘90’) then
commandArray[‘Dimmer’]=’10’;
end
if devicechanged[Button] then
if(devicechanged[Button]==‘On’) and (devicechanged[Dimmer]==‘10’) then
commandArray[‘Dimmer’]=’0’;
end
return commandArray
regards