module Mochizuki::Status::ClassMethods

Public Instance Methods

reset_status() click to toggle source
# File lib/mochizuki/status.rb, line 14
def reset_status
  @status = Status.new
end
status() click to toggle source
# File lib/mochizuki/status.rb, line 10
def status
  @status ||= Status.new
end
update_status(power) click to toggle source
# File lib/mochizuki/status.rb, line 18
def update_status(power)
  last = Mochizuki.status.below_threshold
  current = power.to_f < @config.alarm_threshold.to_f
  @logger.info "Update status, @below_threshold, last: #{last}, current: #{current}"

  Mochizuki.status.below_threshold = current

  return unless !current && last # re-enabled auto alarm

  Mochizuki.status.alarmed_before = false
  @logger.info 'Auto alarm enabled'
end