Table of Contents
Xtension allows you to create 'special-named' scripts. Simply creating a Global Script with these names causes XTension to execute them at their appointed times, or whenever certain system level events occur. The names of these scripts are specific, but not case sensitive. (no name in XTension is case sensitive) in addition to just typing them you can also select from a popup list of them in the New Global Script dialog when it's asking you for a name.
These Script Names are RESERVED for their respective intrinsic functions:
The AUXRemote script is specific to legacy X10 receiver support. This script was added to support the “MP3 remote” style remote controls that X10.com had released many years ago. Whenever an MR26 or other receiver that can receive these special wireless commands receives on this script is executed. Use the command verb to get a numeric code representing the button that was pushed. You can create a list of comparison statements to perform different actions based on that command variable.
If you create a global script of this name XTension will execute it every MINUTE.
It can be useful for monitoring certain functions or performing interface updates. For example I update a units description with the current time every minute and display that units description in Views and the WebRemote for a display of System time.
Init Interfaces Script
Executed whenever an interface is started up. If the interface requires some regular setup whenever it comes on line you can do that here. The ThisInterface verb will return the name of the specific interface being started up so you can check by name and send the proper settings. If your interface supports an AppleScript like the DIY interface then you can also put any startup settings into an “on init()” handler in that script and it will be called at the same time.
Interface Error Script
The Interface Error Script is executed in 2 different situations. If an interface cannot startup because of a missing serial port or a remote device not accepting a connection it will disconnect and retry every 5 seconds. The default for retries is 10 times but you can adjust that by changing the “retries” property of the xInterface class for the specific interface you’re using. If the retries are exhausted and the interface remains unconnected this script will be run with thisInterface set to the name of the interface that has failed. You can use this to make some changes and re-enable the interface automatically or to send yourself an alert email or iPhone alert.
The second time this script will be run is if the interface sends us an error saying that a unit has not responded. Not all interfaces support the ability to know if a unit was unavailable. This may be most useful for modern interfaces like the Vera which use 2-way protocols. There is no way that an X10 interface could know if a device had received it’s command or not. In the case of a Vera unit not responding to a command this script will be called with thisInterface set to the name of the interface and thisUnit set to the name of the unit that is having a problem.
This script is called whenever it is known that a power fail has occurred. This script originated with the Lynx interface as it would send a specific message when it lost power. This interface is no longer available but when XTension notices that an interface is not responding it will guess that the power has gone out to that interface and run this script. With interfaces other than the Lynx though it may take some time for XTension to be able to be sure the interface is offline and you will not be able to get a reading on short outages. This script is only supported for X10 interfaces like the Lynx and the CM11/CM15.
You can get much better reliability here if you have a Mac compatible UPS by using the UPS Interface.
Script Error Alert
Added in XTension version 9.3.8 this special script will be executed if any other script that is run in the program has an error. Use the Last Error Message verb to get the text of the error that will also be written to the log. The globals ThisInterface, ThisUnit and ThisScript will be set to the name of the unit, interface or global script names that had the script error. In this script you can send yourself an email or prowl alert to let yourself know that some script is not working as you expected.
Obviously if a script error occurs inside the Script Error Alert script it will not be run again…
Startup Script/Shutdown Script
On starting up, XTension will automatically execute the Startup Script, and conversly, the Shutdown Script is executed anytime that you quit nicely out of XTension.
Obviously you might want to always check things out or set up units into some known state on startup.
On shutdown you might want to 'safe' some units or transfer control to another system.
These two scripts must be created as 'global' scripts. They must be named precisely as above.
These script names are reserved for suntime events. See also Suntimes.
This script is only supported with Legacy X10 controllers.
In order to catch all lights on, all lights/units off commands from X10 receivers you need to create a global script with the name DoAll. and the letter of the housecode you wish to catch. DoAll.A for housecode A for instance. That script will be run when that housecode all units command is received. You can then check the ThisInterface value to see from which interface it was received and also the “command” verb to see exactly which command it was that was received.