Class: Subduino::Parse::Energy

Inherits:
Analogic show all
Defined in:
lib/subduino/parse/energy.rb

Constant Summary collapse

AC =
220

Instance Method Summary collapse

Methods inherited from Analogic

#digital?, #ratio

Methods inherited from Digital

#digital?, #graph, #initialize, #name, #raw, #sparkline, #type

Constructor Details

This class inherits a constructor from Subduino::Parse::Digital

Instance Method Details

#kwhObject



9
10
11
# File 'lib/subduino/parse/energy.rb', line 9

def kwh
  AC * parse
end

#parseObject



5
6
7
# File 'lib/subduino/parse/energy.rb', line 5

def parse
  (@v / 10).to_i
end

#to_sObject



13
14
15
# File 'lib/subduino/parse/energy.rb', line 13

def to_s
  "#{parse} A"
end