diff --git a/TeslaLogger/Car.cs b/TeslaLogger/Car.cs index 3833ba52e..393991405 100644 --- a/TeslaLogger/Car.cs +++ b/TeslaLogger/Car.cs @@ -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 = ""; diff --git a/TeslaLogger/TelemetryConnection.cs b/TeslaLogger/TelemetryConnection.cs index 666f57082..a5db7774f 100644 --- a/TeslaLogger/TelemetryConnection.cs +++ b/TeslaLogger/TelemetryConnection.cs @@ -12,6 +12,7 @@ using Exceptionless; using Newtonsoft.Json.Linq; using System.Globalization; +using Google.Protobuf.WellKnownTypes; namespace TeslaLogger { @@ -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; } diff --git a/TeslaLogger/TeslaAPIState.cs b/TeslaLogger/TeslaAPIState.cs index 3e80a01a6..e4903e9ca 100644 --- a/TeslaLogger/TeslaAPIState.cs +++ b/TeslaLogger/TeslaAPIState.cs @@ -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) {