lib/milk_maid/cli.rb in milk_maid-0.4.0 vs lib/milk_maid/cli.rb in milk_maid-0.5.0
- old
+ new
@@ -15,11 +15,11 @@
option :logger, :type => :string, :required => false, :default => 'Console', :aliases => '-l'
option :sensor, :type => :boolean, :required => false, :default => true, :aliases => '-s'
option :nap, :type => :numeric, :required => false, :default => 5, :aliases => '-n'
def monitor_batch
batch_name = options.fetch(:batch_name, default_batch_name)
- temperature = options[:temperature].to_i
+ temperature = options[:temperature].to_f
duration = options[:duration].to_i * 60
logger_type = options[:logger]
sensor_type = options[:sensor]
nap_time = options[:nap].to_i
@@ -38,10 +38,10 @@
def default_batch_name
Time.now.strftime("Batch-%Y-%m-%d %H:%M:%S")
end
def get_sensor(sensor_type)
- sensor_type ? ::MilkMaid::TemperatureSensor.new : ::MilkMaid::MockTemperatureSensor.new(options[:temperature].to_i - 20, options[:temperature].to_i + 30)
+ sensor_type ? ::MilkMaid::TemperatureSensor.new : ::MilkMaid::MockTemperatureSensor.new(options[:temperature].to_f - 20, options[:temperature].to_f + 30)
end
def get_logger(logger_type)
case logger_type.upcase
when 'CONSOLE'