Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: IRLinc Dimmable/NonDimmable Light Control Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: January 21 2009 at 14:53 | IP Logged Quote Viper

Below are two macros and associated triggers that I created to control dimmable and non-dimmable lights via an IRLinc. The reason I created this code is that the same lights are controlled by other switches and I wanted the IRLinc to correctly manipulate the light every time I pressed a button. It appears that IRLinc keeps a "on/off" and "dim/bright" state of its own which may or may not reflect the state of the device being controlled. So 50% of the time, the first command from the IRLinc is ignored as the device is already in that state.

The code is for PH V2.1b.

To use this, link the IRLinc group to your PLM and link the devices in your scene/light to a group of the PLM. You need a separate trigger, IRLinc Group, and PLM Group for each scene/light you want to control. A single copy of the macros can be used for all scenes/lights.

IRLINC DIMMABLE GROUP macro:
insert into macroheader values ('IRLINC DIMMABLE GROUP','IRLinc Dimmable Group',0,0,1);
insert into macrodetail values ('IRLINC DIMMABLE GROUP',1,16,'',NULL,'if ([TEMP9] < 20, 1, 4)',0,'');
insert into macrodetail values ('IRLINC DIMMABLE GROUP',2,15,'[LOCAL10]',NULL,'ph_getinsteonlevel("[LOCAL2]") + if("[LOCAL3]" = "0", 0, ph_getinsteonlevel("[LOCAL3]")) + if("[LOCAL4]" = "0", 0, ph_getinsteonlevel("[LOCAL4]")) + if("[LOCAL5]" = "0", 0, ph_getinsteonlevel("[LOCAL5]"))',0,'');
insert into macrodetail values ('IRLINC DIMMABLE GROUP',3,38,'',0,'ph_insteongroup("[LOCAL1]", if([LOCAL10] = 0, 17, 19), 0)',0,'');
insert into macrodetail values ('IRLINC DIMMABLE GROUP',4,39,'',NULL,'',0,'');
insert into macrodetail values ('IRLINC DIMMABLE GROUP',5,38,'',0,'ph_insteongroup("[LOCAL1]", [TEMP9], if([TEMP9] = 23, if(ph_getinsteonlevel("[LOCAL2]") > 127, 0, 1), 0))',0,'');
insert into macrodetail values ('IRLINC DIMMABLE GROUP',6,38,'',0,'',0,'');

IRLINC DIMMABLE GROUP trigger:
insert into triggers values ('IRLINC END TABLES','IRLinc End Tables','ph_macroparm("IRLINC DIMMABLE GROUP", "END TABLES", "LIV RM LAMP LEFT", "LIV RM LAMP MID", 0, 0)',16,'SCENE CONTROLLER',8,-1,'1',1,0,2);

Change the trigger above as follows:
IRLINC END TABLES = name of the trigger (Change to be meaningful for you)
IRLinc End Tables = description of trigger (Change to be meaningful for you)
IRLINC DIMMABLE GROUP = macro name (Leave as is)
END TABLES = PLM Group (Match PLM Group you define)
"LIV RM LAMP LEFT" = First device. The level of this device is used during dimming/brightening to determine whether to dim or brighten. The status of this device and the other three devices is used to determine whether to turn the lights on or off.
"LIV RM LAMP MID" = Second device. The status of this device and the other three devices is used to determine whether to turn the lights on or off.
0 = Third device. The status of this device and the other three devices is used to determine whether to turn the lights on or off.
0 = Fourth device. The status of this device and the other three devices is used to determine whether to turn the lights on or off.
SCENE CONTROLLER = Name of the IRLinc (Change to match yours)
8 = IRLinc Group to listen for.

IRLINC NONDIMMABLE GROUP macro:
insert into macroheader values ('IRLINC NONDIMMABLE GROUP','IRLinc Nondimmable Group',0,0,1);
insert into macrodetail values ('IRLINC NONDIMMABLE GROUP',1,16,'',NULL,'if([TEMP9] = 24, 9999, 1)',0,'');
insert into macrodetail values ('IRLINC NONDIMMABLE GROUP',2,15,'[LOCAL10]',NULL,'ph_getinsteonlevel("[LOCAL2]") + if("[LOCAL3]" = "0", 0, ph_getinsteonlevel("[LOCAL3]")) + if("[LOCAL4]" = "0", 0, ph_getinsteonlevel("[LOCAL4]")) + if("[LOCAL5]" = "0", 0, ph_getinsteonlevel("[LOCAL5]"))',0,'');
insert into macrodetail values ('IRLINC NONDIMMABLE GROUP',3,38,'',0,'ph_insteongroup("[LOCAL1]", if([LOCAL10] = 0, 17, 19), 0)',0,'');

IRLINC NONDIMMABLE GROUP trigger:
insert into triggers values ('IRLINC KITCHEN','IRLinc Kitchen','ph_macroparm("IRLINC NONDIMMABLE GROUP", "KITCHEN LIGHTS", "KITCHEN CEILING LIGHTS S", "KITCHEN SOFFIT LIGHTS", 0, 0)',16,'SCENE CONTROLLER',7,-1,'1',1,0,2);

Change the trigger above as follows:
IRLINC KITCHEN = Trigger Name (Change to something meaningful for you)
IRLinc Kithcen = Trigger Description (Change to something meaningful for you)
IRLINC NONDIMMABLE GROUP = Macro name (Leave as is)
KITCHEN LIGHTS = PLM Group to control
KITCHEN CEILING LIGHTS S = First device. The state of this device and the other three devices determine whether to turn the lights on or off.
KITCHEN SOFFIT LIGHTS = Second device. The state of this device and the other three devices determine whether to turn the lights on or off.
0 = Third device. The state of this device and the other three devices determine whether to turn the lights on or off.
0 = Fourth device. The state of this device and the other three devices determine whether to turn the lights on or off.
SCENE CONTROLLER = Name of the IRLinc (Change to match yours)
7 = IRLinc Group to listen for.

The number of devices tested for on/off status is limited to four and the number of devices tested for dim level is just the first device. However, the macros can control far more devices because the devices are all part of PLM group.

Two additional macros and associated triggers could be created that deal with single devices and avoid having to create the PLM Groups. I don't know if this would be a better solution or not.

Tom

Edited by Viper - January 21 2009 at 15:14
Back to Top View Viper's Profile Search for other posts by Viper
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum