module TiltHydrometer::BeaconDecorator

Public Instance Methods

celsius() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 28
def celsius
  (
    (temp - 32.0) * (5.0 / 9.0)
  ).round(1)
end
color() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 5
def color
  TiltHydrometer::DEVICES[uuid]
end
gravity() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 13
def gravity
  gravity_string = data[1].to_s

  "#{gravity_string[-4] || 0}.#{gravity_string[-3..-1]}".to_f
end
log() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 38
def log
  LOGGER.debug("Beacon: #{inspect}")
  LOGGER.debug("Data: #{data.inspect}")
  LOGGER.debug("UUID: #{uuid.inspect}")
end
plato() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 19
def plato
  (
    (-1 * 616.868) +
    (1111.14 * gravity) -
    (630.272 * (gravity**2)) +
    (135.997 * (gravity**3))
  ).round(1)
end
temp() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 9
def temp
  data[0].to_i
end
values_out_of_range?() click to toggle source
# File lib/tilt_hydrometer/beacon_decorator.rb, line 34
def values_out_of_range?
  temp > 212
end