If Dimmer = Level xx% Then ....

Moderator: leecollings

Post Reply
dalhoj
Posts: 6
Joined: Thursday 15 September 2016 19:48
Target OS: -
Domoticz version:
Contact:

If Dimmer = Level xx% Then ....

Post 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.

Image

But it dont seem to work, can you see what is wrong?

Regards
HBrandt
Posts: 8
Joined: Tuesday 15 November 2016 22:54
Target OS: -
Domoticz version:
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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
User avatar
sisaenkov
Posts: 50
Joined: Friday 27 May 2016 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8
Location: Moscow, Russia
Contact:

Re: If Dimmer = Level xx% Then ....

Post by sisaenkov »

Blocky can't check dimmer's level. It is only for setting level by Do action.
dalhoj
Posts: 6
Joined: Thursday 15 September 2016 19:48
Target OS: -
Domoticz version:
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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
User avatar
Egregius
Posts: 2589
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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();}
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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!!
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: If Dimmer = Level xx% Then ....

Post by Derik »

The level check in Blockley do i mis to..
Hope someone can build this function into blockley..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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
User avatar
Egregius
Posts: 2589
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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 ;)
dalhoj
Posts: 6
Joined: Thursday 15 September 2016 19:48
Target OS: -
Domoticz version:
Contact:

Re: If Dimmer = Level xx% Then ....

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest