Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add charging_state to VehicleSummary #3471

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/teslamate/vehicles/vehicle/summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do
alias TeslaMate.Log.Car

defstruct ~w(
car display_name state since healthy latitude longitude heading battery_level usable_battery_level
car display_name state since healthy latitude longitude heading battery_level charging_state usable_battery_level
ideal_battery_range_km est_battery_range_km rated_battery_range_km charge_energy_added
speed outside_temp inside_temp is_climate_on is_preconditioning locked sentry_mode
plugged_in scheduled_charging_start_time charge_limit_soc charger_power windows_open doors_open
Expand Down Expand Up @@ -84,6 +84,7 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do

# Charge State
battery_level: charge(vehicle, :battery_level),
charging_state: charge(vehicle, :charging_state),
charge_current_request: charge(vehicle, :charge_current_request),
charge_current_request_max: charge(vehicle, :charge_current_request_max),
charge_energy_added: charge(vehicle, :charge_energy_added),
Expand Down
2 changes: 2 additions & 0 deletions test/teslamate/vehicles/vehicle/charging_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do

assert_receive {:pubsub, {:broadcast, _, _, %Summary{state: :online, since: ^s2}}}

assert_receive {:pubsub, {:broadcast, _, _, %Summary{state: :online}}}
refute_receive _
end

Expand Down Expand Up @@ -151,6 +152,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do

assert_receive {:pubsub, {:broadcast, _, _, %Summary{state: :online}}}

assert_receive {:pubsub, {:broadcast, _, _, %Summary{state: :online}}}
refute_receive _
end

Expand Down
Loading