Skip to content

Commit

Permalink
fast charger present
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Dec 6, 2024
1 parent d722869 commit 5468ad4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions TeslaLogger/CurrentJSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class CurrentJSON
public double current_time_to_full_charge; // defaults to 0
public bool current_charge_port_door_open; // defaults to false
public string current_charger_brand = "";
public bool current_charger_present; // defaults to false
public bool current_fast_charger_present; // defaults to false

public string current_car_version = "";

Expand Down Expand Up @@ -217,7 +217,7 @@ public void CreateCurrentJSON()
{ "charge_port_door_open", current_charge_port_door_open },
{ "time_to_full_charge", current_time_to_full_charge},
{ "fast_charger_brand", current_charger_brand},
{ "fast_charger_present", current_charger_present},
{ "fast_charger_present", current_fast_charger_present},
{ "car_version", current_car_version },
{ "trip_start", current_trip_start.ToString("t",Tools.ciDeDE) },
{ "trip_start_dt", current_trip_start.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", Tools.ciEnUS) },
Expand Down
6 changes: 5 additions & 1 deletion TeslaLogger/DBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Newtonsoft.Json;
using System.Diagnostics;
using System.Data.Common;
using ZstdSharp.Unsafe;

namespace TeslaLogger
{
Expand Down Expand Up @@ -3315,6 +3316,9 @@ public void StartChargingState(WebHelper wh)
UpdatePosFromCurrentJSON(posid);
}

bool fast_charger_present = wh.fast_charger_present;
if (car.telemetry?.dcCharging == true)
fast_charger_present = true;

int chargeID = GetMaxChargeid(out DateTime chargeStart);
long chargingstateid = 0;
Expand Down Expand Up @@ -3359,7 +3363,7 @@ public void StartChargingState(WebHelper wh)
cmd.Parameters.AddWithValue("@fast_charger_brand", wh.fast_charger_brand);
cmd.Parameters.AddWithValue("@fast_charger_type", wh.fast_charger_type);
cmd.Parameters.AddWithValue("@conn_charge_cable", wh.conn_charge_cable);
cmd.Parameters.AddWithValue("@fast_charger_present", wh.fast_charger_present);
cmd.Parameters.AddWithValue("@fast_charger_present",fast_charger_present);
cmd.Parameters.AddWithValue("@meter_vehicle_kwh_start", meter_vehicle_kwh_start);
cmd.Parameters.AddWithValue("@meter_utility_kwh_start", meter_utility_kwh_start);
cmd.Parameters.AddWithValue("@wheel_type", wh.car.wheel_type);
Expand Down
15 changes: 14 additions & 1 deletion TeslaLogger/TelemetryConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,20 @@ internal class TelemetryConnection

private bool driving;
private bool _acCharging;
private bool dcCharging;
internal bool dcCharging
{
get => _dcCharging;
set
{
if (_dcCharging != value)
{
car.CurrentJSON.current_fast_charger_present = value;
car.CurrentJSON.CreateCurrentJSON();
}
_dcCharging = value;
}
}
private bool _dcCharging;

public DateTime lastDriving = DateTime.MinValue;
public DateTime lastMessageReceived = DateTime.MinValue;
Expand Down

0 comments on commit 5468ad4

Please sign in to comment.