From 46579ca6ab271868719477ae5f7015147282fa9a Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Fri, 19 Jul 2013 17:11:14 -0700 Subject: [PATCH 1/4] Insteon: Reorganize Structure for Generating Voice Commands Generate_voice_commands in Insteon.pm now calls get_voice_cmds for each object. get_voice_cmds is written to be inherited and modified by higher level objects This allows for unique voice commands to be added to objects in their respective class files without messing with the base Insteon.pm file. This commit merely copied over the voice commands as they existed before with little to no changes in the voice command design. Fixes hollie/misterhouse#181 --- lib/Insteon.pm | 96 +++++++++--------------------------- lib/Insteon/BaseInsteon.pm | 88 +++++++++++++++++++++++++++++++++ lib/Insteon/BaseInterface.pm | 35 +++++++++++++ lib/Insteon/Lighting.pm | 55 +++++++++++++++++++++ 4 files changed, 201 insertions(+), 73 deletions(-) diff --git a/lib/Insteon.pm b/lib/Insteon.pm index 799f26c3f..5147cc965 100755 --- a/lib/Insteon.pm +++ b/lib/Insteon.pm @@ -554,87 +554,37 @@ sub generate_voice_commands for my $object (&main::list_all_objects) { next unless ref $object; next unless $object->isa('Insteon::BaseInterface') or $object->isa('Insteon::BaseObject'); + + #get object name to use as part of variable in voice command my $object_name = $object->get_object_name; - # ignore the thermostat - next if $object->isa('Insteon_Thermostat'); + my $object_name_v = $object_name . '_v'; + $object_string .= "use vars '${object_name}_v';\n"; + + #Convert object name into readable voice command words my $command = $object_name; $command =~ s/^\$//; $command =~ tr/_/ /; - my $object_name_v = $object_name . '_v'; - $object_string .= "use vars '${object_name}_v';\n"; - my $states = 'on,off'; + my $group = ($object->isa('Insteon_PLM')) ? '' : $object->group; - if ($object->isa('Insteon::BaseController')) { - $states = 'on,off,sync links'; #,resume,enroll,unenroll,manual'; - my $cmd_states = $states; - if ($object->isa('Insteon::InterfaceController')) { - $cmd_states .= ',initiate linking as controller,cancel linking'; - } else { - $cmd_states .= ",link to interface,unlink with interface"; - } - if ($object->is_root and !($object->isa('Insteon::InterfaceController'))) { - $cmd_states .= ",status,get engine version,scan link table,log links"; - push @_scannable_link, $object_name; - } - $object_string .= "$object_name_v = new Voice_Cmd '$command [$cmd_states]';\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->initiate_linking_as_controller(\"$group\")', 'initiate linking as controller');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->interface()->cancel_linking','cancel linking');\n\n"; - if ($object->is_root and !($object->isa('Insteon::InterfaceController'))) { - $object_string .= "$object_name_v -> tie_event('$object_name->link_to_interface','link to interface');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->unlink_to_interface','unlink with interface');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->request_status','status');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->get_engine_version','get engine version');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->scan_link_table(\"" . '\$self->log_alllink_table' . "\")','scan link table');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->log_alllink_table()','log links');\n\n"; - } - $object_string .= "$object_name_v -> tie_event('$object_name->sync_links(0)','sync links');\n\n"; - $object_string .= "$object_name_v -> tie_items($object_name, 'on');\n\n"; - $object_string .= "$object_name_v -> tie_items($object_name, 'off');\n\n"; - $object_string .= &main::store_object_data($object_name_v, 'Voice_Cmd', 'Insteon', 'Insteon_link_commands'); - push @_insteon_link, $object_name; - } elsif ($object->isa('Insteon::BaseDevice')) { - my $cmd_states = "$states,status,get engine version,scan link table,log links,update onlevel/ramprate"; #,on level,ramp rate"; - $cmd_states .= ",link to interface,unlink with interface" if $object->isa("Insteon::BaseController") || $object->is_controller; - $object_string .= "$object_name_v = new Voice_Cmd '$command [$cmd_states]';\n"; - foreach my $state (split(/,/,$states)) { - $object_string .= "$object_name_v -> tie_items($object_name, '$state');\n\n"; - } - $object_string .= "$object_name_v -> tie_event('$object_name->log_alllink_table()','log links');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->request_status','status');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->get_engine_version','get engine version');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->update_local_properties','update onlevel/ramprate');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->scan_link_table(\"" . '\$self->log_alllink_table' . "\")','scan link table');\n\n"; - if ($object->isa("Insteon::BaseController") || $object->is_controller) { - $object_string .= "$object_name_v -> tie_event('$object_name->link_to_interface','link to interface');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->unlink_to_interface','unlink with interface');\n\n"; - } -# the remote_set_button_taps provide incorrect/inconsistent results -# $object_string .= "$object_name_v -> tie_event('$object_name->remote_set_button_tap(1)','on level');\n\n"; -# $object_string .= "$object_name_v -> tie_event('$object_name->remote_set_button_tap(2)','ramp rate');\n\n"; - $object_string .= &main::store_object_data($object_name_v, 'Voice_Cmd', 'Insteon', 'Insteon_item_commands'); - push @_insteon_device, $object_name if $group eq '01'; # don't allow non-base items to participate - } elsif ($object->isa('Insteon_PLM')) { - my $cmd_states = "complete linking as responder,initiate linking as controller,cancel linking,delete link with PLM,scan link table,log links,delete orphan links,AUDIT - delete orphan links,scan all device link tables,scan changed device link tables,sync all links,AUDIT - sync all links"; - $cmd_states .= ",log all device ALDB status"; - $object_string .= "$object_name_v = new Voice_Cmd '$command [$cmd_states]';\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->complete_linking_as_responder','complete linking as responder');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->initiate_linking_as_controller','initiate linking as controller');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->initiate_unlinking_as_controller','initiate unlinking');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->cancel_linking','cancel linking');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->log_alllink_table','log links');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->scan_link_table(\"" . '\$self->log_alllink_table' . "\")','scan link table');\n\n"; - $object_string .= "$object_name_v -> tie_event('&Insteon::scan_all_linktables(1)','scan changed device link tables');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->delete_orphan_links','delete orphan links');\n\n"; - $object_string .= "$object_name_v -> tie_event('$object_name->delete_orphan_links(1)','AUDIT - delete orphan links');\n\n"; - $object_string .= "$object_name_v -> tie_event('&Insteon::scan_all_linktables','scan all device link tables');\n\n"; - $object_string .= "$object_name_v -> tie_event('&Insteon::sync_all_links(0)','sync all links');\n\n"; - $object_string .= "$object_name_v -> tie_event('&Insteon::sync_all_links(1)','AUDIT - sync all links');\n\n"; - $object_string .= "$object_name_v -> tie_event('&Insteon::log_all_ADLB_status','log all device ALDB status');\n\n"; - $object_string .= &main::store_object_data($object_name_v, 'Voice_Cmd', 'Insteon', 'Insteon_PLM_commands'); - push @_insteon_plm, $object_name; + + #Get list of all voice commands from the object + my $voice_cmds = $object->get_voice_cmds(); + + #Initialize the voice command with all of the possible device commands + $object_string .= "$object_name_v = new Voice_Cmd '$command [" + . join(",", sort keys %$voice_cmds) . "]';\n"; + + #Tie the proper routine to each voice command + foreach (keys %$voice_cmds) { + $object_string .= "$object_name_v -> tie_event('" . $voice_cmds->{$_} + . "', '$_');\n\n"; } + + #Add this object to the list of Insteon Voice Commands on the Web Interface + $object_string .= ::store_object_data($object_name_v, 'Voice_Cmd', 'Insteon', 'Insteon_PLM_commands'); } + #Evaluate the resulting object generating string package main; eval $object_string; print "Error in insteon_item_commands: $@\n" if $@; diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index 4aaad4330..e8714c40e 100644 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -1012,6 +1012,34 @@ sub failure_reason return $$self{failure_reason}; } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my %voice_cmds = ( + #The Sync Links routine really resides in DeviceController, but that + #class seems a little redundant as in practice all devices are controllers + #in some sense. As a result, that class will likely be folded into + #BaseObject/Device at some future date. In order to avoid a bizarre + #inheritance of this routine by higher classes, this command was placed + #here + 'sync links' => $self->get_object_name . '->sync_links(0)' + ); + return \%voice_cmds; +} + =back =head2 INI PARAMETERS @@ -2032,6 +2060,40 @@ sub check_aldb_version } } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + 'link to interface' => "$object_name->link_to_interface", + 'unlink with interface' => "$object_name->unlink_to_interface" + ); + if ($self->is_root){ + %voice_cmds = ( + %voice_cmds, + 'status' => "$object_name->request_status", + 'get engine version' => "$object_name->get_engine_version", + 'scan link table' => "$object_name->scan_link_table(\"" . '\$self->log_alllink_table' . "\")", + 'log links' => "$object_name->log_alllink_table()" + ) + } + return \%voice_cmds; +} + =back =head2 INI PARAMETERS @@ -2953,6 +3015,32 @@ sub is_root return 0; } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my $group = $self->group; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + 'initiate linking as controller' => "$object_name->initiate_linking_as_controller(\"$group\")", + 'cancel linking' => "$object_name->interface()->cancel_linking" + ); + return \%voice_cmds; +} + =back =head2 AUTHOR diff --git a/lib/Insteon/BaseInterface.pm b/lib/Insteon/BaseInterface.pm index b2493956a..c12e9bbd6 100644 --- a/lib/Insteon/BaseInterface.pm +++ b/lib/Insteon/BaseInterface.pm @@ -852,6 +852,41 @@ sub _is_duplicate_received { return $is_duplicate; } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + 'complete linking as responder' => "$object_name->complete_linking_as_responder", + 'initiate linking as controller' => "$object_name->initiate_linking_as_controller", + 'initiate unlinking' => "$object_name->initiate_unlinking_as_controller", + 'cancel linking' => "$object_name->cancel_linking", + 'log links' => "$object_name->log_alllink_table", + 'scan link table' => "$object_name->scan_link_table(\"" . '\$self->log_alllink_table' . "\")", + 'scan changed device link tables' => "Insteon::scan_all_linktables(1)", + 'delete orphan links' => "$object_name->delete_orphan_links", + 'AUDIT - delete orphan links' => "$object_name->delete_orphan_links(1)", + 'scan all device link tables' => "Insteon::scan_all_linktables", + 'sync all links' => "Insteon::sync_all_links(0)", + 'AUDIT - sync all links' => "Insteon::sync_all_links(1)", + 'log all device ALDB status' => "Insteon::log_all_ADLB_status" + ); + return \%voice_cmds; +} + =back =head2 INI PARAMETERS diff --git a/lib/Insteon/Lighting.pm b/lib/Insteon/Lighting.pm index 92d69cf18..7ce94da5b 100644 --- a/lib/Insteon/Lighting.pm +++ b/lib/Insteon/Lighting.pm @@ -60,6 +60,31 @@ sub level } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + 'on' => "$object_name->set(\"on\")", + 'off' => "$object_name->set(\"off\")" + ); + return \%voice_cmds; +} + =back =head2 AUTHOR @@ -254,6 +279,36 @@ sub level } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my $insteon_menu_states = $main::config_parms{insteon_menu_states} if $main::config_parms{insteon_menu_states}; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + 'update onlevel/ramprate' => "$object_name->update_local_properties" + ); + if ($insteon_menu_states){ + foreach my $state (split(/,/,$insteon_menu_states)) { + $voice_cmds{$state} = "$object_name->set(\"$state\")"; + } + } + return \%voice_cmds; +} + =back =head2 AUTHOR From 34ac765af43d1c51487e0d11ad8cfc44a46bfe2f Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Sat, 20 Jul 2013 12:04:01 -0700 Subject: [PATCH 2/4] Insteon: Add Voice Commands to IOLinc --- lib/Insteon/IOLinc.pm | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lib/Insteon/IOLinc.pm b/lib/Insteon/IOLinc.pm index d5186fee7..084a6c5ba 100755 --- a/lib/Insteon/IOLinc.pm +++ b/lib/Insteon/IOLinc.pm @@ -455,6 +455,47 @@ sub set_relay_mode return; } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + #Rename status command to note that it will request status of the + #relay + 'on' => "$object_name->set(\"on\")", + 'off' => "$object_name->set(\"off\")", + 'status - relay' => "$object_name->request_status", + 'status - sensor' => "$object_name->request_sensor_status", + 'print momentary time' => "$object_name->get_momentary_time", + 'link relay to sensor' => "$object_name->set_relay_linked(1)", + 'unlink relay from sensor' => "$object_name->set_relay_linked(0)", + 'reverse sensor output' => "$object_name->set_trigger_reverse(1)", + 'unreverse sensor output' => "$object_name->set_trigger_reverse(0)", + 'set relay to latching' => "$object_name->set_relay_mode(\"Latching\")", + 'set relay to momentary a' => "$object_name->set_relay_mode(\"Momentary_A\")", + 'set relay to momentary b' => "$object_name->set_relay_mode(\"Momentary_B\")", + 'set relay to momentary c' => "$object_name->set_relay_mode(\"Momentary_C\")", + 'print settings to log' => "$object_name->get_operating_flag" + ); + #Remove generic status command + delete $voice_cmds{status}; + return \%voice_cmds; +} + =back =head2 AUTHOR From 5e57ac9f6a2d7df6d9314555d2c3a3162cec9c04 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Sat, 20 Jul 2013 12:44:43 -0700 Subject: [PATCH 3/4] Insteon: Add KeyPadLinc Unique Voice Commands Moved update_flags routine to KeyPadLinc classes Added unique voice commands --- lib/Insteon/AllLinkDatabase.pm | 2 +- lib/Insteon/BaseInsteon.pm | 30 --------- lib/Insteon/Lighting.pm | 112 +++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 31 deletions(-) diff --git a/lib/Insteon/AllLinkDatabase.pm b/lib/Insteon/AllLinkDatabase.pm index 5c7918641..eed61071a 100644 --- a/lib/Insteon/AllLinkDatabase.pm +++ b/lib/Insteon/AllLinkDatabase.pm @@ -1935,7 +1935,7 @@ sub update_local_properties =item C -Used to update the flags of a device. Called by L. +Used to update the flags of a device. Called by L. =cut diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index e8714c40e..4b0b7918a 100644 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -1953,36 +1953,6 @@ sub update_local_properties } } -=item C - -Can be used to set the button layout and light level on a keypadlinc. Flag -options include: - - '0a' - 8 button; backlighting dim - '06' - 8 button; backlighting off - '02' - 8 button; backlighting normal - - '08' - 6 button; backlighting dim - '04' - 6 button; backlighting off - '00' - 6 button; backlighting normal - -Note: This routine will likely be moved to L at some point. - -=cut - -sub update_flags -{ - my ($self, $flags) = @_; - if (!($self->isa('Insteon::KeyPadLinc') or $self->isa('Insteon::KeyPadLincRelay'))) - { - &::print_log("[Insteon::BaseDevice] Operating flags may only be revised on keypadlincs!"); - return; - } - return unless defined $flags; - - $self->_aldb->update_flags($flags) if $self->_aldb; -} - =item C Sets or gets the device object engine version. If setting the engine version, diff --git a/lib/Insteon/Lighting.pm b/lib/Insteon/Lighting.pm index 7ce94da5b..304631bbd 100644 --- a/lib/Insteon/Lighting.pm +++ b/lib/Insteon/Lighting.pm @@ -738,6 +738,62 @@ sub set } +=item C + +Can be used to set the button layout and light level on a keypadlinc. Flag +options include: + + '0a' - 8 button; backlighting dim + '06' - 8 button; backlighting off + '02' - 8 button; backlighting normal + + '08' - 6 button; backlighting dim + '04' - 6 button; backlighting off + '00' - 6 button; backlighting normal + +=cut + +sub update_flags +{ + my ($self, $flags) = @_; + return unless defined $flags; + $self->_aldb->update_flags($flags) if $self->_aldb; +} + +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds} + ); + if ($self->is_root){ + %voice_cmds = ( + %voice_cmds, + 'set 8 button - backlight dim' => "$object_name->update_flags(\"0a\")", + 'set 8 button - backlight off' => "$object_name->update_flags(\"06\")", + 'set 8 button - backlight normal' => "$object_name->update_flags(\"02\")", + 'set 6 button - backlight dim' => "$object_name->update_flags(\"08\")", + 'set 6 button - backlight off' => "$object_name->update_flags(\"04\")", + 'set 6 button - backlight normal' => "$object_name->update_flags(\"00\")" + ); + } + return \%voice_cmds; +} + =back =head2 AUTHOR @@ -853,6 +909,62 @@ sub set } +=item C + +Can be used to set the button layout and light level on a keypadlinc. Flag +options include: + + '0a' - 8 button; backlighting dim + '06' - 8 button; backlighting off + '02' - 8 button; backlighting normal + + '08' - 6 button; backlighting dim + '04' - 6 button; backlighting off + '00' - 6 button; backlighting normal + +=cut + +sub update_flags +{ + my ($self, $flags) = @_; + return unless defined $flags; + $self->_aldb->update_flags($flags) if $self->_aldb; +} + +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds} + ); + if ($self->is_root){ + %voice_cmds = ( + %voice_cmds, + 'set 8 button - backlight dim' => "$object_name->update_flags(\"0a\")", + 'set 8 button - backlight off' => "$object_name->update_flags(\"06\")", + 'set 8 button - backlight normal' => "$object_name->update_flags(\"02\")", + 'set 6 button - backlight dim' => "$object_name->update_flags(\"08\")", + 'set 6 button - backlight off' => "$object_name->update_flags(\"04\")", + 'set 6 button - backlight normal' => "$object_name->update_flags(\"00\")" + ); + } + return \%voice_cmds; +} + =back =head2 AUTHOR From ecbcaddcc61aac415282691ef6214c8aac0fa440 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Sat, 20 Jul 2013 13:01:35 -0700 Subject: [PATCH 4/4] Insteon: Add Unique Voice Commands to Motion Sensor --- lib/Insteon/Security.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/Insteon/Security.pm b/lib/Insteon/Security.pm index 27f7d04f0..0af6cf4b9 100644 --- a/lib/Insteon/Security.pm +++ b/lib/Insteon/Security.pm @@ -494,6 +494,36 @@ sub is_responder return 0; } +=item C + +Returns a hash of voice commands where the key is the voice command name and the +value is the perl code to run when the voice command name is called. + +Higher classes which inherit this object may add to this list of voice commands by +redefining this routine while inheriting this routine using the SUPER function. + +This routine is called by L to generate the +necessary voice commands. + +=cut + +sub get_voice_cmds +{ + my ($self) = @_; + my $object_name = $self->get_object_name; + my %voice_cmds = ( + %{$self->SUPER::get_voice_cmds}, + 'enable night only' => "$object_name->enable_night_only(1)", + 'disable night only' => "$object_name->enable_night_only(0)", + 'enable on only mode' => "$object_name->enable_on_only(1)", + 'disable on only mode' => "$object_name->enable_on_only(0)", + 'enable all motion mode' => "$object_name->enable_all_motion(1)", + 'disable all motion mode' => "$object_name->enable_all_motion(0)" + ); + return \%voice_cmds; +} + + =back =head2 AUTHOR