ah ok, you've jogged my memory
Code: Select all
perl Makefile.PL
make
sudo make install
Also I modified ol in bin/ol to include brightness:
Code: Select all
#!/usr/bin/perl
# Sample Usage:
#
# ol --hub=192.168.10.11 --name=hall --sleep=10
#
use strict;
use warnings;
use Device::Osram::Lightify::Hub;
use Getopt::Long;
use Pod::Usage;
#
# The configuration variables
#
my %CONFIG;
#
# Parse the command-line
#
exit
unless (
Getopt::Long::GetOptions( "all-off", \$CONFIG{ 'all-off' },
"all-on", \$CONFIG{ 'all-on' },
"help", \$CONFIG{ 'help' },
"hub=s", \$CONFIG{ 'hub' },
"list", \$CONFIG{ 'list' },
"off=s", \$CONFIG{ 'off' },
"on=s", \$CONFIG{ 'on' },
"fade_on_name=s", \$CONFIG{ 'fade_on_name' },
"sleep=s", \$CONFIG{ 'sleep' },
"brightness=s", \$CONFIG{ 'brightness' },
"name=s", \$CONFIG{ 'name' },
) );
#
# Connect to the hub
#
my $hub = Device::Osram::Lightify::Hub->new( host => $CONFIG{ 'hub' } );
#if ( !$CONFIG{ 'name' } )
#{
# print "Usage: $0 --hub=1.2.3.4 --name=name [--sleep=10]\n";
# print "Missing name parameter - which bulb did you want to fade in?\n";
# exit(0)
#}
# Change Brightness
#
if ( $CONFIG{ 'brightness' } )
{
# Set a light on
foreach my $light ( $hub->lights() )
{
if ( $light->name() eq $CONFIG{ 'name' } )
{
#print("Brightness is $CONFIG{'brightness'}.\n");
$light->set_brightness($CONFIG{'brightness'});
#$light->set_on();
#print("Set $CONFIG{'name'} brightness to $CONFIG{'brightness'}.\n");
exit(0);
}
}
}
#
# Now run the actions
#
if ( $CONFIG{ 'all-on' } )
{
# All on
$hub->all_on();
}
if ( $CONFIG{ 'all-off' } )
{
# ALl off
$hub->all_off();
}
if ( $CONFIG{ 'on' } )
{
# Set a light on
foreach my $light ( $hub->lights() )
{
if ( $light->name() eq $CONFIG{ 'on' } )
{
$light->set_on();
#print("Set $CONFIG{'on'} on.\n");
exit(0);
}
}
}
if ( $CONFIG{ 'off' } )
{
# Set a single light off
foreach my $light ( $hub->lights() )
{
if ( $light->name() eq $CONFIG{ 'off' } )
{
$light->set_off();
#print("Set $CONFIG{'off'} off.\n");
exit(0);
}
}
}
#
# Fade in a light
#
if ( $CONFIG{ 'fade_on_name' } )
{
foreach my $light ( $hub->lights() )
{
if ( $light->name() eq $CONFIG{ 'on' } )
{
my $step = 5;
while ( $step <= 100 )
{
#print "Setting brightness level : $step\n";
$light->set_brightness($step);
$light->set_on();
#print "\tSleeping for $CONFIG{'sleep'} seconds\n";
sleep( $CONFIG{ 'sleep' } );
# Bump brightness
$step += 5;
}
exit(0);
}
}
}
if ( $CONFIG{ 'list' } )
{
foreach my $light ( $hub->lights() )
{
print $light;
}
}
exit 0;