SBoyle.com

Home Automation

Home

Overview Hardware Software Applications

Download

Contact

 

ACE
ACEUpdater.pl

 
ACEUpdater.pl

[ General ]   [ Setting up the macro ]   [ Writing the config file ]

Here's a sample XML config file for ACEUpdater:
Sample XML file

<SystemConfig>
	<ACECOMpw>1234</ACECOMpw>
	
	<SecurityConfig>
		<HeaderText>SECUPDATE:</HeaderText>
		<HVSecMacroHex>42</HVSecMacroHex>

		<position index="0" label="S-Part1">
			<command value="0">
				<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,33023</ACE>
			</command>
			<command value="1">
				<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,51758</ACE>
			</command>
			<command value="2">
				<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,8404992</ACE>
			</command>
			<command value="3">
				<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,255</ACE>
			</command>
		</position>
		
		<position index="Default">
			<command value="0">
				<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,1,0</ACE>
			</command>
			<command value="1">
				<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,0,0</ACE>
			</command>
			<command value="2">
				<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,0,0</ACE>
			</command>
		</position>
		
		<position index="2"  label="S-Zone1" ></position>
		<position index="3"  label="S-Zone17"></position>
	</SecurityConfig>

	<X10Config>
		<DimDefaultsToOn value="yes"/>
		
		<address value="Default">
			<command value="on" >
				<ACE>ACEC:0:BTNPIC:$label,-1,-1,Lighton.ico</ACE>
			</command>
			<command value="off" >
				<ACE>ACEC:0:BTNPIC:$label,-1,-1,Lightoff.ico</ACE>
			</command>
		</address>
		
		<address value="l5"  label="L-Foyer"   ></address>
		<address value="l1"  label="L-LivBack" ></address>
		<address value="l3"  label="L-LivFront"></address>
		
		<address value="l6"  label="L-Office">
			<command value="on">
				<ACE>Default</ACE>
				<ACE>ACEC:0:BTNPIC:L-Spot,-1,-1,spoton.ico</ACE>
			</command>
			<command value="off" >
				<ACE>Default</ACE>
				<ACE>ACEC:0:BTNPIC:L-Spot,-1,-1,spotoff.ico</ACE>
			</command>
		</address>
	</X10Config>
</SystemConfig>
I'll break that down a bit:

<SystemConfig>

The opening tag for the config file.

<ACECOMpw>1234</ACECOMpw>

This is the DCOM password that you've setup for ACE. If you haven't set a password this can be any four digit number.

<SecurityConfig>

This is the beginning of the security configuration section.

<HeaderText>SECUPDATE:</HeaderText>

This is the header that the script will look for to identify security update messages from HV.  This should be the first bit of text your HV macro transmits.

<HVSecMacroHex>42</HVSecMacroHex>

This is the macro number, in hex [sorry], that you've setup to send the security update message.

<position index="0" label="S-Part1">
	<command value="0">
		<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,33023</ACE>
	</command>
	<command value="1">
		<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,51758</ACE>
	</command>
	<command value="2">
		<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,8404992</ACE>
	</command>
	<command value="3">
		<ACE>ACEC:0:BTN:$label,-1,-1,-1,1,-1,255</ACE>
	</command>
</position>

A position element. You'll have one [and only one] of these elements for each character after the final character in your header text. The first character has an index of 0, the second 1, the third 2. Contained in the position element are multiple command elements. You'll have one of these [again only one] for each possible value each position can have. My first position represents partition 1 of my security system. It can have four different values 0 for Ready, 1 for Not Ready, 2 for Armed Away, 3 for Armed Home. Under the command value is an ACE element. This encloses text that the script will send to ACE when that position has that value. If you feel like it, go crazy with these -- you can have as many ACE elements under each command element as you want and all of them will be sent.

You'll notice that this position element has an additional attribute besides the required index attribute. These extra attributes ACEUpdater treats as variables and tries to replace them in your command strings. Using the above XML as an example, if the script received the message SECUPDATE:0 from HV it would replace the $label in the first command and send it to ACE. So the script would send:

ACEC:0:BTN:S-Part1,-1-1-11,-1,33023

