Skip to content

Commit

Permalink
Storing SOC in teslaAPIState for OpenWB...
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Dec 12, 2024
1 parent c4384d0 commit 0956624
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TeslaLogger/Car.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ internal enum HFLMode

private DBHelper dbHelper;

private readonly TeslaAPIState teslaAPIState;
internal readonly TeslaAPIState teslaAPIState;

private bool useTaskerToken = true;
internal string wheel_type = "";
Expand Down
3 changes: 3 additions & 0 deletions TeslaLogger/TelemetryConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Exceptionless;
using Newtonsoft.Json.Linq;
using System.Globalization;
using Google.Protobuf.WellKnownTypes;

namespace TeslaLogger
{
Expand Down Expand Up @@ -553,6 +554,8 @@ private void InsertCharging(dynamic j, DateTime d, string resultContent)
lastSoc = Soc;
lastSocDate = d;

car.teslaAPIState.AddValue("battery_level", "int", value, Tools.ToUnixTime(d), "charge_state");

car.CurrentJSON.current_battery_level = lastSoc;
changed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion TeslaLogger/TeslaAPIState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal TeslaAPIState(Car car)
this.car = car;
}

private void AddValue(string name, string type, object value, long timestamp, string source)
internal void AddValue(string name, string type, object value, long timestamp, string source)
{
lock (TeslaAPIStateLock)
{
Expand Down

0 comments on commit 0956624

Please sign in to comment.