module ParseP1::Electricity

Public Instance Methods

actual_electra() click to toggle source

Only for backward compatibility

# File lib/parse_p1/electricity.rb, line 37
def actual_electra
  electra_import_actual
end
electra_export_actual() click to toggle source
# File lib/parse_p1/electricity.rb, line 45
def electra_export_actual
  get_electricity('1-0:2.7.0') * 1000
end
electra_export_low() click to toggle source
# File lib/parse_p1/electricity.rb, line 28
def electra_export_low
  get_electricity('1-0:2.8.2')
end
electra_export_normal() click to toggle source
# File lib/parse_p1/electricity.rb, line 32
def electra_export_normal
  get_electricity('1-0:2.8.1')
end
electra_import_actual() click to toggle source
# File lib/parse_p1/electricity.rb, line 41
def electra_import_actual
  get_electricity('1-0:1.7.0') * 1000
end
electra_import_low() click to toggle source
# File lib/parse_p1/electricity.rb, line 20
def electra_import_low
  get_electricity('1-0:1.8.2')
end
electra_import_normal() click to toggle source
# File lib/parse_p1/electricity.rb, line 24
def electra_import_normal
  get_electricity('1-0:1.8.1')
end
electra_meter_id() click to toggle source
# File lib/parse_p1/electricity.rb, line 7
def electra_meter_id
  result = obis_records['0-0:96.1.1']
  result.first if result
end
electricity(options) click to toggle source
# File lib/parse_p1/electricity.rb, line 49
def electricity(options)
  message = "electra_#{options[:type].to_s}_"
  if options[:actual] == true
    send(message + 'actual')
  else
    send(message + "#{options[:tariff].to_s}")
  end
end
electricity_actual_threshold() click to toggle source
# File lib/parse_p1/electricity.rb, line 16
def electricity_actual_threshold
  get_electricity('0-0:17.0.0')
end
electricity_tariff_indicator() click to toggle source
# File lib/parse_p1/electricity.rb, line 12
def electricity_tariff_indicator
  get_electricity('0-0:96.14.0')
end

Private Instance Methods

get_electricity(obis_code) click to toggle source
# File lib/parse_p1/electricity.rb, line 60
def get_electricity(obis_code)
  result = obis_records[obis_code]
  result ? result.first.to_f : 0.0
end