From: Brian W. <bri...@78...> - 2008-12-02 08:17:25
|
Jacob Strandlien wrote: > On Mon, Dec 1, 2008 at 7:53 PM, Gregg Liming <gr...@li...> wrote: >>>> If for some reason that is the case (let me know and I'll correct >>>> whatever is going on), then the following is functionally equivalent: >>>> >>>> (ref $kitchen_light_key->get_set_by and $kitchen_light_key->get_set_by >>>> eq $kitchen_light_key) >>>> >>>> since the only time that get_set_by is identical to "self" is when the >>>> device is manually pressed by a human. >>>> >>> >>> Is that for detecting if the key is being turned on, or off, or both? >>> If it's both, is there a way to differentiate between turning it off >>> and on? >> ...ummm, it's only for replacing the "is_locally_set" property. >> Obviously, you already had the "state_now eq ON" part that preceded it. >> So, likewise, you would do something similar w/ the OFF logic. >> >> Gregg >> > > I hope you can forgive me, but I'm not sure I understand. This is > probably my inexperience with Perl talking, but I'm not sure what that > statement is supposed to replace in the original code. Does it > replace 'is_locally_set' or the whole > '$kitchen_light_key->is_locally_set'? I tried both, and neither seem > to work... > So you end up with: if (($kitchen_light_key->state_now eq ON and (ref $kitchen_light_key->get_set_by and $kitchen_light_key->get_set_by eq $kitchen_light_key)) or (($kitchen_light_key_2->state_now eq ON and $kitchen_light_key_2->get_set_by and $kitchen_light_key_2->get_set_by eq $kitchen_light_key_2)) or (($kitchen_light_key_3->state_now eq ON and $kitchen_light_key_3->get_set_by and $kitchen_light_key_3->get_set_by eq $kitchen_light_key_3))) { $mh_scene_kitchen->set(ON); } hth, Brian |