User Tools

Site Tools


xtension_manual:specialscripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
xtension_manual:specialscripts [2014/01/29 15:53] – external edit 127.0.0.1xtension_manual:specialscripts [2023/02/13 14:52] (current) – external edit 127.0.0.1
Line 4: Line 4:
 These Script Names are RESERVED for their respective intrinsic functions: These Script Names are RESERVED for their respective intrinsic functions:
  
-====Startup Script/Shutdown Script==== +====AUXRemote==== 
-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. +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 [[supported_hardware:mr26|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.
- +
-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 ,ust be named precisely as above.+
  
 ====Idle Script==== ====Idle Script====
-This name is reserved for the IDLER. If you create a global script of this name XTension will execute it every MINUTE.+If you create a global script of this name XTension will execute it every MINUTE.
  
-It can be useful for monitoring certain functions, however you should be careful about not putting things in it that would cause lot of processing every minute.+It can be useful for monitoring certain functions or performing interface updates. For example I update units description with the current time every minute and display that units description in Views and the WebRemote for a display of System time.
  
 Global Scripts can also be executed via [[:manual:scheduledevents|Scheduled Events]].\\ Global Scripts can also be executed via [[:manual:scheduledevents|Scheduled Events]].\\
 See also the [[:dictionary:xtension:startidler|Start Idler]] verb. See also the [[:dictionary:xtension:startidler|Start Idler]] verb.
  
-====Sunrise/Sunset=== +====Init Interfaces Script==== 
-These script names are reserved for suntime eventsSee also [[:manual:suntimes|Suntimes]].+Executed whenever an interface is started upIf the interface requires some regular setup whenever it comes on line you can do that here. The [[dictionary:xtension:thisinterface|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 [[supported_hardware:diy|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.
  
-====Errors Script==== +====Interface Error Script==== 
-This script is called whenever significant error occurs.+The Interface Error Script is executed in 2 different situations. If an interface cannot startup because of 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 [[dictionary:xtension:thisinterface|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 [[tutorials:prowl|iPhone alert]]
  
-Before it is called, XTension sets global variable which can be tested by the Errors Script**Last Error**+The second time this script will be run is if the interface sends us an error saying that 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 [[supported_hardware:vera|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.
  
-====AUXRemote==== +====Power Fail==== 
-This script is called whenever a command comes in via the MR26 or other receiver that is encoded as "MP3 remote" type of command.+This script is called whenever it is known that power fail has occurred. This script originated with the [[:supported_hardware:lynx|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 reading on short outages. This script is only supported for X10 interfaces like the Lynx and the CM11/CM15.
  
-This is particularly useful with the X-10 "MP3" wireless remote (UR51A) which sends over 50 unique button commands.+You can get much better reliability here if you have a Mac compatible UPS by using the [[supported_hardware:ups|UPS Interface]].
  
-Whenever XTension detects a "MP3" type command from the receiver it will look for a global script named "AUXRemote".+====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.
  
-If you have created such a script it will be executedBefore calling the script XTension sets the special variable **command** to the button number from the UR51A.+Obviously if script error occurs inside the Script Error Alert script it will not be run again...
  
-You can serve any of those buttons with commands and ignore any that you dont need. 
  
-This is a great way to add up to 50 macros to your remote control system without having to dedicate database units and X-10 addresses!+====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.
  
-====Power Fail==== +Obviously you might want to always check things out or set up units into some known state on startup. 
-This script is called whenever it is known that a power fail has occurredThis script originated with the [[:supported_hardware:lynx|Lynx]] interface as it would send a specific message when it lost powerThis 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. You can get much better reliability here if you have a Mac compatible UPS by using the [[http://www.sentman.com/UPS_Monitor.html|UPS Monitor Plugin]]+ 
 +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. 
 + 
 + 
 +====Sunrise/Sunset=== 
 +These script names are reserved for suntime eventsSee also [[:manual:suntimes|Suntimes]].
  
  
 ====DoAll.X==== ====DoAll.X====
 +
 +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. 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.
xtension_manual/specialscripts.1391010793.txt.gz · Last modified: 2023/02/13 14:51 (external edit)