From: <tho...@we...> - 2006-06-23 05:43:39
|
Thank's. i didn't thought that creating own items is so simple. i will ty it at home at weekend , but first we had to do some barbeque with= our neighbours to celebrate our third year living in our new house. (it's called in german 1. Spatenstich) Everyone have a nice weekend, Thorsten. =20 >Oh, > >forget to mention that the web page to list your Lueftungs would be >/bin/list_buttons.pl?Lueftung_Item. You can add this link to any menu you >like. As a Lueftung is neither an X10_Appliance nor an X10_Item, it won't >appear in the default ia5 menus. > >Matt > >Matthew Williams wrote: >> Thorsten, >>=20 >> The page that you are talking about is generated by >> mh/web/bin/list_buttons.pl. If you want to have your custom states list= ed, >> then you will have to: >>=20 >> - create a new object type derived from Generic_Item >> - patch list_buttons.pl to recognize your new type of object and react >> accordingly >>=20 >> This isn't as difficult as it may appear. Just create a new file in you= r >> local code directory called Lueftung_Item.pm with the following text. = =20 >Then, >> just create a new Lueftung_Item instead of a new Generic_Item. >>=20 >> How to create a Lueftung_Item: >>=20 >> use Lueftung_Item; >> $foo=3Dnew Lueftung_Item; >>=20 >> -- start of Lueftung_Item.pm -- >> package Lueftung_Item; >>=20 >> @Lueftung_Item::ISA =3D ('Generic_Item'); >>=20 >> sub new { >> my ($class, $name)=3D@_; >> my $self=3D$class->Generic_Item::new(); >> bless $self, $class; >>=20 >> $self->set_states('Stufe1','Stufe2','Stufe3','Aus'); >> $self->set_icon('fan'); >> return $self; >> } >>=20 >> -- end -- >>=20 >> Now just edit list_buttons.pl so that it recognizes your new object type= . >> Copy the logic for Fan_Motor around line 36 of this file. Be sure to ma= ke >> comparisons to the lower case equivalent of your states (i.e. stufe1 not >> Stufe1) as misterhouse converts almost all states to lowercase. You wil= l >> also need to modify list_buttons.pl around line 27 so that it it knows h= ow >> to read the current state of your new object type. Just copy the E1B1_I= tem >> line and replace E1B1_Item with Lueftung_Item. >>=20 >> You will not need to create your own icons if you are using GD, as >> misterhouse will generate them on the fly, but they are pretty ugly so y= ou >> may want to. Look at the code around line 50 for the correct filename = to=20 >use. >>=20 >> Now, if you actually want this code to do anything useful, you'll have t= o >> create new methods within Lueftung_Item that know how to control the fan= . >> Hint: take a look at Fan_Control.pm and the names of the setstate_*=20 >methods. >>=20 >> Good luck! >> Matt >>=20 >> tho...@we... wrote: >>> Ok, on "Mr House Home" -> "Browse Items" now i can see the defined stat= es =20 >for my generic items. Thanks for the Hint. >>> >>> But i cannot see the states on "Mr house home" -> "lights and appliance= s" =20 >-> "Browse Groups "lueftung" " --> Buttons "SommerWinter" & "L=FCftung" >>> >>> there i only can set the states on/off by touching the buttons. >>> >>> maybe i have to define my own icons for every state??? >>> When i am at home i will attach some pictures, so you can see what i me= an. >>> >>> Thanks everyone for help, >>> >>=20 > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around=20 >http://mail.yahoo.com=20 > > >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job eas= ier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 >________________________________________________________ >To unsubscribe from this list, go to:=20 >http://sourceforge.net/mail/?group_id=3D1365 > |