Sha256: 9af653b6bee7cb06a1b55a86dc50db2c20d9594288d091e5e20425fe52fcf11c
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "milight/v6" host = ARGV.shift if host == "search" controllers = Milight::V6::Controller.search if !controllers.empty? controllers.each { |c| puts c.to_s } else puts "No Mi-Light devices found." end else if ARGV.empty? puts "Usage: #{$PROGRAM_NAME} <host> <command> [zone]" puts " #{$PROGRAM_NAME} search" exit 1 end command = ARGV.shift zone = ARGV.shift controller = Milight::V6::Controller.new(host) case zone when nil lights = controller.all when "bridge" lights = controller.bridge else lights = controller.zone(zone.to_i) end case command when "link" lights.link when "unlink" lights.unlink when "off" lights.off when "on" lights.on end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
milight-v6-0.2.0 | bin/milight |