Skip to content
ggodart edited this page Jan 4, 2021 · 2 revisions

lirc_mh

See original

SYNOPSIS

To enable this module, you'll need to create the lirc_client socket in your user code like this (replace IP:port with your setup):

  use lirc_mh;
  $lirc_client = new  Socket_Item(undef, undef, '192.168.2.12:8765','lirc','tcp','record');

Then, add code to start the socket:

  if ($Startup) {
    start $lirc_client;
  }

Finally, create an IR_Item like this example:

  # need this to get around default map in IR_Item.pm
  my %map = qw(
  );

  $VCR = new IR_Item 'sony_vcr1', '', 'lirc', \%map;
  # enumerate the states for VCR
  my $vcr_state_list = "0,1,2,3,4,5,6,7,9,8,enter,x2,|<<,>>|,tv/vid,slow,rec,menu,setup,sp_ep,power,display,input_sel,on,off";
  # voice commands
  $v_vcr_remote           = new  Voice_Cmd("SONY_VCR1 [$vcr_state_list]");

  # send IR command when we get a voice command
  if ($state = said $v_vcr_remote) {
     print_log "Setting Sony VCR to $state";
     set $VCR $state;
  }

Here's some example code to receive IR:

  if (my $msg = said $lirc_client) {
     print_log "Lirc message received: $msg";
     my ($code,$act,$key,$remote) = ($msg =~ /([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) */);
     # do something useful here
  }

DESCRIPTION

Misterhouse interface for lirc

INHERITS

INI PARAMETERS

METHODS

AUTHOR

Adapted by David Satterfield

SEE ALSO

None

Clone this wiki locally