18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/milk_maid/cli.rb', line 18
def monitor_batch
batch_name = options.fetch(:batch_name, default_batch_name)
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
sensor = get_sensor(sensor_type)
notifier = get_logger(logger_type)
batch = ::MilkMaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor, nap_time: nap_time)
puts batch.inspect
batch.start
rescue ::MilkMaid::SensorException => e
puts e.message
end
|