You can define as many of the attribute/variables as you like. Just put a '$' in front of the attribute name and place it in your command string. This feature is extremely handy when used with the new label feature of ACE Client buttons.

<position index="Default">
	<command value="0">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,1,0</ACE>
	</command>
	<command value="1">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,0,0</ACE>
	</command>
	<command value="2">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,-1,-1,0,0</ACE>
	</command>
</position>
		
<position index="2"  label="S-Zone1" ></position>
<position index="3"  label="S-Zone17"></position>
      

This is a position element with the special index of Default, and another position element taking advantage of the default command set feature. You can define one default set of commands in the security section. Any other position element in the section that contains no command elements will pull in the default set automatically. But here's the trick: you can put variable tokens [like $label] in your default commands and when other positions use them they'll substitute their own values for the variables. This makes it possible to write very small config files if you have a lot of similar commands.

<X10Config>

The beginning of the X-10 configuration section.

<DimDefaultsToOn value="yes"/>

If the value attribute of DimDefaultsToOn is set to yes, and a configured address does not have a dim command defined in its command set, then the script will execute the on commands for that address even if HV reports the status of that address as dim. Read that a couple of times and it will make sense. Simply put, if you're not going to define dim commands for your lights then set this to yes so that the on command will be run even if the light isn't fully on. Even if you are going to define dim commands for some of your lights, set this to yes so that the on command will run for the other lights that don't have a dim command defined. [Ok, so that wasn't so simple.]

<address value="Default">
	<command value="on">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,Lighton.ico</ACE>
	</command>
	<command value="off">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,Lightoff.ico</ACE>
	</command>
</address>

<address value="l5"  label="L-Foyer"   ></address>
<address value="l1"  label="L-LivBack" ></address>
		

Just like the security section, the X-10 section can have a default command set. Since HV has a built in status message for X-10 objects you don't have to [or get to] define you own values. The script currently supports four values for the X-10 command element: neutral, on, off, and dim. These states correspond to the states used by HV in the X-10 Control Grid [with dim encompassing all dim values from 1 to 99]. Here I've defined the commands I use for most of my lights -- display the Lighton.ico for lights that are on, and the Lightoff.ico for lights that are off. You can take advantage of the default for X-10 address just like you do in the security section: supply an address element with no command elements inside of it.

<address value="l6"  label="L-Office">
	<command value="on">
		<ACE>Default</ACE>
		<ACE>ACEC:0:BTNPIC:L-Spot,-1,-1,spoton.ico</ACE>
	</command>
	<command value="off" >
		<ACE>Default</ACE>
		<ACE>ACEC:0:BTNPIC:L-Spot,-1,-1,spotoff.ico</ACE>
	</command>
</address>
      

This is a standard address element. The value attribute should be set to the X-10 address [use lower case letters for the house code]. The format is similar to that used in the security section, and all of the attribute/variable tricks work the same way. Here I wanted to send another command in addition to the default command I send for all of my other lights. Notice the <ACE>Default</ACE> tag. The reason this is there is because, for this light, I wanted to run these commands in addition to the commands in the default set. Because this address element isn't empty no default commands will be pulled in for any command values. Once you define even one command for an address you have to ask for the default for all of them [if you want it]. Let's say I only wanted to run an additional command for the on state, but use only the default for off, I'd have to do this:

<address value="l6"  label="L-Office">
	<command value="on">
		<ACE>Default</ACE>
		<ACE>ACEC:0:BTNPIC:L-Spot,-1,-1,spoton.ico</ACE>
	</command>
	<command value="off" >
		<ACE>Default</ACE>
	</command>
</address>
      

This behavior also applies to the security section. And finally:

      	</X10Config>
</SystemConfig>
		

Make sure you close all of your tags as XML is picky about that. Also, pay attention to case. Case matters in element and attribute names, and variable tokens.

<ACE>Default</ACE> and <ACE>default</ACE>

Are equivalent.

<ACE>Default</ACE> and <ace>Default</ace>

Are not, and the latter won't work. Neither will this:

<address value="l6"  LABEL="L-Office">
	<command value="on">
		<ACE>ACEC:0:BTNPIC:$label,-1,-1,spoton.ico</ACE>
	</command>
</address>

When in doubt, follow the example XML file and keep your case consistent.