Changes

Jump to navigation Jump to search
3,326 bytes added ,  11:36, 20 December 2008
m
Please do not sign, credits/modifications can be reviewed thruogh the history pages.
Line 1: Line 1:  +
==Heyu Overview==
 +
{{Level|Medium}}
 +
 
===Description===
 
===Description===
 
Heyu is a driver and control program for managing Power Line Interface Modules such as those made by X10. This program is only useful if you have such a module connected to your server. Note that while there are alpha level quality drivers for the USB versions (e.g. CM15) the drivers and links below relate to the serial port versions (such as the CM11a).
 
Heyu is a driver and control program for managing Power Line Interface Modules such as those made by X10. This program is only useful if you have such a module connected to your server. Note that while there are alpha level quality drivers for the USB versions (e.g. CM15) the drivers and links below relate to the serial port versions (such as the CM11a).
Line 13: Line 16:  
http://heyu.tanj.com/heyu_links.html
 
http://heyu.tanj.com/heyu_links.html
   −
Neil Cherry's  
+
Neil Cherry's Home Automation website contains a wealth of information about X10 and newer automation technologies.
    
http://www.linuxha.com/
 
http://www.linuxha.com/
   −
 
+
==Installation Procedures==
===Credits===
  −
Initiated: [[User:Christian | Christian]] - created initial procedure and initiated wiki entry
  −
 
   
===Obtaining the software===
 
===Obtaining the software===
 
The software is available only in source form from:
 
The software is available only in source form from:
Line 29: Line 29:     
Expand the software:
 
Expand the software:
  gunzip heyu-2.3.2.tgz | tar -xvf -
+
  tar xvzf heyu-2.3.2.tgz
    
Enter the newly created directory (in this case heyu-2.3.2).
 
Enter the newly created directory (in this case heyu-2.3.2).
Line 42: Line 42:  
You will be asked for the serial port of your PLC module (e.g. my CM11a is on /dev/ttyS5).
 
You will be asked for the serial port of your PLC module (e.g. my CM11a is on /dev/ttyS5).
   −
When asked, you should choose to put the x10.conf file into /etc/heyu.
+
When asked, you should choose to put the x10.conf file into '''/etc/heyu'''. This will also serve as your "basedir" for state and schedule files used by heyu.
   −
The binary should have the path /usr/local/bin/heyu
+
The binary should have the path '''/usr/local/bin/heyu'''.
    
man pages will also be installed.
 
man pages will also be installed.
   −
Now let's clean up. you can remove the temporary directory where you created and compiled the heyu program.
+
Now let's clean up. You can remove the temporary directory where you created and compiled the heyu program.
    
You should also remove gcc:
 
You should also remove gcc:
 
{{Warning box|msg=Leaving gcc on a production server is considered a security risk, if you do not really need it you should not install it, if you need it you should seriously consider uninstalling gcc when you no longer need it. Removing gcc can be done using the following command:
 
{{Warning box|msg=Leaving gcc on a production server is considered a security risk, if you do not really need it you should not install it, if you need it you should seriously consider uninstalling gcc when you no longer need it. Removing gcc can be done using the following command:
 
  yum remove gcc}}
 
  yum remove gcc}}
      
===Configuring to start Automatically===
 
===Configuring to start Automatically===
 
Depending on how you plan to use Heyu, you may wish to have it start automatically on reboot. This would be necessary for example if you wish it to run scheduled timers.
 
Depending on how you plan to use Heyu, you may wish to have it start automatically on reboot. This would be necessary for example if you wish it to run scheduled timers.
   −
Lets make sure it starts if and when we reboot.
+
Tell heyu to start the heyu engine automatically on a start command by editing /etc/heyu/x10.conf and adding the line:
 +
START_ENGINE AUTO
 +
 
 +
Let's make sure it starts if and when we reboot.
 
  db configuration set heyu service status enabled  
 
  db configuration set heyu service status enabled  
 
  ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99heyu  
 
  ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99heyu  
Line 109: Line 111:  
   
 
   
 
     exit $RETVAL
 
     exit $RETVAL
 +
 +
===Initial Configuration===
 +
Don't forget to edit the '''/etc/heyu/x10.conf''' file to update things like your longitude and latitude and other useful settings.
 +
 +
Note that any changes made to x10.conf need to be re-read by heyu. The simplest way is to issue the following command from the command line:
 +
heyu restart
    
===Initial Launch===
 
===Initial Launch===
Start heyu
+
If you created the script to start Heyu automatically then you should Start Heyu via:
 
  /etc/rc.d/rc7.d/S99heyu start
 
  /etc/rc.d/rc7.d/S99heyu start
   Line 117: Line 125:  
  heyu monitor
 
  heyu monitor
    +
==Use via another application==
 +
===Overview===
 +
As given in the references, heyu is often used by higher level applications such as web application. In this case, it should be noted that the application's identity will be passed to heyu and thus certain resources may not be accessible to the application. For example, the serial port (e.g. ttyS5) normally has the ownership of user=root,group=uucp, and permission 0660. Normally heyu can access this because it runs as root.
 +
 +
If, however, you have a web application it may be running as www hence would not be able to have heyu access the serial port. Group membership or permissions can be adjusted as needed with consideration to the security implications of those changes.
 +
 +
===Changing permission on serial port===
 +
In the case of the serial port, you could either modify its ownership or its permissions. In this example, we will allow others to have read/write permission specifically on the serial port of interest (e.g. ttyS5). By default udev only allows user and group with read/write and other has no access.
 +
 +
The serial port's permissions and ownership are recreated dynamically on reboot by '''udev'''. So we need to modify udev's rules to achieve our objective. Specifically the directory /etc/udev/permissions.d/ contains the permissions and in SME the default permissions are in /etc/udev/permissions.d/50-udev.permissions.
 +
 +
We will add a template to specifically override the permissions for our serial port.
 +
mkdir -p /etc/e-smith/templates-custom/etc/udev/permissions.d/
 +
touch /etc/e-smith/templates-custom/etc/udev/permissions.d/41-udev.heyu.permissions
 +
Edit the new file above (41-udev.heyu.permissions) using an editor with the contents as follows:
 +
# special exception to allow heyu running under www to access the relevant
 +
# serial port
 +
ttyS5:root:uucp:0666
 +
Now expand the template and reboot to verify the changes worked
 +
expand-template /etc/udev/permissions.d/41-udev.heyu.permissions
 +
signal-event reboot
 +
 +
After reboot verify that only your serial port has been changed.
 +
 +
====Special notes====
 +
Udev follows permission rules in the order in which they appear. So the serial port rule is named to preceed the default set of permissions (hence 41 at the beginning of the file).
 +
 +
This procedure works for CentOS 4 (SME 7) but will change in CentOS 5 (SME 8) to use rules.d instead.
 +
 +
==Reference Information==
 
===Documentation===
 
===Documentation===
 
Heyu is very well documented and includes man pages. Start with:
 
Heyu is very well documented and includes man pages. Start with:
Line 132: Line 170:  
http://www.linuxha.com/athome/index.html#Software
 
http://www.linuxha.com/athome/index.html#Software
    +
===User experience===
 +
Users who have implemented this how-to should add their experiences as data points of success for others. Please sign your experience using four tildes (~).
   −
===User experience===
+
* Tested with SME Server 7.3 and X10's CM11a - Works ([[User:Christian|Christian]] 20:52, 13 October 2008 (UTC))
* Tested with SME Server 7.3 and X10's CM11a - Works
+
:: - Serial port is via a Lava Link 2 port serial card
    
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]

Navigation menu