Jump to content

opensauce

Members
  • Posts

    3
  • Joined

  • Last visited

opensauce's Achievements

Newbie

Newbie (1/6)

0

Reputation

  1. Yeah, this is definitely a one-off thing. I'm likely going to give OpenHAB a shot, which means I'll have to write the binding for it. So I wanted something to meet my simple use case until I have time to dive into that.
  2. Sure, no problem. I looked at the perl module but on the rpi it took too long to load, not the authors fault just the lag in the pi. So I wrote that not to use any modules. Yeah, as you wrote I poll the ISY for the status of the lights and then I perform the opposite command on the light itself. Goes nice and fast: $ time ~/lights.pl '20 32 1E 1' real 0m0.362s user 0m0.140s sys 0m0.080s
  3. I figured I'd put this program here since rpi and ir is my use case. I wanted a way to hit a remote button and toggle a light. This is the leanest way I could come up with. I wanted a fast response so I didn't use any perl modules. #!/usr/bin/perl my $light = 'http://admin:admin@lights/rest/nodes/%s/cmd/%s'; my $status = 'http://admin:admin@lights/rest/status/'; my $node = $ARGV[0]; my $off,$on; $off = 'DOF'; $on = 'DON'; #Poll Status my $lights = `curl -silent -o - '$status'`; my %add = (); %add = $lights =~ /node id=\"(.*?)\".*?value=\"(.*?)\"/g; #Decide the toggle my $mode = ($add{$node} == 0) ? $on : $off; #Do Something $node =~ s/\ /%20/g; my $url = sprintf $light, $node, $mode; exec("curl -silent -o /dev/null '$url'"); my .liric file looks: begin remote = directv button = dash prog = irexec config = ~/lights.pl '20 32 1E 1' end
×
×
  • Create New...