Hi,
I need someone who would be willing to code a simple plugin for me since I have no idea how to use Perl and/or code LMS plugins.
All I need is a plugin which pipes the raw IR Codes like in the Learning.pm of the IRBlaster plugin into the Telnet/Jsonrpc CLI Interface. Continuously. From all supported Squeezeboxes.
Why?
I have lots of non connected stuff like motorized blinds or Wifi connected Lamps. I was thinking that maybe I could use a universal remote like the Logitech Harmony 525, teach it "non existant" codes and use all the squeezeboxes around here to pick up the signal. Then attach something to the cli interface to listen and control the things around here.
I've been able to slightly modify the IR learning part of the IRBlaster plugin to test it with a Boom and a Radio. Boom works (even if powered off which is what I needed). Radio doesn't work at all.
I guess the relevant code of the Learning.pm is this:
Also, here seems to be some information: http://forums.slimdevices.com/showth...l=1#post151391
I need someone who would be willing to code a simple plugin for me since I have no idea how to use Perl and/or code LMS plugins.
All I need is a plugin which pipes the raw IR Codes like in the Learning.pm of the IRBlaster plugin into the Telnet/Jsonrpc CLI Interface. Continuously. From all supported Squeezeboxes.
Why?
I have lots of non connected stuff like motorized blinds or Wifi connected Lamps. I was thinking that maybe I could use a universal remote like the Logitech Harmony 525, teach it "non existant" codes and use all the squeezeboxes around here to pick up the signal. Then attach something to the cli interface to listen and control the things around here.
I've been able to slightly modify the IR learning part of the IRBlaster plugin to test it with a Boom and a Radio. Boom works (even if powered off which is what I needed). Radio doesn't work at all.
I guess the relevant code of the Learning.pm is this:
Code:
# Check if function is available
if( UNIVERSAL::can( "Slim::Networking::Slimproto","setCallbackRAWI")) {
Slim::Networking::Slimproto::setCallbackRAWI( \&RAWICallbackLearn);
}
# Ask SB2/SB3 or Transporter to send 5 ir codes (containing x samples)
my $num_codes = pack( 'C', 5);
$client->sendFrame( 'ilrn', \$num_codes);
And most likely this
sub RAWICallbackLearn {
my $client = shift;
my $data = shift;
my $newline = 0;
my $mask = "n";
my $gap = 0;
open( FH, ">> $learnFileNameWithPath");
# Get first sample (gap)
$gap = unpack( $mask, $data);
# Firmware divides values by 25 to fit into 16 bits
# 25 is about the modulation used in IR blasting (1000000 / 38400 = 26.042)
$gap = $gap * 25;
# The first gap becomes the last
if( $learnLastGap == 0) {
# Limit gap to 20000
if( $gap > 20000) {
$gap = 20000;
}
$learnLastGap = $gap;
} else {
$learnCode .= $gap . "\n\n";
print FH " " . $gap . "\n";
}
# Shift mask by 2 bytes
$mask = "xx" . $mask;
for( my $i = 1; $i < (length($data)/2); $i++) {
my $sample = 0;
# Get next sample
$sample = unpack( $mask, $data);
# Firmware divides values by 25 to fit into 16 bits
# 25 is about the modulation used in IR blasting (1000000 / 38400 = 26.042)
$sample = $sample * 25;
$log->debug( "*** IR-Learning: " . $sample . "\n");
# Feedback for user in webinterface
$learnCode .= $sample . " ";
# Make nice groups of 6 values in .conf file
$newline++;
if( $newline gt 6) {
$newline = 1;
print FH "\n";
}
# Write samples into .conf file
print FH " " . $sample;
# Shift mask by 2 bytes
$mask = "xx" . $mask;
}
$log->debug( "*** IR-Learning: " . $gap . "\n");
close( FH);
}