From: Bruce W. <br...@mi...> - 2004-07-16 02:49:37
|
> My biggest problem right now is that I can't for the life of me figure > out how to create a discrete button like this little blurb does: > # Zone 1 > $sprinkler_EastSideSprays_FrontBack = new Serial_Item('AW10000', > ON, 'weeder'); > $sprinkler_EastSideSprays_FrontBack -> add ('AOA', OFF, > 'weeder'); > $sprinkler_EastSideSprays_FrontBack -> add ('ARA', > 'status', 'weeder'); > > I just want (for starters) to create a OFF/ON button called Sprinkler > Override and be able to toggle it off or on from the GUI. Can anybody > give me any good ideas on all of this? > > Thanks! > Chris You can use Generic_Item to create an arbitrary object that you can set then test in your code to create sequences. For example: $sprinkler_override = new Generic_Item; $sprinkler_override -> set_states('On', 'Off', 'Hold'); $sprinkler_override -> tie_event('speak "sprinklers set to $state"'); if ($state=$sprinkler_override) { do sequence of stuff; } Then you can then pick that object from the list of Generic_Items on the 'Browse Items' page, or create your own web page with just the sprinkler related controls. Bruce |