From: Matthew W. <mat...@us...> - 2006-06-22 18:20:43
|
Thorsten, The page that you are talking about is generated by mh/web/bin/list_buttons.pl. If you want to have your custom states listed, then you will have to: - create a new object type derived from Generic_Item - patch list_buttons.pl to recognize your new type of object and react accordingly This isn't as difficult as it may appear. Just create a new file in your local code directory called Lueftung_Item.pm with the following text. Then, just create a new Lueftung_Item instead of a new Generic_Item. How to create a Lueftung_Item: use Lueftung_Item; $foo=new Lueftung_Item; -- start of Lueftung_Item.pm -- package Lueftung_Item; @Lueftung_Item::ISA = ('Generic_Item'); sub new { my ($class, $name)=@_; my $self=$class->Generic_Item::new(); bless $self, $class; $self->set_states('Stufe1','Stufe2','Stufe3','Aus'); $self->set_icon('fan'); return $self; } -- end -- 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 make comparisons to the lower case equivalent of your states (i.e. stufe1 not Stufe1) as misterhouse converts almost all states to lowercase. You will also need to modify list_buttons.pl around line 27 so that it it knows how to read the current state of your new object type. Just copy the E1B1_Item line and replace E1B1_Item with Lueftung_Item. 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 you may want to. Look at the code around line 50 for the correct filename to use. Now, if you actually want this code to do anything useful, you'll have to 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_* methods. Good luck! Matt tho...@we... wrote: > Ok, on "Mr House Home" -> "Browse Items" now i can see the defined states for my generic items. Thanks for the Hint. > > But i cannot see the states on "Mr house home" -> "lights and appliances" -> "Browse Groups "lueftung" " --> Buttons "SommerWinter" & "Lüftung" > > 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 mean. > > Thanks everyone for help, > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |