Sha256: 3840413854e22c0664b71a5de90d72a52f20f265531e11178d39100f8a009d99

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require 'renstar'
require 'optparse'
require 'ostruct'
require 'pry'

options = {}

#DEFAULT_OPTIONS = { all: false }.freeze


USAGE = " Usage: renstar.rb command [value]"

OptionParser.new do |opts|

  opts.banner = USAGE

  opts.on '-d', '--discover', 'Discover all Renstar devices' do |d|
    options[:discover] = true
  end

  opts.on '-h', '--help', 'Display this screen' do |h|
    puts opts
    exit 0
  end
end.parse!

if options[:discover]
  thermos = Renstar::Thermostat.search
  thermos.each do |thermo|
    puts "Found: #{thermo.location} #{thermo.usn}"
  end
  exit 0
end


thermos = Renstar::Thermostat.search
thermos.each do |thermo|
  puts "Found: #{thermo.location} #{thermo.usn}"
end
puts "Using: " + thermos.first.location + " - " + thermos.first.usn
unless (ARGV.nil? || ARGV.empty?)
  puts thermos.first.send(*ARGV)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renstar-0.2.0 bin/renstar.rb