Class: Sunnycarcharger::Agent::InvertorData

Inherits:
Object
  • Object
show all
Defined in:
lib/sunnycarcharger/agent/invertor_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#energy_consumedObject

Returns the value of attribute energy_consumed.



4
5
6
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 4

def energy_consumed
  @energy_consumed
end

#energy_producedObject

Returns the value of attribute energy_produced.



4
5
6
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 4

def energy_produced
  @energy_produced
end

#power_from_gridObject

Returns the value of attribute power_from_grid.



3
4
5
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 3

def power_from_grid
  @power_from_grid
end

#power_from_solarObject

Returns the value of attribute power_from_solar.



3
4
5
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 3

def power_from_solar
  @power_from_solar
end

#power_to_loadObject

Returns the value of attribute power_to_load.



3
4
5
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 3

def power_to_load
  @power_to_load
end

#serialObject

Returns the value of attribute serial.



2
3
4
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 2

def serial
  @serial
end

#solar_energy_todayObject

Returns the value of attribute solar_energy_today.



3
4
5
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 3

def solar_energy_today
  @solar_energy_today
end

Instance Method Details

#as_jsonObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 10

def as_json
  {
    serial: serial,
    power_from_grid: power_from_grid,
    power_to_load: power_to_load,
    power_from_solar: power_from_solar,
    solar_energy_today: solar_energy_today,
    energy_consumed: energy_consumed,
    energy_produced: energy_produced
  }
end

#power_to_gridObject



6
7
8
# File 'lib/sunnycarcharger/agent/invertor_data.rb', line 6

def power_to_grid
  -power_from_grid
end