Skip to content

Commit

Permalink
add usable_battery_level to charges
Browse files Browse the repository at this point in the history
  • Loading branch information
ctraber authored and adriankumpf committed Jan 18, 2020
1 parent 9a25f88 commit bc3c002
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/teslamate/log/charge.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule TeslaMate.Log.Charge do
field :battery_heater_on, :boolean
field :battery_heater_no_power, :boolean
field :battery_level, :integer
field :usable_battery_level, :integer
field :charge_energy_added, :float
field :charger_actual_current, :integer
field :charger_phases, :integer, default: 1
Expand Down Expand Up @@ -37,6 +38,7 @@ defmodule TeslaMate.Log.Charge do
:battery_heater_on,
:battery_heater,
:battery_level,
:usable_battery_level,
:charge_energy_added,
:charger_actual_current,
:charger_phases,
Expand Down
1 change: 1 addition & 0 deletions lib/teslamate/vehicles/vehicle.ex
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ defmodule TeslaMate.Vehicles.Vehicle do
battery_heater: vehicle.climate_state.battery_heater,
battery_heater_no_power: vehicle.climate_state.battery_heater_no_power,
battery_level: vehicle.charge_state.battery_level,
usable_battery_level: vehicle.charge_state.usable_battery_level,
charge_energy_added: vehicle.charge_state.charge_energy_added,
charger_actual_current: vehicle.charge_state.charger_actual_current,
charger_phases: vehicle.charge_state.charger_phases,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule TeslaMate.Repo.Migrations.ChargesAddUsableBatteryLevel do
use Ecto.Migration

def change do
alter table(:charges) do
add(:usable_battery_level, :integer)
end
end
end

0 comments on commit bc3c002

Please sign in to comment.