-
Notifications
You must be signed in to change notification settings - Fork 131
ubuntuX10
- First a bit of background**
- Step 1**
//[15296.392214] usb 7-1: new full-speed USB device number 2 using uhci_hcd// //[15296.989777] usbcore: registered new interface driver usbserial// //[15296.989792] USB Serial support registered for generic// //[15296.989825] usbcore: registered new interface driver usbserial_generic// //[15296.989828] usbserial: USB Serial Driver core// //[15296.996948] USB Serial support registered for pl2303// //[15296.996979] pl2303 7-1:1.0: pl2303 converter detected// //[15297.008336] usb 7-1: pl2303 converter now attached to// **ttyUSB0** //[15297.008373] usbcore: registered new interface driver pl2303// //[15297.008378] pl2303: Prolific PL2303 USB to serial adaptor driver//
You can see it's found the device and it's name it **/dev/ttyUSB0**
Now you need to edit you mh.private.ini file and add a line to tell MisterHouse where it is.
//**root@mh_server:/#**// sudo nano /opt/misterhouse/mh.private.ini
Add the line
cm11_port = /dev/ttyUSB0
- Step 2**
As a bare minimum example, edit your items.mht file like this -
//**mh@mh_server:/#**// nano /opt/misterhouse/items.mht
code Format = A
- noloop=start
- Type Address Name Groups Other Info
- A Appliances
- noloop=stop
- Voice Commands
Format A is the only format available in MH currently. The noloop command exclude the code from the main run loop, don't worry about it for now. The critical line is this -
X10A, A1, Humidifier, Appliances|Downstairs|Living_Room
This defines an Appliance (as opposed to a lighting module), on X10 address A1, called Humidifier (because it's attached to one), that's in the Downstairs Living Room. As well as having defined that an X10 module exits, MH has now also started creating a floor level plan (which can be seen on the web service, but will look a mess as nothing else has been defined!)
Once you've restarted MisterHouse, this object will appear in many places on the web service. You should be able to find the controls and turn the humidifier on and off remotely, but this is only half the fun...
- Step 3**
//**mh@mh_server:/#**//nano /opt/misterhouse/code/x10_devices.pl
and add this code:
//# Category = X10// //#@ This module controls all the X10 switched equipment.//
//if (time_now '2:01 PM') {// //set $humidifier ON;// //speak "The humidifier is now on";// //}//
//if (time_now '11:01 PM') {// //set $humidifier OFF;// //speak "The humidifier is now on";// //}//
What this code does is as follows: The Category and the #@ line added extra text details that appear on the code selection page of the web service. The if(time_now) lines check the time, and if the time matches 2:01PM or 11:01PM (though this can be any time you need - just change the numbers) and it does, then it switches the humidifier on and off via the X10 controller. The speak command makes MH speak the message out of speakers attached to the MH box (or put around the house as many people have them) and logs the fact that the humidifier has been switched on or off. They are of course other ways of doing this, but this is just a rather verbose example.
To get this code to run you will been to restart MisterHouse. There is an option available just to reload the code, which will work in most cases, but as your code gets bigger, it's always best to restart MH to make sure everything is OK before you leave it for the night.
Now when 2:01PM rolls around, the humidifier should come on, and switch off again at 11:01PM.
[More]
Back: The .Ini file Return To Index