Class: TiltHydrometer::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/tilt_hydrometer/core.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Core

Returns a new instance of Core.



5
6
7
# File 'lib/tilt_hydrometer/core.rb', line 5

def initialize(options = {})
  @options = options
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tilt_hydrometer/core.rb', line 9

def run
  scanner.scan do |beacons|
    beacons.each do |beacon|
      beacon.extend(TiltHydrometer::BeaconDecorator)
      beacon.log

      if beacon.values_out_of_range?
        LOGGER.debug('values out of range') && next
      end

      brewfather&.post(beacon)
      mqtt&.publish(beacon)
    end
  end
end