Store estimated battery range

This commit is contained in:
Adrian Kumpf
2019-08-18 20:32:23 +02:00
parent f56e90b1a9
commit 7f2706d367
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -13,6 +13,7 @@ defmodule TeslaMate.Log.Position do
field :power, :float
field :odometer, :float
field :ideal_battery_range_km, :float
field :est_battery_range_km, :float
field :battery_level, :integer
field :battery_heater, :boolean
field :battery_heater_on, :boolean
@@ -43,6 +44,7 @@ defmodule TeslaMate.Log.Position do
:power,
:odometer,
:ideal_battery_range_km,
:est_battery_range_km,
:battery_level,
:battery_heater_no_power,
:battery_heater_on,
@@ -498,6 +498,7 @@ defmodule TeslaMate.Vehicles.Vehicle do
inside_temp: vehicle.climate_state.inside_temp,
odometer: Convert.miles_to_km(vehicle.vehicle_state.odometer, 6),
ideal_battery_range_km: Convert.miles_to_km(vehicle.charge_state.ideal_battery_range, 1),
est_battery_range_km: Convert.miles_to_km(vehicle.charge_state.est_battery_range, 1),
altitude: nil,
fan_status: vehicle.climate_state.fan_status,
is_climate_on: vehicle.climate_state.is_climate_on,
@@ -0,0 +1,9 @@
defmodule TeslaMate.Repo.Migrations.AddEstBatteryRangeKm do
use Ecto.Migration
def change do
alter table(:positions) do
add(:est_battery_range_km, :float)
end
end
end