diff --git a/README.md b/README.md index 005c63417..7e3f2e46b 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,10 @@ You can import your Teslamate data [here](Teslamate-Import/README.md). You can setup a link from Teslalogger to Abetterrouteplanner to avoid giving your Tesla credentials to a 3rd Party. Another benefit is to minimize the possibility to prevent the car from going to sleep if more than one service is using your credentials. [YouTube](https://www.youtube.com/watch?v=00s7Y8Iv2iw) +## Tesla Invoices Download + +All Supercharger invoices will be downloaded automatically in subfolder "\\raspberry\teslalogger\tesla_invoices" on Raspberries or "\TeslaLogger\bin\tesla_invoices" on Docker + ## Translations You can use our [Weblate page](https://hosted.weblate.org/engage/teslalogger/) to help translate Teslalogger into new languages. diff --git a/TeslaLogger/Car.cs b/TeslaLogger/Car.cs index 17f8dfdba..7070bea86 100644 --- a/TeslaLogger/Car.cs +++ b/TeslaLogger/Car.cs @@ -222,6 +222,7 @@ public bool Virtual_key internal string FleetApiAddress = ""; public string _access_type; public bool _virtual_key; + internal bool vehicle_location = true; [MethodImpl(MethodImplOptions.Synchronized)] internal TeslaAPIState GetTeslaAPIState() { return teslaAPIState; } diff --git a/TeslaLogger/ElectricityMeterBase.cs b/TeslaLogger/ElectricityMeterBase.cs index 0eea54d5c..f97762194 100644 --- a/TeslaLogger/ElectricityMeterBase.cs +++ b/TeslaLogger/ElectricityMeterBase.cs @@ -51,6 +51,10 @@ public static ElectricityMeterBase Instance(string type, string host, string par return new ElectricityMeterKeba(host, paramater); else if (type == "evcc") return new ElectricityMeterEVCC(host, paramater); + else if (type == "smartevse3") + return new ElectricityMeterSmartEVSE3(host, paramater); + else if (type == "warp") + return new ElectricityMeterWARP(host, paramater); return null; } diff --git a/TeslaLogger/ElectricityMeterEVCC.cs b/TeslaLogger/ElectricityMeterEVCC.cs index 6d9694ad1..fe3f2976e 100644 --- a/TeslaLogger/ElectricityMeterEVCC.cs +++ b/TeslaLogger/ElectricityMeterEVCC.cs @@ -13,7 +13,8 @@ class ElectricityMeterEVCC : ElectricityMeterBase { string host; string parameter; - string loadpointname; + string loadpointcarname; + internal string api_state; Guid guid; // defaults to new Guid(); static WebClient client; @@ -30,7 +31,7 @@ public ElectricityMeterEVCC(string host, string parameter) if(parameter != null) { - loadpointname = parameter; + loadpointcarname = parameter; } } @@ -38,6 +39,11 @@ string GetCurrentData() { try { + if (api_state != null) + { + return api_state; + } + string cacheKey = "evcc_" + guid.ToString(); object o = MemoryCache.Default.Get(cacheKey); @@ -70,6 +76,39 @@ string GetCurrentData() return ""; } + JToken getLoadPointJson(dynamic json) + { + JToken loadpoint = null; + // loadpointcarname can be vehicle title ("TestCar1", vehicle name ("tsla") or loadpoint name ("Wallbox1") + // Maybe vehicle name? + loadpoint = json.SelectToken($"$.result.loadpoints[?(@.vehicleName == '{loadpointcarname}')]"); + + if (loadpoint == null) + { + // it's not a vehicle name, maybe vehicle title? + foreach (var vehicle in json.result.vehicles) + { + string vehicleTitle = vehicle.Value.title; + string vehicleName = vehicle.Name; + if (vehicleTitle == loadpointcarname) + { + loadpoint = json.SelectToken($"$.result.loadpoints[?(@.vehicleName == '{vehicleName}')]"); + continue; + } + } + // it's also not a vehicle title. Maybe loadpoint title? + if (loadpoint == null) + { + + loadpoint = json.SelectToken($"$.result.loadpoints[?(@.title == '{loadpointcarname}')]"); + if (loadpoint == null) + { + return null; + } + } + } + return loadpoint; + } public override double? GetUtilityMeterReading_kWh() { @@ -86,18 +125,31 @@ string GetCurrentData() if (!Tools.IsPropertyExist(jsonResult, "result")) return null; - Dictionary r1 = jsonResult["result"].ToObject>(); - - if (r1.ContainsKey("gridEnergy")) + JToken grid = jsonResult.SelectToken($"$.result.grid"); + if (grid != null) { - double.TryParse(r1["gridEnergy"].ToString(), out double value); + Dictionary r1 = grid.ToObject>(); - return value; + if (r1.ContainsKey("energy")) + { + double.TryParse(r1["energy"].ToString(), out double value); + return value; + } } else { - return null; + Dictionary r1 = jsonResult["result"].ToObject>(); + + if (r1.ContainsKey("gridEnergy")) + { + double.TryParse(r1["gridEnergy"].ToString(), out double value); + + return value; + } } + return null; + + } catch (Exception ex) { @@ -122,9 +174,12 @@ string GetCurrentData() if (!Tools.IsPropertyExist(jsonResult, "result")) return null; - JToken acme = jsonResult.SelectToken($"$.result.loadpoints[?(@.title == '{loadpointname}')]"); + JToken loadpoint = getLoadPointJson(jsonResult); + + if (loadpoint == null) + return null; - Dictionary r1 = acme.ToObject>(); + Dictionary r1 = loadpoint.ToObject>(); if (r1.ContainsKey("chargeTotalImport")) { @@ -160,9 +215,12 @@ string GetCurrentData() if (!Tools.IsPropertyExist(jsonResult, "result")) return null; - JToken acme = jsonResult.SelectToken($"$.result.loadpoints[?(@.title == '{loadpointname}')]"); + JToken loadpoint = getLoadPointJson(jsonResult); - Dictionary r1 = acme.ToObject>(); + if (loadpoint == null) + return null; + + Dictionary r1 = loadpoint.ToObject>(); if (r1.ContainsKey("sessionPrice") && r1["sessionPrice"] != null) { @@ -200,9 +258,12 @@ string GetCurrentData() if (!Tools.IsPropertyExist(jsonResult, "result")) return null; - JToken acme = jsonResult.SelectToken($"$.result.loadpoints[?(@.title == '{loadpointname}')]"); + JToken loadpoint = getLoadPointJson(jsonResult); + + if (loadpoint == null) + return null; - Dictionary r1 = acme.ToObject>(); + Dictionary r1 = loadpoint.ToObject>(); if (r1.ContainsKey("charging")) { diff --git a/TeslaLogger/ElectricityMeterSmartEVSE3.cs b/TeslaLogger/ElectricityMeterSmartEVSE3.cs new file mode 100644 index 000000000..4aab1c005 --- /dev/null +++ b/TeslaLogger/ElectricityMeterSmartEVSE3.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Runtime.Caching; +using System.Text; +using System.Threading.Tasks; + +using Exceptionless; +using Newtonsoft.Json; + +namespace TeslaLogger +{ + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Keine allgemeinen Ausnahmetypen abfangen", Justification = "")] + class ElectricityMeterSmartEVSE3 : ElectricityMeterBase + { + private string host; + private string paramater; + + internal string mockup_status, mockup_shelly; + + Guid guid; // defaults to new Guid(); + static WebClient client; + + public ElectricityMeterSmartEVSE3(string host, string paramater) + { + this.host = host; + this.paramater = paramater; + + if (client == null) + { + client = new WebClient(); + } + } + + string GetCurrentData() + { + try + { + if (mockup_status != null) + { + return mockup_status; + } + + string cacheKey = "smartevse3_" + guid.ToString(); + object o = MemoryCache.Default.Get(cacheKey); + + if (o != null) + { + return (string)o; + } + + string url = host + "/settings"; + string lastJSON = client.DownloadString(url); + + MemoryCache.Default.Add(cacheKey, lastJSON, DateTime.Now.AddSeconds(10)); + return lastJSON; + } + catch (Exception ex) + { + if (ex is WebException wx) + { + if ((wx.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.NotFound) + { + Logfile.Log(wx.Message); + return ""; + } + + } + if (!WebHelper.FilterNetworkoutage(ex)) + ex.ToExceptionless().FirstCarUserID().Submit(); + + Logfile.Log(ex.ToString()); + } + + return ""; + } + + + public override double? GetUtilityMeterReading_kWh() + { + + string j = null; + try + { + j = GetCurrentData(); + + if (string.IsNullOrEmpty(j)) + return null; + + dynamic jsonResult = JsonConvert.DeserializeObject(j); + + string value = jsonResult["mains_meter"]["import_active_energy"]; + + return Double.Parse(value, Tools.ciEnUS); + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, j); + } + + return null; + } + + public override double? GetVehicleMeterReading_kWh() + { + string j = null; + try + { + j = GetCurrentData(); + + if (string.IsNullOrEmpty(j)) + return null; + + dynamic jsonResult = JsonConvert.DeserializeObject(j); + + string value = jsonResult["ev_meter"]["import_active_energy"]; + + return Double.Parse(value, Tools.ciEnUS); + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, j); + } + + return null; + } + + public override bool? IsCharging() + { + string j = null; + try + { + j = GetCurrentData(); + + dynamic jsonResult = JsonConvert.DeserializeObject(j); + if (jsonResult == null) + return null; + + return jsonResult["evse"]["state_id"] == 2 ? true : false; + + + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, j); + } + + return null; + } + + public override string GetVersion() + { + string j = null; + try + { + j = GetCurrentData(); + + dynamic jsonResult = JsonConvert.DeserializeObject(j); + if (jsonResult == null) + return null; + + string fwversion = jsonResult["version"]; + + return fwversion; + } + catch (Exception ex) + { + if (!WebHelper.FilterNetworkoutage(ex)) + ex.ToExceptionless().FirstCarUserID().Submit(); + + Logfile.ExceptionWriter(ex, j); + } + + return ""; + } + } +} \ No newline at end of file diff --git a/TeslaLogger/ElectricityMeterWARP.cs b/TeslaLogger/ElectricityMeterWARP.cs new file mode 100644 index 000000000..5e752ca42 --- /dev/null +++ b/TeslaLogger/ElectricityMeterWARP.cs @@ -0,0 +1,226 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Net; +using System.Linq; +using System.Runtime.Caching; +using Exceptionless; +using Newtonsoft.Json; + +namespace TeslaLogger +{ + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Keine allgemeinen Ausnahmetypen abfangen", Justification = "")] + class ElectricityMeterWARP : ElectricityMeterBase + { + string host; + string parameter; + internal int wallboxMeterId = 0; + internal int wallboxValueId = 209; + internal int gridMeterId = 1; + internal int gridValueId = 209; + + internal string mockup_info_version; + internal string mockup_evse_state; + internal string mockup_wallbox_value_ids; + internal string mockup_wallbox_values; + internal string mockup_grid_value_ids; + internal string mockup_grid_values; + + + static WebClient client; + + public ElectricityMeterWARP(string host, string parameter) + { + if (client == null) + { + client = new WebClient(); + } + + this.host = host; + this.parameter = parameter; + + /*Example parameters: + "": wallbox internal meter with ID 0, value_id=209 and grid meter ID 1, value_id=209 + "W:2:210": only wallbox meter with ID 2 and value_id=210 + "G:2|W:0:210": Grid meter with ID 2 and default value_id=209, wallbox meter with ID 0 and value_id=210 + + Default wallbox meter ID is 0 + Default grid meter ID is 1 + Default "energy import" ID is 209 + */ + + var args = parameter.Split('|'); + foreach (var p in args) + { + if (p.StartsWith("W", StringComparison.InvariantCultureIgnoreCase)) + { + string[] parts = p.Split(':'); + wallboxMeterId = parts.Length > 1 && int.TryParse(parts[1], out var tempMeterId) ? tempMeterId : 0; + wallboxValueId = parts.Length > 2 && int.TryParse(parts[2], out var tempValueId) ? tempValueId : 209; + } + if (p.StartsWith("G", StringComparison.InvariantCultureIgnoreCase)) + { + string[] parts = p.Split(':'); + gridMeterId = parts.Length > 1 && int.TryParse(parts[1], out var tempMeterId) ? tempMeterId : 1; + gridValueId = parts.Length > 2 && int.TryParse(parts[2], out var tempValueId) ? tempValueId : 209; + } + } + } + + public override double? GetUtilityMeterReading_kWh() + { + string value_ids = null; + string values = null; + + try + { + if (mockup_grid_value_ids == null && mockup_grid_values == null) + { + if (host == null) + return double.NaN; + + string url1 = host + $"/meters/{gridMeterId}/value_ids"; + value_ids = client.DownloadString(url1).Trim(); + + string url2 = host + $"/meters/{gridMeterId}/values"; + values = client.DownloadString(url2).Trim(); + } + else + { + value_ids = mockup_grid_value_ids; + values = mockup_grid_values; + } + + List ids = value_ids.Trim('[', ']').Split(',').Select(int.Parse).ToList(); + int position = ids.IndexOf(gridValueId); + + List value = values.Trim('[', ']').Split(',').Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToList(); + + if (position >= 0 && position < value.Count) + { + return value[position]; + } + + return double.NaN; + + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, values); + } + return double.NaN; + } + + public override double? GetVehicleMeterReading_kWh() + { + string value_ids = null; + string values = null; + + try + { + if (mockup_wallbox_value_ids == null && mockup_wallbox_values == null) + { + if (host == null) + return double.NaN; + + string url1 = host + $"/meters/{wallboxMeterId}/value_ids"; + value_ids = client.DownloadString(url1).Trim(); + + string url2 = host + $"/meters/{wallboxMeterId}/values"; + values = client.DownloadString(url2).Trim(); + } + else + { + value_ids = mockup_wallbox_value_ids; + values = mockup_wallbox_values; + } + + List ids = value_ids.Trim('[', ']').Split(',').Select(int.Parse).ToList(); + int position = ids.IndexOf(wallboxValueId); + + List value = values.Trim('[', ']').Split(',').Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToList(); + + if (position >= 0 && position < value.Count) + { + return value[position]; + } + + return double.NaN; + + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, values); + } + return double.NaN; + } + + public override bool? IsCharging() + { + string evse_state = null; + + try + { + if (mockup_evse_state == null && host != null) + { + string url = host + "/evse/state"; + evse_state = client.DownloadString(url).Trim(); + } + else + { + evse_state = mockup_evse_state; + } + + + dynamic jsonResult = JsonConvert.DeserializeObject(evse_state); + + if (jsonResult == null) + return null; + + return jsonResult["charger_state"] == 3 ? true : false; + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, evse_state); + } + return null; + } + + public override string GetVersion() + { + string info_version = null; + + try + { + if (mockup_info_version == null && host != null) + { + string url = host + "/info/version"; + info_version = client.DownloadString(url).Trim(); + } + else + { + info_version = mockup_info_version; + } + + + dynamic jsonResult = JsonConvert.DeserializeObject(info_version); + string value = jsonResult["firmware"]; + + if (value == null) + return ""; + + return value; + } + catch (Exception ex) + { + ex.ToExceptionless().FirstCarUserID().Submit(); + Logfile.ExceptionWriter(ex, info_version); + } + + return ""; + } + } +} diff --git a/TeslaLogger/Properties/AssemblyInfo.cs b/TeslaLogger/Properties/AssemblyInfo.cs index ea0119ba5..b72c5af86 100644 --- a/TeslaLogger/Properties/AssemblyInfo.cs +++ b/TeslaLogger/Properties/AssemblyInfo.cs @@ -32,8 +32,8 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.62.10.0")] -[assembly: AssemblyFileVersion("1.62.10.0")] +[assembly: AssemblyVersion("1.62.14.0")] +[assembly: AssemblyFileVersion("1.62.14.0")] [assembly: InternalsVisibleTo("UnitTestsTeslaloggerNET8")] [assembly: InternalsVisibleTo("UnitTestsTeslalogger")] \ No newline at end of file diff --git a/TeslaLogger/TelemetryParser.cs b/TeslaLogger/TelemetryParser.cs index 4c2f1f9ba..6029015a1 100644 --- a/TeslaLogger/TelemetryParser.cs +++ b/TeslaLogger/TelemetryParser.cs @@ -31,6 +31,7 @@ public class TelemetryParser public double lastSoc = 0.0; public double lastChargingPower = 0.0; + double lastDCChargingPower = 0.0; public String lastChargeState = ""; @@ -92,6 +93,8 @@ public void InitFromDB() private bool driving; private bool _acCharging; + private string lastDetailedChargeState; + internal bool dcCharging { get => _dcCharging; @@ -364,6 +367,36 @@ private void InsertStates(dynamic j, DateTime d, string resultContent) car.CurrentJSON.CreateCurrentJSON(); } } + else if (key == "ExpectedEnergyPercentAtTripArrival") + { + try + { + int? v = value["intValue"]; + car.CurrentJSON.active_route_energy_at_arrival = v; + car.CurrentJSON.CreateCurrentJSON(); + } + catch (Exception ex) + { + ex.ToExceptionless().Submit(); + Log(ex.ToString()); + } + + } + else if (key == "RouteTrafficMinutesDelay") + { + try + { + double v = value["doubleValue"]; + + car.CurrentJSON.active_route_traffic_minutes_delay = v; + car.CurrentJSON.CreateCurrentJSON(); + } + catch (Exception ex) + { + ex.ToExceptionless().Submit(); + Log(ex.ToString()); + } + } else if (key == "BatteryHeaterOn") { /* @@ -382,20 +415,23 @@ private void InsertStates(dynamic j, DateTime d, string resultContent) if (double.TryParse(v, NumberStyles.Any, CultureInfo.InvariantCulture, out double pressure)) { pressure = Math.Round(pressure, 2); - switch (suffix) + if (databaseCalls) { - case "Fl": - car.DbHelper.InsertTPMS(1, pressure, d); - break; - case "Fr": - car.DbHelper.InsertTPMS(2, pressure, d); - break; - case "Rl": - car.DbHelper.InsertTPMS(3, pressure, d); - break; - case "Rr": - car.DbHelper.InsertTPMS(4, pressure, d); - break; + switch (suffix) + { + case "Fl": + car.DbHelper.InsertTPMS(1, pressure, d); + break; + case "Fr": + car.DbHelper.InsertTPMS(2, pressure, d); + break; + case "Rl": + car.DbHelper.InsertTPMS(3, pressure, d); + break; + case "Rr": + car.DbHelper.InsertTPMS(4, pressure, d); + break; + } } } } @@ -555,8 +591,20 @@ private void InsertStates(dynamic j, DateTime d, string resultContent) else if (key == "DetailedChargeState") { string DetailedChargeState = value["detailedChargeStateValue"]; + if (!String.IsNullOrEmpty(DetailedChargeState)) { + lastDetailedChargeState = DetailedChargeState; + + CheckDetailedChargeState(d); + + if (IsCharging && DetailedChargeState == "DetailedChargeStateStopped") + { + Log("Stop Charging by DetailedChargeState"); + acCharging = false; + dcCharging = false; + } + if (DetailedChargeState.Contains("DetailedChargeStateNoPower") || DetailedChargeState.Contains("DetailedChargeStateStarting") || DetailedChargeState.Contains("DetailedChargeStateCharging") || @@ -579,6 +627,29 @@ private void InsertStates(dynamic j, DateTime d, string resultContent) } } + private void CheckDetailedChargeState(DateTime d) + { + if (!IsCharging && lastDetailedChargeState == "DetailedChargeStateCharging") + { + if (lastFastChargerPresent) + { + if (lastPackCurrent > 1 || lastDCChargingPower > 1) + { + Log("Start DC Charging by DetailedChargeState Packcurrent: " + lastPackCurrent); + StartDCCharging(d); + } + } + else + { + if (lastPackCurrent > 1 || ACChargingPower > 1) + { + Log("Start AC Charging by DetailedChargeState Packcurrent: " + lastPackCurrent); + StartACCharging(d); + } + } + } + } + private void InsertCharging(dynamic j, DateTime d, string resultContent) { double ChargingEnergyIn = double.NaN; @@ -673,6 +744,7 @@ private void InsertCharging(dynamic j, DateTime d, string resultContent) string v1 = value["stringValue"]; if (double.TryParse(v1, out double ChargingPower)) { + lastDCChargingPower = ChargingPower; lastChargingPower = ChargingPower; car.CurrentJSON.current_charger_power = Math.Round(ChargingPower, 2); changed = true; @@ -685,6 +757,7 @@ private void InsertCharging(dynamic j, DateTime d, string resultContent) { lastIdealBatteryRange = Tools.MlToKm(IdealBatteryRange, 1); car.CurrentJSON.current_ideal_battery_range_km = lastIdealBatteryRange; + car.CurrentJSON.current_battery_range_km = lastIdealBatteryRange; changed = true; } } @@ -1173,6 +1246,8 @@ private void InsertBatteryTable(dynamic j, DateTime date, string resultContent) lastPackCurrent = d; lastPackCurrentDate = date; + CheckDetailedChargeState(date); + if (!acCharging && lastChargeState == "Enable") { var current = PackCurrent(j, date); diff --git a/TeslaLogger/TeslaLogger.csproj b/TeslaLogger/TeslaLogger.csproj index 62d12c977..311f0f25d 100644 --- a/TeslaLogger/TeslaLogger.csproj +++ b/TeslaLogger/TeslaLogger.csproj @@ -148,6 +148,8 @@ + + @@ -210,6 +212,7 @@ + diff --git a/TeslaLogger/WebHelper.cs b/TeslaLogger/WebHelper.cs index 58fd917fc..3b51381da 100644 --- a/TeslaLogger/WebHelper.cs +++ b/TeslaLogger/WebHelper.cs @@ -5677,9 +5677,67 @@ internal string Tesla_token set { tesla_token = StringCipher.Decrypt(value); + if (car.FleetAPI) + { + try + { + var ok = CheckJWT(tesla_token, out bool vehicle_location, out bool offline_access); + if (ok) + { + car.Log("vehicle_location: " + vehicle_location); + car.Log("offline_access: " + offline_access); + car.vehicle_location = vehicle_location; + } + } + catch (Exception ex) + { + ex.ToExceptionless().Submit(); + Logfile.Log(ex.ToString()); + } + } } } + public static bool CheckJWT(string jwt, out bool vehicle_location, out bool offline_access) + { + vehicle_location = false; + offline_access = false; + + if (jwt == "NULL") + return false; + + try + { + var j = jwt.Split('.'); + var pl = j[1].Replace('-', '+').Replace('_', '/'); + switch (pl.Length % 4) + { + case 2: pl += "=="; break; + case 3: pl += "="; break; + } + var payload = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(pl)); + dynamic d = JsonConvert.DeserializeObject(payload); + JArray scp = d["scp"]; + + List scopes = scp.ToObject>(); + + if (scopes.Contains("vehicle_location")) + vehicle_location = true; + + if (scopes.Contains("offline_access")) + offline_access = true; + + return true; + } + catch (Exception ex) + { + ex.ToExceptionless().Submit(); + Logfile.Log(ex.ToString()); + } + + return false; + } + private void Log(string text) { car.Log(text); diff --git a/TeslaLogger/WebServer.cs b/TeslaLogger/WebServer.cs index 32494aac9..3e9ae338e 100644 --- a/TeslaLogger/WebServer.cs +++ b/TeslaLogger/WebServer.cs @@ -3272,6 +3272,7 @@ private static void Admin_GetAllCars(HttpListenerRequest request, HttpListenerRe dt.Columns.Add("SupportedByFleetTelemetry"); dt.Columns.Add("inactive"); + dt.Columns.Add("vehicle_location"); foreach (DataRow dr in dt.Rows) { @@ -3279,7 +3280,10 @@ private static void Admin_GetAllCars(HttpListenerRequest request, HttpListenerRe { Car c = Car.GetCarByID(Convert.ToInt32(dr["id"])); if (c != null) + { dr["SupportedByFleetTelemetry"] = c.SupportedByFleetTelemetry() ? 1 : 0; + dr["vehicle_location"] = c.vehicle_location; + } else dr["inactive"] = 1; } diff --git a/TeslaLogger/bin/TeslaLogger.exe b/TeslaLogger/bin/TeslaLogger.exe index b46ac86bc..337e34eb6 100644 Binary files a/TeslaLogger/bin/TeslaLogger.exe and b/TeslaLogger/bin/TeslaLogger.exe differ diff --git a/TeslaLogger/bin/TeslaLogger.pdb b/TeslaLogger/bin/TeslaLogger.pdb index f2e59cca7..fbe2d9449 100644 Binary files a/TeslaLogger/bin/TeslaLogger.pdb and b/TeslaLogger/bin/TeslaLogger.pdb differ diff --git a/TeslaLogger/bin/changelog.md b/TeslaLogger/bin/changelog.md index 291274e55..7414d11d8 100644 --- a/TeslaLogger/bin/changelog.md +++ b/TeslaLogger/bin/changelog.md @@ -1,6 +1,13 @@ -# Version 1.62.10 +# Version 1.62.14 - Bugfixes +# Version 1.62.13 +- Tesla has introduced more granular control over data access: [LINK](https://developer.tesla.com/docs/fleet-api/announcements#2024-11-26-introducing-a-new-oauth-scope-vehicle-location) + Third-party apps can request permission to access location information. Starting in March 2025, no location information will be shared unless you grant the necessary permission. + +# Version 1.62.12 +- Fleet API: new signals: ExpectedEnergyPercentAtTripArrival and ExpectedEnergyPercentAtTripEnd + # Version 1.62.5 - Detect Model Y LR RWD - BF: Split drives diff --git a/TeslaLogger/bin/geofence.csv b/TeslaLogger/bin/geofence.csv index f72e54ae4..0ddfd1c54 100644 --- a/TeslaLogger/bin/geofence.csv +++ b/TeslaLogger/bin/geofence.csv @@ -8,6 +8,7 @@ Supercharger-V3 AT-Eberstalzell,48.039338,13.991089 Supercharger-V3 AT-Hall in Tirol,47.276897,11.469074 Supercharger-V3 AT-Hall in Tirol,47.273290,11.475335 Supercharger-V4 AT-Heiterwang,47.437165,10.766143,30 +Supercharger-V4 AT-Inning,48.183622,15.417924,30 Supercharger AT-Innsbruck, 47.264882, 11.428380 Supercharger-V3 AT-Kalwang, 47.422813, 14.759271 Supercharger AT-Kapfenberg, 47.450188, 15.317675 @@ -18,6 +19,7 @@ Supercharger AT-Lermoos, 47.394965, 10.887519 Supercharger AT-Lermoos, 47.395975, 10.887217 Supercharger AT-Liezen, 47.559370, 14.252606 Supercharger-V4 AT-Meggenhofen,48.183502,13.785966 +Supercharger-V4 AT-Parndorf,47.979209,16.844067,20 Supercharger AT-Poysdorf, 48.676534, 16.623013 Supercharger-V3 AT-Rankweil, 47.273, 9.617555 Supercharger AT-Salzburg, 47.727056, 13.060672 diff --git a/TeslaLogger/bin/language-de.txt b/TeslaLogger/bin/language-de.txt index 9de6ce0d2..41eea021f 100644 --- a/TeslaLogger/bin/language-de.txt +++ b/TeslaLogger/bin/language-de.txt @@ -1,8 +1,8 @@ #Info INFO_important="Wichtige Info" INFO_FLEETAPI="Tesla wird ab dem 01.01.2025 die offizielle Fleet API in ein Bezahlmodell umwandeln ({LINK1}). Aus diesem Grund bin ich gezwungen, auf ein Abomodell umzusteigen und monatlich eine geringe Gebühr zu verlangen, um meine Ausgaben für Tesla, Steuern und den Zahlungsdienstleister zu decken.
Gleichzeitig verpflichten mich Teslas AGBs ({LINK2}), die inoffizielle Owners API aufzugeben, da Tesla ansonsten rechtliche Schritte gegen mich einleiten könnte (§5.6.6 und §5.6.11). Bitte wechselt eure Fahrzeuge von der Owners API zur Fleet API, indem ihr eure Zugangsdaten erneut eingebt.

Für die älteren Model S/X (Baujahr vor 2021) gibt es jedoch keine Lösung für die Nutzung der Fleet API. Diese Fahrzeuge können weiterhin über die alte Owners API betrieben werden. Ich gehe davon aus, dass Tesla in diesen Fällen keine rechtlichen Schritte einleiten wird. Für diese Fahrzeuge könnt ihr dennoch ein Abo abschließen, was jedoch eher als freiwillige Spende zu verstehen ist, da ich dafür keine Gebühren an Tesla zahlen muss.

Da Tesla mit der Fleet API sowohl ihre Server entlasten als auch Einnahmen generieren möchte, besteht die Möglichkeit, dass die inoffizielle Owners API am 01.01.2025 abgeschaltet wird. Wir hoffen, dass die älteren Model S/X davon nicht betroffen sein werden." - INFO_RESTRICTED="Ohne ein aktives Abonnement können wir die Kosten für deinen Tesla leider nicht tragen. Daher sehen wir uns gezwungen, die Funktionalität und insbesondere die Übermittlungsfrequenz der Positionsdaten erheblich einzuschränken." +INFO_VEHICLE_LOCATION="Tesla hat eine feinere Kontrolle des Datenzugriffs eingeführt: {LINK1}
Drittanbieter APPs können das Recht der Standortinformationen beantragen. Du hast das Rechnt noch nicht erteilt. Ab März 2025 werden keine Standortinformationen mehr verschickt, wenn du das Recht nicht erteilst. Bitte melde dich nochmal an: {LINK2}." #Allgemein Delete=Löschen diff --git a/TeslaLogger/bin/language-en.txt b/TeslaLogger/bin/language-en.txt index 44d2a198e..77cfe63e5 100644 --- a/TeslaLogger/bin/language-en.txt +++ b/TeslaLogger/bin/language-en.txt @@ -2,6 +2,7 @@ INFO_important="Important Info" INFO_FLEETAPI="Starting January 1, 2025, Tesla will transition the official Fleet API to a paid model ({LINK1}). As a result, I am forced to switch to a subscription model and charge a small monthly fee to cover my expenses for Tesla, taxes, and the payment service provider.

At the same time, Tesla’s Terms of Service ({LINK2}) compel me to discontinue the use of the unofficial Owners API; otherwise, they could take legal action against me (§5.6.6 and §5.6.11). Please migrate your vehicles from the Owners API to the Fleet API by re-entering your login credentials.

Unfortunately, for older Model S/X vehicles (manufactured before 2021), there is no solution to use the Fleet API. These vehicles can continue to operate via the old Owners API, and I don’t expect Tesla to take any legal action in such cases. However, you can still choose to subscribe for these vehicles as a form of donation, since I don’t have to pay Tesla for their usage.

Since Tesla aims to reduce server load and generate revenue with the Fleet API, it is likely that the unofficial Owners API will be shut down on January 1, 2025. We hope that older Model S/X vehicles will not be affected by this change." INFO_RESTRICTED="Without an active subscription, we unfortunately cannot cover the costs for your Tesla. Therefore, we are forced to significantly limit the functionality and, in particular, the frequency of position updates." +INFO_VEHICLE_LOCATION="Tesla has introduced more granular control over data access: {LINK1}
Third-party apps can request permission to access location information. You have not yet granted this permission. Starting in March 2025, no location information will be shared unless you grant the necessary permission. Please log in again: {LINK2}." #Akku Trips.json Akku Trips=Battery Usage (Driving) diff --git a/TeslaLogger/bin/language-ru.txt b/TeslaLogger/bin/language-ru.txt index 965f2be87..a7d33e742 100644 --- a/TeslaLogger/bin/language-ru.txt +++ b/TeslaLogger/bin/language-ru.txt @@ -1,6 +1,6 @@ #Общий Delete=Удалить -Save=Сохранять +Save="Сохранить" Settings=Настройки Setup=Настраивать Enabled="Включено" @@ -310,8 +310,8 @@ MyTesla=MyTesla Teslalogger Adminpanel=Панель администратора теслалоггера Temperature=Температура mile=миля -Ideal=Идеально -Rated=Номинальный +Ideal="расчетный" +Rated="идеальный" Share data anonymously=Делитесь данными анонимно Sleep=Сон to=на diff --git a/TeslaLogger/www/admin/info.php b/TeslaLogger/www/admin/info.php index 6d67a2057..0f8feb414 100644 --- a/TeslaLogger/www/admin/info.php +++ b/TeslaLogger/www/admin/info.php @@ -6,8 +6,11 @@ function ShowInfo() session_start(); } global $fleetapiinfo; + global $vehicle_location; + global $carVIN; $fileinfofleetapi = "/tmp/fleetapiinfo".date("Y-m-d").".txt"; + $filevehicle_location = "/tmp/vehicle_location-$carid-".date("Y-m-d").".txt"; $prefix = "/etc/teslalogger/"; if (isDocker()) $prefix = "/tmp/"; @@ -34,6 +37,24 @@ function ShowInfo() LINK", $tinfo); + $tinfo=str_replace("{LINK2}", "LINK", $tinfo); + ?> + + $("#InfoText").html("

"); + $(".HeaderT").show(); + $("#PositiveButton").text(""); + $("#PositiveButton").click(function(){location.reload();}); + $("#NegativeButton").text(""); + $("#NegativeButton").click(function(){window.location.href='';}); + + $("#InfoText").html("

"); diff --git a/TeslaLogger/www/admin/menu.php b/TeslaLogger/www/admin/menu.php index 487d8c8a1..c93b02a4a 100644 --- a/TeslaLogger/www/admin/menu.php +++ b/TeslaLogger/www/admin/menu.php @@ -31,6 +31,7 @@ function menu($title, $prefix = "") global $carVIN; global $fleetapiinfo; global $car_inactive; + global $vehicle_location; $current_carid = $_SESSION["carid"]; if (!isset($current_carid)) @@ -52,6 +53,7 @@ function menu($title, $prefix = "") $car = $v->{"model_name"}; $carVIN = $v->{"vin"}; $car_inactive = $v->{"inactive"}; + $vehicle_location = $v->{"vehicle_location"}; if (strlen($display_name) == 0) $display_name = "Car ".$v->{"id"}; diff --git a/TeslaLogger/www/admin/wallbox.php b/TeslaLogger/www/admin/wallbox.php index 8926fcc5c..212715f25 100644 --- a/TeslaLogger/www/admin/wallbox.php +++ b/TeslaLogger/www/admin/wallbox.php @@ -121,9 +121,11 @@ function btn_save_click() + + : diff --git a/UnitTestsTeslalogger/UnitTestBase.cs b/UnitTestsTeslalogger/UnitTestBase.cs index 63f0ce048..eb4eb7ba3 100644 --- a/UnitTestsTeslalogger/UnitTestBase.cs +++ b/UnitTestsTeslalogger/UnitTestBase.cs @@ -1470,5 +1470,22 @@ public void IsInUnitTest() var inTest = Tools.IsUnitTest(); Assert.IsTrue(inTest, "Should detect that we are in unit test"); } + + [TestMethod] + public void TestJWT1() + { + string token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InFEc3NoM2FTV0cyT05YTTdLMzFWV0VVRW5BNCJ9.eyJpc3MiOiJodHRwczovL2F1dGgudGVzbGEuY29tL29hdXRoMi92My9udHMiLCJhenAiOiI5MWQ0ZGEyYTM0NjgtNGI4MS1hZGJhLWQyYjI3MWJlZGZhMiIsInN1YiI6ImVhZTU4YzE4LWRiODEtNGZhZC05NDU2LTJiZDJhOWYyZjg0MCIsImF1ZCI6WyJodHRwczovL2ZsZWV0LWFwaS5wcmQubmEudm4uY2xvdWQudGVzbGEuY29tIiwiaHR0cHM6Ly9mbGVldC1hcGkucHJkLmV1LnZuLmNsb3VkLnRlc2xhLmNvbSIsImh0dHBzOi8vYXV0aC50ZXNsYS5jb20vb2F1dGgyL3YzL3VzZXJpbmZvIl0sInNjcCI6WyJvZmZsaW5lX2FjY2VzcyIsIm9wZW5pZCIsInVzZXJfZGF0YSIsInZlaGljbGVfZGV2aWNlX2RhdGEiLCJ2ZWhpY2xlX2NtZHMiLCJ2ZWhpY2xlX2NoYXJnaW5nX2NtZHMiXSwiYW1yIjpbInB3ZCIsIm1mYSIsIm90cCJdLCJleHAiOjE3MzgwNzA4ODQsImlhdCI6MTczODA0MjA4NCwib3VfY29kZSI6IkVVIiwibG9jYWxlIjoiZGEtREsiLCJhY2NvdW50X3R5cGUiOiJidXNpbmVzcyIsIm9wZW5fc291cmNlIjpudWxsLCJhY2NvdW50X2lkIjoiNGZjZTM3OWMtMmU0NS00Y2Y0LTkwYmMtNDZhMzE5MTZkZDE0IiwiYXV0aF90aW1lIjoxNzM4MDQyMDg0LCJub25jZSI6bnVsbH0.XXXXXXXXXXXXXX"; + WebHelper.CheckJWT(token, out bool vehicle_location, out bool offline_access); + Assert.IsFalse(vehicle_location); + Assert.IsTrue(offline_access); + } + [TestMethod] + public void TestJWT2() + { + string token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InFEc3NoM2FTV0cyT05YTTdLMzFWV0VVRW5BNCJ9.eyJpc3MiOiJodHRwczovL2F1dGgudGVzbGEuY29tL29hdXRoMi92My9udHMiLCJhenAiOiI5MWQ0ZGEyYTM0NjgtNGI4MS1hZGJhLWQyYjI3MWJlZGZhMiIsInN1YiI6IjQ0ZjBjYTA5LTk0OGQtNDgxNy1hMWQ4LWMzNjM0YWY3MmNhYiIsImF1ZCI6WyJodHRwczovL2ZsZWV0LWFwaS5wcmQubmEudm4uY2xvdWQudGVzbGEuY29tIiwiaHR0cHM6Ly9mbGVldC1hcGkucHJkLmV1LnZuLmNsb3VkLnRlc2xhLmNvbSIsImh0dHBzOi8vYXV0aC50ZXNsYS5jb20vb2F1dGgyL3YzL3VzZXJpbmZvIl0sInNjcCI6WyJ1c2VyX2RhdGEiLCJ2ZWhpY2xlX2RldmljZV9kYXRhIiwidmVoaWNsZV9sb2NhdGlvbiIsInZlaGljbGVfY21kcyIsInZlaGljbGVfY2hhcmdpbmdfY21kcyIsIm9mZmxpbmVfYWNjZXNzIiwib3BlbmlkIl0sImFtciI6WyJwd2QiXSwiZXhwIjoxNzM4MDgxMzIzLCJpYXQiOjE3MzgwNTI1MjMsIm91X2NvZGUiOiJFVSIsImxvY2FsZSI6ImRlLURFIiwiYWNjb3VudF90eXBlIjoiYnVzaW5lc3MiLCJvcGVuX3NvdXJjZSI6bnVsbCwiYWNjb3VudF9pZCI6IjRmY2UzNzljLTJlNDUtNGNmNC05MGJjLTQ2YTMxOTE2ZGQxNCIsImF1dGhfdGltZSI6MTczODA1MjUyMywibm9uY2UiOm51bGx9.XXXXXXXXXX"; + WebHelper.CheckJWT(token, out bool vehicle_location, out bool offline_access); + Assert.IsTrue(vehicle_location); + Assert.IsTrue(offline_access); + } } } diff --git a/UnitTestsTeslalogger/UnitTestCO2.cs b/UnitTestsTeslalogger/UnitTestCO2.cs index 4df9d666d..765f920ca 100644 --- a/UnitTestsTeslalogger/UnitTestCO2.cs +++ b/UnitTestsTeslalogger/UnitTestCO2.cs @@ -70,14 +70,14 @@ public void TestFR() public void TestCH() { int c = co2.GetData("ch", dateTime); - Assert.AreEqual(153, c, 10); + Assert.AreEqual(153, c, 20); } [TestMethod] public void TestAT() { int c = co2.GetData("at", dateTime); - Assert.AreEqual(414, c, 10); + Assert.AreEqual(414, c, 20); } [TestMethod] @@ -98,21 +98,21 @@ public void TestRO() public void TestPT() { int c = co2.GetData("pt", dateTime); - Assert.AreEqual(125, c, 10); + Assert.AreEqual(125, c, 20); } [TestMethod] public void TestES() { int c = co2.GetData("es", dateTime); - Assert.AreEqual(140, c, 10); + Assert.AreEqual(140, c, 30); } [TestMethod] public void TestBE() { int c = co2.GetData("be", dateTime); - Assert.AreEqual(201, c, 10); + Assert.AreEqual(201, c, 20); } [TestMethod] public void TestDK() @@ -124,7 +124,7 @@ public void TestDK() public void TestHR() { int c = co2.GetData("hr", dateTime); - Assert.AreEqual(336, c, 10); + Assert.AreEqual(336, c, 35); } [TestMethod] public void TestCZ() @@ -148,7 +148,7 @@ public void TestNL() public void TestNO() { int c = co2.GetData("no", dateTime); - Assert.AreEqual(47, c, 10); + Assert.AreEqual(47, c, 20); } [TestMethod] public void TestSI() @@ -178,7 +178,7 @@ public void TestUK() public void TestPL() { int c = co2.GetData("pl", dateTime); - Assert.AreEqual(719, c, 10); + Assert.AreEqual(719, c, 20); } [TestMethod] @@ -192,7 +192,7 @@ public void TestFI() public void TestSK() { int c = co2.GetData("sk", dateTime); - Assert.AreEqual(363, c, 10); + Assert.AreEqual(363, c, 20); } [TestMethod] @@ -206,14 +206,14 @@ public void TestBG() public void TestEE() { int c = co2.GetData("ee", dateTime); - Assert.AreEqual(767, c, 10); + Assert.AreEqual(767, c, 130); } [TestMethod] public void TestLV() { int c = co2.GetData("lv", dateTime); - Assert.AreEqual(490, c, 10); + Assert.AreEqual(490, c, 55); } [TestMethod] diff --git a/UnitTestsTeslalogger/UnitTestTelemetryParser.cs b/UnitTestsTeslalogger/UnitTestTelemetryParser.cs index e1483ff9e..5b3813352 100644 --- a/UnitTestsTeslalogger/UnitTestTelemetryParser.cs +++ b/UnitTestsTeslalogger/UnitTestTelemetryParser.cs @@ -66,8 +66,66 @@ public void ACCharging1() AssertStates(telemetry, i, lines[i]); } + + Assert.AreEqual(1.66, c.CurrentJSON.current_charge_energy_added); + Assert.AreEqual(1.66, telemetry.charge_energy_added); + Assert.AreEqual(72.6, telemetry.lastSoc, 0.1); } + [TestMethod] + public void ACCharging2() + { + Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "5YJ3E7EA3LF700000", "", null, false); + + var telemetry = new TelemetryParser(c); + telemetry.databaseCalls = false; + telemetry.handleACChargeChange += Telemetry_handleACChargeChange; + + var lines = LoadData("../../testdata/ACCharging2.txt"); + + for (int i = 0; i < lines.Count; i++) + { + if (i == 6) + expectedACCharge = true; // PackCurrent: 16.8 + + telemetry.handleMessage(lines[i]); + + AssertStates(telemetry, i, lines[i]); + } + + Assert.AreEqual(0.08, c.CurrentJSON.current_charge_energy_added, 0.01); + Assert.AreEqual(0.08, telemetry.charge_energy_added); + Assert.AreEqual(5.3, telemetry.lastSoc, 0.1); + } + + [TestMethod] + public void ChargingDetailedWithoutChargingState() + { + Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "5YJ3E7EA3LF700000", "", null, false); + + var telemetry = new TelemetryParser(c); + telemetry.databaseCalls = false; + telemetry.handleACChargeChange += Telemetry_handleACChargeChange; + + var lines = LoadData("../../testdata/ChargingDetailedWithoutChargingState.txt"); + + for (int i = 0; i < lines.Count; i++) + { + if (!lines[i].Contains("\"data\"")) + continue; + + if (i == 21) + expectedACCharge = true; // DetailedChargingState + else if (i == 67) + expectedACCharge = false; // DetailedChargingState + + telemetry.handleMessage(lines[i]); + + AssertStates(telemetry, i, lines[i]); + } + } + + [TestMethod] public void ACChargingJustPreheating() { @@ -147,6 +205,33 @@ public void DCCharging2() Assert.AreEqual(10.4, c.CurrentJSON.current_charge_energy_added); Assert.AreEqual(10.4, telemetry.charge_energy_added); + Assert.AreEqual(14.4, telemetry.lastSoc, 0.1); + } + + [TestMethod] + public void DCCharging3() + { + Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "5YJ3E7EA3LF700000", "", null, false); + + var telemetry = new TelemetryParser(c); + telemetry.databaseCalls = false; + telemetry.handleACChargeChange += Telemetry_handleACChargeChange; + + var lines = LoadData("../../testdata/DCCharging3.txt"); + + for (int i = 0; i < lines.Count; i++) + { + if (i == 19) + expectedDCCharge = true; + + telemetry.handleMessage(lines[i]); + + AssertStates(telemetry, i, lines[i]); + } + + Assert.AreEqual(9.44, c.CurrentJSON.current_charge_energy_added); + Assert.AreEqual(9.44, telemetry.charge_energy_added); + Assert.AreEqual(31.9, telemetry.lastSoc, 0.1); } [TestMethod] @@ -214,6 +299,80 @@ public void PluggedInNotChargingPrecondition() } } + [TestMethod] + public void Route() + { + Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "5YJ3E7EA3LF700000", "", null, false); + + var telemetry = new TelemetryParser(c); + telemetry.databaseCalls = false; + telemetry.handleACChargeChange += Telemetry_handleACChargeChange; + + var lines = LoadData("../../testdata/Route.txt"); + + for (int i = 0; i < lines.Count; i++) + { + telemetry.handleMessage(lines[i]); + if (i == 0) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(null, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(null, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(null, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual(null, c.CurrentJSON.active_route_destination); + } + else if (i == 14) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(null, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(22, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual("Arbeit", c.CurrentJSON.active_route_destination); + } + else if (i == 15) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(58, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(22, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual("Arbeit", c.CurrentJSON.active_route_destination); + } + else if (i == 19) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(58, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(22, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual("Arbeit", c.CurrentJSON.active_route_destination); + } + else if (i == 25) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(null, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(22, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual(null, c.CurrentJSON.active_route_destination); + } + else if (i == 30) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(58, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(22, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual(null, c.CurrentJSON.active_route_destination); + } + else if (i == 35) + { + Assert.AreEqual(0, c.CurrentJSON.active_route_traffic_minutes_delay); + Assert.AreEqual(58, c.CurrentJSON.active_route_energy_at_arrival); + Assert.AreEqual(29, c.CurrentJSON.active_route_km_to_arrival); + Assert.AreEqual(26, c.CurrentJSON.active_route_minutes_to_arrival); + Assert.AreEqual("Rot an der Rot", c.CurrentJSON.active_route_destination); + } + } + } + + private void AssertStates(TelemetryParser telemetry, int line, string content) { Assert.AreEqual(expectedACCharge, telemetry.acCharging, $"\r\nLine: {line}\r\n" +content); @@ -234,11 +393,20 @@ List LoadData(string path) foreach (string line in lines) { var pos = line.IndexOf("*** FT:"); - if (pos == -1) + if (pos > 0) + { + string s = line.Substring(pos + 7); + data.Add(s); continue; + } - string s = line.Substring(pos + 7); - data.Add(s); + pos = line.IndexOf("\"data\""); + if (pos > 0) + { + string s = line.Substring(pos-2); + data.Add(s); + continue; + } } return data; } diff --git a/UnitTestsTeslalogger/UnitTestWallbox.cs b/UnitTestsTeslalogger/UnitTestWallbox.cs index cd645aa45..82099aac2 100644 --- a/UnitTestsTeslalogger/UnitTestWallbox.cs +++ b/UnitTestsTeslalogger/UnitTestWallbox.cs @@ -83,6 +83,106 @@ public void CFos() Assert.AreEqual("2.0.1", version); } + [TestMethod] + public void SmartEVSE3() + { + var v = new ElectricityMeterSmartEVSE3("", ""); + v.mockup_status = System.IO.File.ReadAllText(@"..\..\testdata\smartevse3.txt"); + + double? kwh = v.GetVehicleMeterReading_kWh(); + var charging = v.IsCharging(); + var utility_meter_kwh = v.GetUtilityMeterReading_kWh(); + var version = v.GetVersion(); + string ret = v.ToString(); + Console.WriteLine(ret); + + Assert.AreEqual(2874.199951, kwh); + Assert.AreEqual(true, charging); + Assert.AreEqual(3456.98765, utility_meter_kwh); + Assert.AreEqual("v3.6.10", version); + } + + [TestMethod] + public void EVCC_Wallbox() + { + var v = new ElectricityMeterEVCC("", "Wallbox1"); + v.api_state = System.IO.File.ReadAllText(@"..\..\testdata\evcc.txt"); + + double? kwh = v.GetVehicleMeterReading_kWh(); + var charging = v.IsCharging(); + var utility_meter_kwh = v.GetUtilityMeterReading_kWh(); + var version = v.GetVersion(); + string ret = v.ToString(); + Console.WriteLine(ret); + + Assert.AreEqual(544.41, kwh); + Assert.AreEqual(false, charging); + Assert.AreEqual(5755.34, utility_meter_kwh); + Assert.AreEqual("0.133.0", version); + } + + [TestMethod] + public void EVCC_Vehicle() + { + var v = new ElectricityMeterEVCC("", "TestCar1"); + v.api_state = System.IO.File.ReadAllText(@"..\..\testdata\evcc.txt"); + + double? kwh = v.GetVehicleMeterReading_kWh(); + var charging = v.IsCharging(); + var utility_meter_kwh = v.GetUtilityMeterReading_kWh(); + var version = v.GetVersion(); + string ret = v.ToString(); + Console.WriteLine(ret); + + Assert.AreEqual(544.41, kwh); + Assert.AreEqual(false, charging); + Assert.AreEqual(5755.34, utility_meter_kwh); + Assert.AreEqual("0.133.0", version); + } + + [TestMethod] + public void EVCC_multiple() + { + var v = new ElectricityMeterEVCC("", "TestCar2"); + v.api_state = System.IO.File.ReadAllText(@"..\..\testdata\evcc_multiple.txt"); + + double? kwh = v.GetVehicleMeterReading_kWh(); + var charging = v.IsCharging(); + var utility_meter_kwh = v.GetUtilityMeterReading_kWh(); + var version = v.GetVersion(); + string ret = v.ToString(); + Console.WriteLine(ret); + + Assert.AreEqual(6716.148, kwh); + Assert.AreEqual(false, charging); + Assert.AreEqual(null, utility_meter_kwh); + Assert.AreEqual("0.133.0", version); + } + + [TestMethod] + public void WARP() + { + var v = new ElectricityMeterWARP("", ""); + + v.mockup_info_version = System.IO.File.ReadAllText(@"..\..\testdata\warp_infos_version.txt"); + v.mockup_evse_state = System.IO.File.ReadAllText(@"..\..\testdata\warp_evse_state.txt"); + v.mockup_wallbox_value_ids = System.IO.File.ReadAllText(@"..\..\testdata\warp_wallbox_value_ids.txt"); + v.mockup_wallbox_values = System.IO.File.ReadAllText(@"..\..\testdata\warp_wallbox_values.txt"); + v.mockup_grid_value_ids = System.IO.File.ReadAllText(@"..\..\testdata\warp_grid_value_ids.txt"); + v.mockup_grid_values = System.IO.File.ReadAllText(@"..\..\testdata\warp_grid_values.txt"); + + double? kwh = v.GetVehicleMeterReading_kWh(); + var charging = v.IsCharging(); + var utility_meter_kwh = v.GetUtilityMeterReading_kWh(); + var version = v.GetVersion(); + string ret = v.ToString(); + Console.WriteLine(ret); + Assert.AreEqual(544.4099731, kwh); + Assert.AreEqual(false, charging); + Assert.AreEqual(5762.71875, utility_meter_kwh); + Assert.AreEqual("2.6.6+675aeb99", version); + } + [TestMethod] public void Shelly3EM() { diff --git a/UnitTestsTeslalogger/UnitTestsTeslalogger.csproj b/UnitTestsTeslalogger/UnitTestsTeslalogger.csproj index 64e844fb5..4808840a7 100644 --- a/UnitTestsTeslalogger/UnitTestsTeslalogger.csproj +++ b/UnitTestsTeslalogger/UnitTestsTeslalogger.csproj @@ -141,9 +141,12 @@ True Settings.settings
+ + + @@ -188,6 +191,7 @@ + diff --git a/UnitTestsTeslalogger/testdata/ACCharging2.txt b/UnitTestsTeslalogger/testdata/ACCharging2.txt new file mode 100644 index 000000000..b755eaf77 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/ACCharging2.txt @@ -0,0 +1,26 @@ +19.01.2025 11:55:53 : #3[Thread Pool Worker:1543]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStopped" } } ], "createdAt": "2025-01-19T10:55:02.539669613Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:53 : #3[Thread Pool Worker:38]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStarting" } } ], "createdAt": "2025-01-19T10:55:03.539653197Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:53 : #3[Thread Pool Worker:418]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateCharging" } } ], "createdAt": "2025-01-19T10:55:05.539789080Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:53 : #3[Thread Pool Worker:416]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "" } } ], "createdAt": "2025-01-19T10:55:08.539434049Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:54 : #3[Thread Pool Worker:472]: *** FT: { "data": [ { "key": "ChargeState", "value": { "stringValue": "Enable" } } ], "createdAt": "2025-01-19T10:55:10.039487412Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:54 : #3[Thread Pool Worker:472]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "5.078809106830122" } }, { "key": "DCChargingEnergyIn", "value": { "stringValue": "0" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.593607069150497" } }, { "key": "RatedRange", "value": { "stringValue": "10.593607069150497" } } ], "createdAt": "2025-01-19T10:55:25.039108937Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:55:57 : #3[Thread Pool Worker:38]: *** FT: { "data": [ { "key": "ChargeLimitSoc", "value": { "stringValue": "60" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.04033333393434682" } }, { "key": "PackCurrent", "value": { "stringValue": "-15.600000232458115" } }, { "key": "ACChargingPower", "value": { "stringValue": "4.200000062584877" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.319634472534537" } }, { "key": "RatedRange", "value": { "stringValue": "10.319634472534537" } }, { "key": "Soc", "value": { "stringValue": "4.947460595446585" } } ], "createdAt": "2025-01-19T10:55:55.039074561Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:56:13 : #3[Thread Pool Worker:158]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-19T10:56:11.544268265Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:56:22 : #3[Thread Pool Worker:418]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "" } } ], "createdAt": "2025-01-19T10:56:21.539488934Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:56:26 : #3[Thread Pool Worker:61]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "10.22831027366255" } }, { "key": "Soc", "value": { "stringValue": "4.903677758318739" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.22831027366255" } } ], "createdAt": "2025-01-19T10:56:25.040090671Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:56:31 : #3[Thread Pool Worker:472]: *** FT: { "data": [ { "key": "Locked", "value": { "stringValue": "true" } } ], "createdAt": "2025-01-19T10:56:30.539581410Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:56:56 : #3[Thread Pool Worker:1543]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "9.00000013411045" } }, { "key": "InsideTemp", "value": { "stringValue": "14.10000080615282" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.1273888907871312" } }, { "key": "PackCurrent", "value": { "stringValue": "16.900000251829624" } } ], "createdAt": "2025-01-19T10:56:55.039618069Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:57:08 : #3[Thread Pool Worker:1543]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "10.319634472534537" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.319634472534537" } }, { "key": "Soc", "value": { "stringValue": "4.947460595446585" } } ], "createdAt": "2025-01-19T10:57:07.539595560Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:57:38 : #3[Thread Pool Worker:477]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "4.99124343257443" } }, { "key": "RatedRange", "value": { "stringValue": "10.410958671406524" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.410958671406524" } } ], "createdAt": "2025-01-19T10:57:37.539690881Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:57:56 : #3[Thread Pool Worker:158]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "11.000000163912773" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.30927778238637554" } }, { "key": "PackCurrent", "value": { "stringValue": "22.800000339746475" } }, { "key": "TimeToFullCharge", "value": { "stringValue": "2.8666671365499496" } } ], "createdAt": "2025-01-19T10:57:55.040058528Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:58:08 : #3[Thread Pool Worker:472]: *** FT: { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "10.593607069150497" } }, { "key": "Soc", "value": { "stringValue": "5.078809106830122" } }, { "key": "RatedRange", "value": { "stringValue": "10.593607069150497" } } ], "createdAt": "2025-01-19T10:58:07.544409020Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:58:29 : #3[Thread Pool Worker:479]: *** FT: { "data": [ { "key": "ModuleTempMin", "value": { "stringValue": "5" } } ], "createdAt": "2025-01-19T10:58:28.539701826Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:58:38 : #3[Thread Pool Worker:9]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "5.122591943957969" } }, { "key": "RatedRange", "value": { "stringValue": "10.684931268022485" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.684931268022485" } } ], "createdAt": "2025-01-19T10:58:37.539174618Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:58:44 : #3[Thread Pool Worker:474]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.019999999552965164" } } ], "createdAt": "2025-01-19T10:58:43.539164513Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:58:56 : #3[Thread Pool Worker:11]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.49316667401542263" } }, { "key": "PackCurrent", "value": { "stringValue": "22.90000034123659" } }, { "key": "ACChargingPower", "value": { "stringValue": "11.10000016540289" } }, { "key": "InsideTemp", "value": { "stringValue": "10.400000751018524" } }, { "key": "OutsideTemp", "value": { "stringValue": "-1.5" } } ], "createdAt": "2025-01-19T10:58:55.039467702Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:59:08 : #3[Thread Pool Worker:417]: *** FT: { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "10.86757966576646" } }, { "key": "Soc", "value": { "stringValue": "5.21015761821366" } }, { "key": "RatedRange", "value": { "stringValue": "10.86757966576646" } } ], "createdAt": "2025-01-19T10:59:07.539389502Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:59:14 : #3[Thread Pool Worker:9]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.03999999910593033" } } ], "createdAt": "2025-01-19T10:59:13.539933282Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:59:38 : #3[Thread Pool Worker:416]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "10.958903864638447" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "10.958903864638447" } }, { "key": "Soc", "value": { "stringValue": "5.253940455341506" } } ], "createdAt": "2025-01-19T10:59:37.539959002Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:59:44 : #3[Thread Pool Worker:414]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.07999999821186066" } } ], "createdAt": "2025-01-19T10:59:43.540115495Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 11:59:56 : #3[Thread Pool Worker:38]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.6778333434338369" } }, { "key": "PackCurrent", "value": { "stringValue": "22.500000335276127" } }, { "key": "ACChargingPower", "value": { "stringValue": "11.000000163912773" } } ], "createdAt": "2025-01-19T10:59:55.039345092Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 12:00:09 : #3[Thread Pool Worker:61]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "5.341506129597198" } }, { "key": "RatedRange", "value": { "stringValue": "11.14155226238242" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "11.14155226238242" } } ], "createdAt": "2025-01-19T11:00:07.540074677Z", "vin": "5YJ3E7EA3LF700000" } \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/ChargingDetailedWithoutChargingState.txt b/UnitTestsTeslalogger/testdata/ChargingDetailedWithoutChargingState.txt new file mode 100644 index 000000000..1a6d6c8fa --- /dev/null +++ b/UnitTestsTeslalogger/testdata/ChargingDetailedWithoutChargingState.txt @@ -0,0 +1,78 @@ +19.01.2025 10:02:44 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "Odometer", "value": { "stringValue": "43139.46197802895" } } ], "createdAt": "2025-01-19T09:02:43.300364210Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:02:44 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "Locked", "value": { "stringValue": "false" } }, { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-19T09:02:44.300461358Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:02:47 : #2[Thread Pool Worker:7536]: *** FT: { "data": [ { "key": "Gear", "value": { "invalid": true } } ], "createdAt": "2025-01-19T09:02:47.300141262Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:02:53 : #2[Thread Pool Worker:7536]: *** FT: { "data": [ { "key": "VehicleSpeed", "value": { "invalid": true } } ], "createdAt": "2025-01-19T09:02:53.800440600Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:02:54 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "DriverFront|TrunkRear" } } ], "createdAt": "2025-01-19T09:02:54.300142052Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:03 : #2[Thread Pool Worker:7521]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "0" } } ], "createdAt": "2025-01-19T09:03:03.800038613Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:04 : #2[Thread Pool Worker:7536]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateNoPower" } }, { "key": "ChargeState", "value": { "stringValue": "ClearFaults" } }, { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-19T09:03:04.300623045Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:05 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226267, "longitude": 11.085017 } } } ], "createdAt": "2025-01-19T09:03:05.300724452Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:08 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "162.08332971048853" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "162.08332971048853" } } ], "createdAt": "2025-01-19T09:03:08.299779647Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:09 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-3.300000049173832" } }, { "key": "Soc", "value": { "stringValue": "53.375411635565314" } } ], "createdAt": "2025-01-19T09:03:09.299796387Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:17 : #2[Thread Pool Worker:7521]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStarting" } } ], "createdAt": "2025-01-19T09:03:17.299913679Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:19 : #2[Thread Pool Worker:7524]: *** FT: { "data": [ { "key": "ChargeState", "value": { "stringValue": "SystemConfig" } } ], "createdAt": "2025-01-19T09:03:19.299990340Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:20 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "TimeToFullCharge", "value": { "stringValue": "5.866667628288269" } }, { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateCharging" } } ], "createdAt": "2025-01-19T09:03:20.300128722Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:23 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "0.20000000298023224" } } ], "createdAt": "2025-01-19T09:03:23.300646622Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:24 : #2[Thread Pool Worker:7534]: *** FT: { "data": [ { "key": "MilesToArrival", "value": { "invalid": true } }, { "key": "MinutesToArrival", "value": { "invalid": true } } ], "createdAt": "2025-01-19T09:03:24.800515962Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:39 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "PassengerRear" } } ], "createdAt": "2025-01-19T09:03:39.299805910Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:03:45 : #2[Thread Pool Worker:7524]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226266, "longitude": 11.085014 } } } ], "createdAt": "2025-01-19T09:03:45.299868568Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:00 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "53.40285400658617" } }, { "key": "RatedRange", "value": { "stringValue": "162.1666630419592" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "162.1666630419592" } } ], "createdAt": "2025-01-19T09:04:00.300384642Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:03 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.07900000117719173" } } ], "createdAt": "2025-01-19T09:04:03.800370210Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:05 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "" } } ], "createdAt": "2025-01-19T09:04:05.300363122Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:07 : #2[Thread Pool Worker:7521]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226265, "longitude": 11.085014 } } } ], "createdAt": "2025-01-19T09:04:07.300368515Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:09 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "25.100000374019146" } }, { "key": "NumBrickVoltageMax", "value": { "stringValue": "21" } }, { "key": "BrickVoltageMin", "value": { "stringValue": "3.844000182580203" } }, { "key": "BrickVoltageMax", "value": { "stringValue": "3.8480001827701926" } } ], "createdAt": "2025-01-19T09:04:09.300371697Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:09 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.03999999910593033" } } ], "createdAt": "2025-01-19T09:04:09.800258007Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:19 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "Locked", "value": { "stringValue": "true" } } ], "createdAt": "2025-01-19T09:04:19.299838443Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:20 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "TpmsPressureRr", "value": { "stringValue": "2.8250000420957804" } }, { "key": "TpmsPressureRl", "value": { "stringValue": "2.8500000424683094" } } ], "createdAt": "2025-01-19T09:04:20.300647189Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:21 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "TpmsPressureFl", "value": { "stringValue": "2.8500000424683094" } } ], "createdAt": "2025-01-19T09:04:21.300028151Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:22 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226264, "longitude": 11.085014 } } }, { "key": "TpmsPressureFr", "value": { "stringValue": "2.8250000420957804" } } ], "createdAt": "2025-01-19T09:04:22.300353407Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:23 : #2[Thread Pool Worker:7514]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "10.900000162422657" } } ], "createdAt": "2025-01-19T09:04:23.299966484Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:30 : #2[Thread Pool Worker:7528]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "162.4166630363713" } }, { "key": "Soc", "value": { "stringValue": "53.485181119648736" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "162.4166630363713" } } ], "createdAt": "2025-01-19T09:04:30.300490386Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:04:39 : #2[Thread Pool Worker:7534]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.07999999821186066" } } ], "createdAt": "2025-01-19T09:04:39.799748170Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:00 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "53.59495060373216" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "162.74999636225402" } }, { "key": "RatedRange", "value": { "stringValue": "162.74999636225402" } } ], "createdAt": "2025-01-19T09:05:00.299983335Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:03 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.25961111497961803" } } ], "createdAt": "2025-01-19T09:05:03.800280644Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:09 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "24.300000362098217" } } ], "createdAt": "2025-01-19T09:05:09.299952375Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:09 : #2[Thread Pool Worker:7521]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.17999999597668648" } } ], "createdAt": "2025-01-19T09:05:09.799807169Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:23 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "10.800000160932541" } } ], "createdAt": "2025-01-19T09:05:23.299904426Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:24 : #2[Thread Pool Worker:7535]: *** FT: { "data": [ { "key": "InsideTemp", "value": { "stringValue": "18.100000865757465" } } ], "createdAt": "2025-01-19T09:05:24.300432798Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:26 : #2[Thread Pool Worker:7528]: *** FT: { "data": [ { "key": "OutsideTemp", "value": { "stringValue": "0.5" } } ], "createdAt": "2025-01-19T09:05:26.299814830Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:30 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "Soc", "value": { "stringValue": "53.677277716794734" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "162.9999963566661" } }, { "key": "RatedRange", "value": { "stringValue": "162.9999963566661" } } ], "createdAt": "2025-01-19T09:05:30.300350824Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:05:39 : #2[Thread Pool Worker:7523]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.2199999950826168" } } ], "createdAt": "2025-01-19T09:05:39.799863070Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:06:00 : #2[Thread Pool Worker:7532]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "163.41666301401952" } }, { "key": "Soc", "value": { "stringValue": "53.81448957189902" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "163.41666301401952" } } ], "createdAt": "2025-01-19T09:06:00.300356383Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:06:03 : #2[Thread Pool Worker:7534]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "0.39766667259236205" } } ], "createdAt": "2025-01-19T09:06:03.800041139Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:23 : #2[Thread Pool Worker:7613]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "10.800000160932541" } } ], "createdAt": "2025-01-19T09:48:23.300237538Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:30 : #2[Thread Pool Worker:7594]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "192.08332903993627" } }, { "key": "Soc", "value": { "stringValue": "63.25466520307354" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "192.08332903993627" } } ], "createdAt": "2025-01-19T09:48:30.300053584Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:39 : #2[Thread Pool Worker:7615]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.219999838620424" } } ], "createdAt": "2025-01-19T09:48:39.800055673Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:44 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "NumBrickVoltageMax", "value": { "stringValue": "69" } } ], "createdAt": "2025-01-19T09:48:44.299931064Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:46 : #2[Thread Pool Worker:7615]: *** FT: { "data": [ { "key": "NumBrickVoltageMin", "value": { "stringValue": "86" } } ], "createdAt": "2025-01-19T09:48:46.300121640Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:56 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "MilesToArrival", "value": { "stringValue": "37.99614209090315" } } ], "createdAt": "2025-01-19T09:48:56.800500997Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:48:59 : #2[Thread Pool Worker:7619]: *** FT: { "data": [ { "key": "MinutesToArrival", "value": { "stringValue": "44.233333333333334" } } ], "createdAt": "2025-01-19T09:48:59.800701519Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:00 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "192.4999956972897" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "192.4999956972897" } }, { "key": "Soc", "value": { "stringValue": "63.391877058177826" } } ], "createdAt": "2025-01-19T09:49:00.299791288Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:03 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "DestinationName", "value": { "stringValue": "Kentucky Fried Chicken" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "8.129833454477321" } } ], "createdAt": "2025-01-19T09:49:03.800084255Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:09 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "24.2000003606081" } } ], "createdAt": "2025-01-19T09:49:09.300635210Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:09 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.299999836832285" } } ], "createdAt": "2025-01-19T09:49:09.800051136Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:23 : #2[Thread Pool Worker:7628]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "10.800000160932541" } } ], "createdAt": "2025-01-19T09:49:23.300061452Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:30 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "192.83332902317247" } }, { "key": "RatedRange", "value": { "stringValue": "192.83332902317247" } }, { "key": "Soc", "value": { "stringValue": "63.50164654226125" } } ], "createdAt": "2025-01-19T09:49:30.299921214Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:49:39 : #2[Thread Pool Worker:7619]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.399999834597111" } } ], "createdAt": "2025-01-19T09:49:39.800493716Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:00 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "193.16666234905523" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "193.16666234905523" } }, { "key": "Soc", "value": { "stringValue": "63.61141602634468" } } ], "createdAt": "2025-01-19T09:50:00.300497582Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:03 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "8.311055679399978" } } ], "createdAt": "2025-01-19T09:50:03.800278421Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:09 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "24.900000371038914" } } ], "createdAt": "2025-01-19T09:50:09.299928749Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:09 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.439999833703041" } } ], "createdAt": "2025-01-19T09:50:09.800744300Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:16 : #2[Thread Pool Worker:7625]: *** FT: { "data": [ { "key": "MinutesToArrival", "value": { "stringValue": "44.2" } } ], "createdAt": "2025-01-19T09:50:16.800094048Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:23 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "10.900000162422657" } } ], "createdAt": "2025-01-19T09:50:23.300110996Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:30 : #2[Thread Pool Worker:7613]: *** FT: { "data": [ { "key": "RatedRange", "value": { "stringValue": "193.49999567493796" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "193.49999567493796" } }, { "key": "Soc", "value": { "stringValue": "63.7211855104281" } } ], "createdAt": "2025-01-19T09:50:30.300221641Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:50:39 : #2[Thread Pool Worker:7632]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.519999831914902" } } ], "createdAt": "2025-01-19T09:50:39.800497654Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:00 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "193.8333290008207" } }, { "key": "RatedRange", "value": { "stringValue": "193.8333290008207" } }, { "key": "Soc", "value": { "stringValue": "63.83095499451152" } } ], "createdAt": "2025-01-19T09:51:00.300565558Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:03 : #2[Thread Pool Worker:7624]: *** FT: { "data": [ { "key": "ACChargingEnergyIn", "value": { "stringValue": "8.492166793209869" } } ], "createdAt": "2025-01-19T09:51:03.800278908Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:09 : #2[Thread Pool Worker:7619]: *** FT: { "data": [ { "key": "PackCurrent", "value": { "stringValue": "24.70000036805868" } } ], "createdAt": "2025-01-19T09:51:09.300349094Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:09 : #2[Thread Pool Worker:7633]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.599999830126762" } } ], "createdAt": "2025-01-19T09:51:09.800275211Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:18 : #2[Thread Pool Worker:7633]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStopped" } }, { "key": "ChargeState", "value": { "stringValue": "Idle" } } ], "createdAt": "2025-01-19T09:51:18.300119725Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:20 : #2[Thread Pool Worker:7632]: *** FT: { "data": [ { "key": "TimeToFullCharge", "value": { "invalid": true } }, { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-19T09:51:20.300093159Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:23 : #2[Thread Pool Worker:7633]: *** FT: { "data": [ { "key": "ACChargingPower", "value": { "stringValue": "0" } } ], "createdAt": "2025-01-19T09:51:23.300131157Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:25 : #2[Thread Pool Worker:7633]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226259, "longitude": 11.085001 } } } ], "createdAt": "2025-01-19T09:51:25.300339658Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:28 : #2[Thread Pool Worker:7613]: *** FT: { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateDisconnected" } } ], "createdAt": "2025-01-19T09:51:28.300341703Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:30 : #2[Thread Pool Worker:7632]: *** FT: { "data": [ { "key": "DoorState", "value": { "stringValue": "DriverFront|TrunkRear" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "194.0833289952328" } }, { "key": "Soc", "value": { "stringValue": "63.9132821075741" } }, { "key": "RatedRange", "value": { "stringValue": "194.0833289952328" } } ], "createdAt": "2025-01-19T09:51:30.300106851Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:33 : #2[Thread Pool Worker:7613]: *** FT: { "data": [ { "key": "ChargeState", "value": { "stringValue": "Idle" } } ], "createdAt": "2025-01-19T09:51:33.300354236Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:39 : #2[Thread Pool Worker:7632]: *** FT: { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.659999828785658" } } ], "createdAt": "2025-01-19T09:51:39.800046515Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:40 : #2[Thread Pool Worker:7619]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226259, "longitude": 11.084999 } } } ], "createdAt": "2025-01-19T09:51:40.300364202Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:51:55 : #2[Thread Pool Worker:7613]: *** FT: { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 54.226259, "longitude": 11.084998 } } }, { "key": "DoorState", "value": { "stringValue": "TrunkRear" } } ], "createdAt": "2025-01-19T09:51:55.299981573Z", "vin": "5YJ3E7EA3LF700000" } +19.01.2025 10:52:01 : #2[Thread Pool Worker:7619]: *** FT: { "data": [ { "key": "VehicleSpeed", "value": { "stringValue": "0" } }, { "key": "Gear", "value": { "stringValue": "P" } } ], "createdAt": "2025-01-19T09:52:01.300484263Z", "vin": "5YJ3E7EA3LF700000" } diff --git a/UnitTestsTeslalogger/testdata/DCCharging3.txt b/UnitTestsTeslalogger/testdata/DCCharging3.txt new file mode 100644 index 000000000..7dae6270d --- /dev/null +++ b/UnitTestsTeslalogger/testdata/DCCharging3.txt @@ -0,0 +1,65 @@ +2025-01-22T19:49:34.993741553Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Gear", "value": { "stringValue": "P" } } ], "createdAt": "2025-01-22T19:49:34.897841650Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:40.014094133Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Gear", "value": { "invalid": true } } ], "createdAt": "2025-01-22T19:49:39.898036497Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:44.783432916Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:49:45.971725387Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "58.64150812322239" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "58.64150812322239" } } ], "createdAt": "2025-01-22T19:49:45.898364447Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:52.995045580Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0" } }, { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateNoPower" } } ], "createdAt": "2025-01-22T19:49:52.898399615Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:53.946253468Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeState", "value": { "stringValue": "ClearFaults" } } ], "createdAt": "2025-01-22T19:49:53.898383955Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:54.993712022Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "FastChargerPresent", "value": { "stringValue": "true" } }, { "key": "TimeToFullCharge", "value": { "stringValue": "2.411973585007446" } } ], "createdAt": "2025-01-22T19:49:54.898618334Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:55.964665370Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStopped" } } ], "createdAt": "2025-01-22T19:49:55.898726996Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:57.452451095Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-10.100000150501728" } } ], "createdAt": "2025-01-22T19:49:57.398088707Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:49:59.782960126Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:50:02.014565555Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "ModuleTempMin", "value": { "stringValue": "27.5" } } ], "createdAt": "2025-01-22T19:50:01.897981643Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:04.014814754Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "VehicleSpeed", "value": { "invalid": true } } ], "createdAt": "2025-01-22T19:50:03.898812808Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:04.961595425Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateStarting" } } ], "createdAt": "2025-01-22T19:50:04.897917143Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:06.956735146Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.290722, "longitude": 14.277724 } } } ], "createdAt": "2025-01-22T19:50:06.898513773Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:10.815300916Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:50:17.957624945Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "21.1501771599891" } } ], "createdAt": "2025-01-22T19:50:17.898219050Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:21.493877198Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "1.9076624573604204" } } ], "createdAt": "2025-01-22T19:50:21.398314685Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:21.969917956Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateCharging" } } ], "createdAt": "2025-01-22T19:50:21.897854310Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:30.991792528Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "58.49056473036982" } }, { "key": "RatedRange", "value": { "stringValue": "58.49056473036982" } } ], "createdAt": "2025-01-22T19:50:30.897958403Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:31.802841656Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:50:37.957083270Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.019999999552965164" } } ], "createdAt": "2025-01-22T19:50:37.898386175Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:38.993745845Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeState", "value": { "stringValue": "Idle" } } ], "createdAt": "2025-01-22T19:50:38.898710467Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:45.960214265Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeLimitSoc", "value": { "stringValue": "90" } } ], "createdAt": "2025-01-22T19:50:45.898021962Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:51.502063795Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "71.34678090527514" } } ], "createdAt": "2025-01-22T19:50:51.398296976Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:52.014086958Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.290723, "longitude": 14.277721 } } } ], "createdAt": "2025-01-22T19:50:51.898019809Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:50:57.448142816Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "264.70000394433737" } } ], "createdAt": "2025-01-22T19:50:57.398202628Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:06.993580549Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "BrickVoltageMin", "value": { "stringValue": "3.8460001826751977" } } ], "createdAt": "2025-01-22T19:51:06.897989661Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:07.983865735Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "0.5199999883770943" } } ], "createdAt": "2025-01-22T19:51:07.898722150Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:15.973140586Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "60.83018731958461" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "60.83018731958461" } } ], "createdAt": "2025-01-22T19:51:15.898783926Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:18.794434804Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:51:21.493771354Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "160.55487141131889" } } ], "createdAt": "2025-01-22T19:51:21.398702589Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:37.951557240Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "1.3599999696016312" } } ], "createdAt": "2025-01-22T19:51:37.898584066Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:47.994865007Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "23.848460070863993" } } ], "createdAt": "2025-01-22T19:51:47.898321540Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:51.487177904Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "152.10377785021555" } } ], "createdAt": "2025-01-22T19:51:51.398592098Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:51:57.470490690Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "371.7000055387616" } } ], "createdAt": "2025-01-22T19:51:57.398561079Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:00.994292435Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "67.24528151581873" } }, { "key": "RatedRange", "value": { "stringValue": "67.24528151581873" } } ], "createdAt": "2025-01-22T19:52:00.898659056Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:07.934358765Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "2.699999939650297" } } ], "createdAt": "2025-01-22T19:52:07.898667376Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:21.494134604Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "143.2450567982234" } } ], "createdAt": "2025-01-22T19:52:21.397965138Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:35.765674307Z 5YJ3E7EA3LF700000 - Send Alert +2025-01-22T19:52:37.976045333Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "3.6199999190866947" } } ], "createdAt": "2025-01-22T19:52:37.897862224Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:45.993856720Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "72.60377196208485" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "72.60377196208485" } } ], "createdAt": "2025-01-22T19:52:45.898478514Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:51.493858930Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "142.6046368125379" } } ], "createdAt": "2025-01-22T19:52:51.398789356Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:54.994992634Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "TimeToFullCharge", "value": { "stringValue": "0.6438529146772348" } } ], "createdAt": "2025-01-22T19:52:54.898214576Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:52:57.489176597Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "344.3000051304698" } } ], "createdAt": "2025-01-22T19:52:57.398632284Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:01.994261146Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "ModuleTempMin", "value": { "stringValue": "33" } } ], "createdAt": "2025-01-22T19:53:01.898397126Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:07.941175265Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "4.819999892264605" } } ], "createdAt": "2025-01-22T19:53:07.898562570Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:17.942103732Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "28.053435114503817" } } ], "createdAt": "2025-01-22T19:53:17.898829422Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:21.494036229Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "138.6160094016907" } } ], "createdAt": "2025-01-22T19:53:21.398254794Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:30.994109400Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "79.32075294402411" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "79.32075294402411" } } ], "createdAt": "2025-01-22T19:53:30.898293152Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:37.944676135Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "5.719999872148037" } } ], "createdAt": "2025-01-22T19:53:37.898079693Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:51.475625406Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "135.7124219665909" } } ], "createdAt": "2025-01-22T19:53:51.398722618Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:53:57.494285273Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "327.7000048831105" } } ], "createdAt": "2025-01-22T19:53:57.398468672Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:07.959092491Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "6.859999846667051" } } ], "createdAt": "2025-01-22T19:54:07.898471278Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:15.980724167Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "85.20754526527423" } }, { "key": "RatedRange", "value": { "stringValue": "85.20754526527423" } } ], "createdAt": "2025-01-22T19:54:15.898138304Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:21.495060349Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "134.38891199617368" } } ], "createdAt": "2025-01-22T19:54:21.397937777Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:37.959376217Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "7.759999826550484" } } ], "createdAt": "2025-01-22T19:54:37.898438978Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:47.965045545Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "31.897491821155942" } } ], "createdAt": "2025-01-22T19:54:47.898378105Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:51.475499830Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "132.31803704246133" } } ], "createdAt": "2025-01-22T19:54:51.398670143Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:52.979093423Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "BrickVoltageMax", "value": { "stringValue": "3.980000189039856" } } ], "createdAt": "2025-01-22T19:54:52.898525780Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:54:57.493984062Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "NumBrickVoltageMin", "value": { "stringValue": "23" } }, { "key": "NumBrickVoltageMax", "value": { "stringValue": "3" } }, { "key": "PackCurrent", "value": { "stringValue": "316.00000470876694" } } ], "createdAt": "2025-01-22T19:54:57.398300215Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:55:01.009879560Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "90.33962062226152" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "90.33962062226152" } } ], "createdAt": "2025-01-22T19:55:00.898588985Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:55:07.994259827Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "8.51999980956316" } } ], "createdAt": "2025-01-22T19:55:07.897837594Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:55:21.485701943Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingPower", "value": { "stringValue": "130.97138957256126" } } ], "createdAt": "2025-01-22T19:55:21.398079378Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:55:37.986485304Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "9.439999788999557" } } ], "createdAt": "2025-01-22T19:55:37.898517759Z", "vin": "5YJ3E7EA3LF700000" } +2025-01-22T19:55:45.994207503Z 5YJ3E7EA3LF700000 - { "data": [ { "key": "RatedRange", "value": { "stringValue": "95.69811106852765" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "95.69811106852765" } } ], "createdAt": "2025-01-22T19:55:45.898456015Z", "vin": "5YJ3E7EA3LF700000" } diff --git a/UnitTestsTeslalogger/testdata/Route.txt b/UnitTestsTeslalogger/testdata/Route.txt new file mode 100644 index 000000000..6cba536c5 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/Route.txt @@ -0,0 +1,58 @@ +5YJ3E7EA3LF700000 - { "data": [ { "key": "TimeToFullCharge", "value": { "stringValue": "0.2666667103767395" } }, { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateCharging" } }, { "key": "VehicleName", "value": { "stringValue": "Tessi" } }, { "key": "InsideTemp", "value": { "stringValue": "4.300000660121441" } }, { "key": "DoorState", "value": { "stringValue": "" } }, { "key": "RdWindow", "value": { "stringValue": "Closed" } }, { "key": "BatteryHeaterOn", "value": { "invalid": true } }, { "key": "BrickVoltageMax", "value": { "stringValue": "4.0760001935996115" } }, { "key": "RouteTrafficMinutesDelay", "value": { "doubleValue": 0 } }, { "key": "TpmsPressureRl", "value": { "stringValue": "2.625000039115548" } }, { "key": "NumBrickVoltageMin", "value": { "stringValue": "67" } }, { "key": "SentryMode", "value": { "stringValue": "Off" } }, { "key": "PreconditioningEnabled", "value": { "stringValue": "false" } }, { "key": "PackCurrent", "value": { "stringValue": "27.200000405311584" } }, { "key": "BrickVoltageMin", "value": { "stringValue": "4.044000192079693" } }, { "key": "Locked", "value": { "stringValue": "true" } }, { "key": "Odometer", "value": { "stringValue": "47031.79344819865" } }, { "key": "Soc", "value": { "stringValue": "69.22406277244987" } }, { "key": "CarType", "value": { "stringValue": "Model3" } }, { "key": "ServiceMode", "value": { "stringValue": "false" } }, { "key": "DCChargingEnergyIn", "value": { "stringValue": "10.91999975591898" } }, { "key": "DestinationName", "value": { "invalid": true } }, { "key": "OutsideTemp", "value": { "stringValue": "4" } }, { "key": "Location", "value": { "locationValue": { "latitude": 48.189077, "longitude": 9.904631 } } }, { "key": "TpmsPressureFl", "value": { "stringValue": "2.625000039115548" } }, { "key": "TpmsPressureRr", "value": { "stringValue": "2.625000039115548" } }, { "key": "FdWindow", "value": { "stringValue": "Closed" } }, { "key": "FastChargerPresent", "value": { "stringValue": "false" } }, { "key": "ModuleTempMin", "value": { "stringValue": "16.5" } }, { "key": "VehicleSpeed", "value": { "invalid": true } }, { "key": "ChargeState", "value": { "stringValue": "Enable" } }, { "key": "ChargeLimitSoc", "value": { "stringValue": "76" } }, { "key": "MilesToArrival", "value": { "invalid": true } }, { "key": "MinutesToArrival", "value": { "invalid": true } }, { "key": "TpmsPressureFr", "value": { "stringValue": "2.625000039115548" } }, { "key": "FpWindow", "value": { "stringValue": "Closed" } }, { "key": "Version", "value": { "stringValue": "2024.45.32.2 7cc287a111a2" } }, { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "invalid": true } }, { "key": "Gear", "value": { "invalid": true } }, { "key": "ACChargingPower", "value": { "stringValue": "11.10000016540289" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "8.703555685248634" } }, { "key": "DCChargingPower", "value": { "stringValue": "0" } }, { "key": "RpWindow", "value": { "stringValue": "Closed" } }, { "key": "NumBrickVoltageMax", "value": { "stringValue": "1" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.02282780871545" } }, { "key": "Trim", "value": { "stringValue": "50" } } ], "createdAt": "2025-01-24T19:40:42.635029046Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DCChargingEnergyIn", "value": { "stringValue": "11.03999975323677" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.57077300194734" } }, { "key": "Soc", "value": { "stringValue": "69.48561464690496" } } ], "createdAt": "2025-01-24T19:41:12.634730027Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeLimitSoc", "value": { "stringValue": "58" } } ], "createdAt": "2025-01-24T19:43:32.135158449Z", "vin": "5YJ3E7EA3LF700000" }11.099999751895666" } }, { "key": "PackCurrent", "value": { "stringValue": "27.200000405311584" } }, { "key": "ACChargingPower", "value": { "stringValue": "11.000000163912773" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.84474559856332" } }, { "key": "Soc", "value": { "stringValue": "69.61639058413252" } } ]5YJ3E7EA3LF700000 - { "data": [ { "key": "TimeToFullCharge", "value": { "invalid": true } }, { "key": "ModuleTempMin", "value": { "stringValue": "17" } }, { "key": "PackCurrent", "value": { "stringValue": "-0.30000000447034836" } } ], "createdAt": "2025-01-24T19:43:42.635435034Z", "vin": "5YJ3E7EA3LF700000" }"stringValue": "69.83435047951177" } }, { "key": "DCChargingEnergyIn", "value": { "stringValue": "11.199999749660492" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "146.30136659 +5YJ3E7EA3LF700000 - { "data": [ { "key": "Locked", "value": { "stringValue": "false" } }, { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-24T19:44:21.634800212Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - Send Alert[ { "key": "ChargeLimitSoc", "value": { "stringValue": "68" } } ], "createdAt": "2025-01-24T19:42:32.135379365Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.189077, "longitude": 9.90463 } } } ], "createdAt": "2025-01-24T19:44:29.157157762Z", "vin": "5YJ3E7EA3LF700000" }tedAt": "2025-01-24T19:42:34.135239083Z" +5YJ3E7EA3LF700000 - { "data": [ { "key": "InsideTemp", "value": { "stringValue": "4.400000661611557" } } ], "createdAt": "2025-01-24T19:44:31.635449318Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeState", "value": { "stringValue": "ClearFaults" } }, { "key": "DetailedChargeState", "value": { "detailedChargeStateValue": "DetailedChargeStateDisconnected" } } ], "createdAt": "2025-01-24T19:44:40.137957421Z", "vin": "5YJ3E7EA3LF700000" }alue": { "stringValue": "146.7579875872832" } }, { "key": "Soc", "value": { "stringValue": "70.05231037489102" } }, { "key": "ACChargingEnergyIn", "value": { "stringValue": "9.048611245945962" } } ], "createdAt": " +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-11.60000017285347" } } ], "createdAt": "2025-01-24T19:44:42.638392035Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.189075, "longitude": 9.904628 } } } ], "createdAt": "2025-01-24T19:44:44.135778808Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - Send Alert +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "146.6666633884112" } }, { "key": "Soc", "value": { "stringValue": "70.00871839581518" } } ], "createdAt": "2025-01-24T19:44:45.137952970Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DoorState", "value": { "stringValue": "" } } ], "createdAt": "2025-01-24T19:44:48.634807578Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "ChargeState", "value": { "stringValue": "Idle" } } ], "createdAt": "2025-01-24T19:44:55.635134715Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.189075, "longitude": 9.904627 } } } ], "createdAt": "2025-01-24T19:44:59.135324169Z", "vin": "5YJ3E7EA3LF700000" } +Current Subscriptions: 594 +5YJ3E7EA3LF700000 - { "data": [ { "key": "DestinationName", "value": { "stringValue": "Arbeit" } } ], "createdAt": "2025-01-24T19:45:08.634815067Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "stringValue": "18.577873683114195" } }, { "key": "MinutesToArrival", "value": { "stringValue": "22.85" } } ], "createdAt": "2025-01-24T19:45:09.635111766Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "intValue": 58 } } ], "createdAt": "2025-01-24T19:45:10.135256508Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.92153443766347" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "146.48401499066725" } } ], "createdAt": "2025-01-24T19:45:15.634834104Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - Send Alert +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-7.300000108778477" } } ], "createdAt": "2025-01-24T19:45:42.635306058Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "146.30136659292324" } }, { "key": "Soc", "value": { "stringValue": "69.83435047951177" } } ], "createdAt": "2025-01-24T19:45:45.635567723Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "stringValue": "18.556250384582736" } } ], "createdAt": "2025-01-24T19:46:09.635162004Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.74716652136007" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "146.11871819517927" } } ], "createdAt": "2025-01-24T19:46:15.634808917Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "InsideTemp", "value": { "stringValue": "15.300000824034214" } } ], "createdAt": "2025-01-24T19:46:31.634509275Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "NumBrickVoltageMax", "value": { "stringValue": "74" } }, { "key": "BrickVoltageMin", "value": { "stringValue": "3.9580001879949123" } }, { "key": "BrickVoltageMax", "value": { "stringValue": "3.9760001888498664" } }, { "key": "PackCurrent", "value": { "stringValue": "-6.900000102818012" } } ], "createdAt": "2025-01-24T19:46:42.635632469Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "145.93606979743532" } }, { "key": "Soc", "value": { "stringValue": "69.65998256320837" } } ], "createdAt": "2025-01-24T19:46:45.634734627Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DestinationName", "value": { "invalid": true } }, { "key": "MinutesToArrival", "value": { "invalid": true } } ], "createdAt": "2025-01-24T19:47:01.635653055Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "invalid": true } }, { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "invalid": true } } ], "createdAt": "2025-01-24T19:47:09.635309895Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.61639058413252" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.84474559856332" } } ], "createdAt": "2025-01-24T19:47:15.635297873Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-14.500000216066837" } } ], "createdAt": "2025-01-24T19:47:42.634765151Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "145.66209720081935" } }, { "key": "Soc", "value": { "stringValue": "69.52920662598082" } } ], "createdAt": "2025-01-24T19:47:45.635490217Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DestinationName", "value": { "invalid": true } }, { "key": "MinutesToArrival", "value": { "invalid": true } } ], "createdAt": "2025-01-24T19:48:01.639300933Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "invalid": true } }, { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "intValue": 58 } } ], "createdAt": "2025-01-24T19:48:09.635583839Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.44202266782912" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.47944880307537" } } ], "createdAt": "2025-01-24T19:48:15.635497112Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "InsideTemp", "value": { "stringValue": "21.500000916421413" } } ], "createdAt": "2025-01-24T19:48:31.639009541Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-16.900000251829624" } } ], "createdAt": "2025-01-24T19:48:42.634705438Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "145.3881246042034" } }, { "key": "Soc", "value": { "stringValue": "69.39843068875327" } } ], "createdAt": "2025-01-24T19:48:45.635712316Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DestinationName", "value": { "stringValue": "Rot an der Rot" } }, { "key": "MinutesToArrival", "value": { "stringValue": "26.283333333333335" } } ], "createdAt": "2025-01-24T19:49:01.634652285Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "stringValue": "16.668902620292798" } }, { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "intValue": 58 } } ], "createdAt": "2025-01-24T19:49:09.634862301Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "145.2054762064594" } }, { "key": "Soc", "value": { "stringValue": "69.31124673060157" } } ], "createdAt": "2025-01-24T19:49:15.635464986Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-18.600000277161598" } } ], "createdAt": "2025-01-24T19:49:42.634715715Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.26765475152573" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "145.11415200758742" } } ], "createdAt": "2025-01-24T19:49:45.635553206Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MinutesToArrival", "value": { "stringValue": "12.7499259334462" } }, { "key": "DestinationName", "value": { "stringValue": "Orsenhausen" } } ], "createdAt": "2025-01-24T19:50:01.634558891Z", "vin": "5YJ3E7EA3LF700000" } +Current Subscriptions: 594 +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "stringValue": "4.692113795613182" } }, { "key": "ExpectedEnergyPercentAtTripArrival", "value": { "intValue": 66 } } ], "createdAt": "2025-01-24T19:50:09.634724588Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Soc", "value": { "stringValue": "69.18047079337401" } }, { "key": "IdealBatteryRange", "value": { "stringValue": "144.93150360984345" } } ], "createdAt": "2025-01-24T19:50:15.634588468Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "InsideTemp", "value": { "stringValue": "22.40000092983246" } } ], "createdAt": "2025-01-24T19:50:31.635400507Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DoorState", "value": { "stringValue": "DriverFront" } } ], "createdAt": "2025-01-24T19:50:32.134793928Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.189074, "longitude": 9.904626 } } } ], "createdAt": "2025-01-24T19:50:34.135261254Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "DoorState", "value": { "stringValue": "" } } ], "createdAt": "2025-01-24T19:50:42.135104205Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "PackCurrent", "value": { "stringValue": "-0.7000000104308128" } } ], "createdAt": "2025-01-24T19:50:42.634575589Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "IdealBatteryRange", "value": { "stringValue": "144.84017941097147" } }, { "key": "Soc", "value": { "stringValue": "69.13687881429816" } } ], "createdAt": "2025-01-24T19:50:45.635538198Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Location", "value": { "locationValue": { "latitude": 48.189073, "longitude": 9.904626 } } } ], "createdAt": "2025-01-24T19:50:49.135306315Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "Locked", "value": { "stringValue": "true" } } ], "createdAt": "2025-01-24T19:50:51.635121191Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MinutesToArrival", "value": { "invalid": true } }, { "key": "DestinationName", "value": { "invalid": true } } ], "createdAt": "2025-01-24T19:51:01.634945883Z", "vin": "5YJ3E7EA3LF700000" } +5YJ3E7EA3LF700000 - { "data": [ { "key": "MilesToArrival", "value": { "invalid": true } } ], "createdAt": "2025-01-24T19:51:09.634628306Z", "vin": "5YJ3E7EA3LF700000" } \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/evcc.txt b/UnitTestsTeslalogger/testdata/evcc.txt new file mode 100644 index 000000000..14c8c7a6f --- /dev/null +++ b/UnitTestsTeslalogger/testdata/evcc.txt @@ -0,0 +1 @@ +{"result":{"auth":{},"aux":[],"battery":[{"power":466,"capacity":0,"soc":44,"controllable":false}],"batteryCapacity":1,"batteryDischargeControl":false,"batteryEnergy":0,"batteryGridChargeActive":false,"batteryMode":"unknown","batteryPower":466,"batterySoc":44,"bufferSoc":100,"bufferStartSoc":0,"currency":"EUR","eebus":false,"ext":[],"fatal":null,"greenShareHome":0.985,"greenShareLoadpoints":0,"grid":{"power":7,"energy":5755.34,"currents":[1.6,1.5,2]},"gridConfigured":true,"hems":{},"homePower":473,"influx":{"url":"","database":"","org":"","user":"","insecure":false},"interval":15,"loadpoints":[{"batteryBoost":false,"chargeCurrent":0,"chargeCurrents":[0,0,0],"chargeDuration":0,"chargePower":0,"chargeTotalImport":544.41,"chargedEnergy":0,"chargerFeatureHeating":false,"chargerFeatureIntegratedDevice":false,"chargerIcon":null,"chargerPhases1p3p":true,"chargerPhysicalPhases":null,"chargerStatusReason":"unknown","charging":false,"connected":false,"connectedDuration":9223372036,"disableDelay":420,"disableThreshold":0,"effectiveLimitSoc":100,"effectiveMaxCurrent":20,"effectiveMinCurrent":6,"effectivePlanId":0,"effectivePlanSoc":0,"effectivePlanTime":null,"effectivePriority":0,"enableDelay":180,"enableThreshold":0,"enabled":false,"limitEnergy":0,"limitSoc":0,"maxCurrent":20,"minCurrent":6,"mode":"pv","phaseAction":"inactive","phaseRemaining":0,"phasesActive":1,"phasesConfigured":0,"phasesEnabled":1,"planActive":false,"planEnergy":0,"planOverrun":0,"planProjectedEnd":null,"planProjectedStart":null,"planTime":null,"priority":0,"pvAction":"inactive","pvRemaining":0,"sessionCo2PerKWh":null,"sessionEnergy":0,"sessionPrice":null,"sessionPricePerKWh":null,"sessionSolarPercentage":0,"smartCostActive":false,"smartCostNextStart":null,"title":"Wallbox1","vehicleClimaterActive":null,"vehicleDetectionActive":false,"vehicleLimitSoc":0,"vehicleName":"tsla","vehicleOdometer":0,"vehicleRange":0,"vehicleSoc":0,"vehicleWelcomeActive":false}],"messaging":true,"modbusproxy":null,"mqtt":{"broker":"x.x.x.x:1883","topic":"evcc","user":"xxxx"},"network":{"schema":"http","host":"evcc.local","port":7070},"prioritySoc":100,"pv":[{"power":0}],"pvEnergy":0,"pvPower":0,"residualPower":200,"siteTitle":"Tinyhome","smartCostType":"TariffType(0)","sponsor":{"name":"","expiresAt":"0001-01-01T00:00:00Z"},"statistics":{"30d":{"avgCo2":26.762471269181376,"avgPrice":0.15733927681996104,"chargedKWh":283.1679992,"solarPercentage":62.02640138262563},"365d":{"avgCo2":57.007270089019265,"avgPrice":0.15820559968299053,"chargedKWh":512.9509282796665,"solarPercentage":61.648860235620546},"thisYear":{"avgCo2":1.1498351468708952,"avgPrice":0.11124254183004245,"chargedKWh":206.92398070000002,"solarPercentage":82.0684600738946},"total":{"avgCo2":57.007270089019265,"avgPrice":0.15820559968299053,"chargedKWh":512.9509282796665,"solarPercentage":61.648860235620546}},"tariffFeedIn":0.07,"tariffGrid":0.3,"tariffPriceHome":0.073,"tariffPriceLoadpoints":0.3,"vehicles":{"tsla":{"title":"TestCar1","capacity":77,"phases":3,"minSoc":10,"limitSoc":90,"repeatingPlans":[]}},"version":"0.133.0"}} \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/evcc_multiple.txt b/UnitTestsTeslalogger/testdata/evcc_multiple.txt new file mode 100644 index 000000000..383d26eca --- /dev/null +++ b/UnitTestsTeslalogger/testdata/evcc_multiple.txt @@ -0,0 +1,271 @@ +{ + "result": { + "auth": {}, + "aux": [], + "battery": [ + { + "power": -371, + "capacity": 20, + "soc": 82, + "controllable": true + } + ], + "batteryCapacity": 20, + "batteryDischargeControl": false, + "batteryEnergy": 0, + "batteryGridChargeActive": false, + "batteryGridChargeLimit": 0, + "batteryMode": "unknown", + "batteryPower": -371, + "batterySoc": 82, + "bufferSoc": 100, + "bufferStartSoc": 0, + "currency": "EUR", + "eebus": false, + "ext": [], + "fatal": null, + "greenShareHome": 0.615, + "greenShareLoadpoints": 0, + "grid": { + "power": 857, + "currents": [ + 1.7000000000000002, + 5, + 2.1 + ] + }, + "gridConfigured": true, + "hems": {}, + "homePower": 1261, + "influx": { + "url": "", + "database": "", + "org": "", + "user": "", + "insecure": false + }, + "interval": 4, + "loadpoints": [ + { + "batteryBoost": false, + "chargeCurrent": 0, + "chargeCurrents": [ + 0, + 0, + 0 + ], + "chargeDuration": 8421, + "chargePower": 0, + "chargeRemainingDuration": 0, + "chargeRemainingEnergy": 0, + "chargeTotalImport": 6716.148, + "chargedEnergy": 20693, + "chargerFeatureHeating": false, + "chargerFeatureIntegratedDevice": false, + "chargerIcon": null, + "chargerPhases1p3p": true, + "chargerPhysicalPhases": null, + "chargerStatusReason": "unknown", + "charging": false, + "connected": false, + "connectedDuration": 376360, + "disableDelay": 60, + "disableThreshold": 0, + "effectiveLimitSoc": 100, + "effectiveMaxCurrent": 16, + "effectiveMinCurrent": 6, + "effectivePlanId": 0, + "effectivePlanSoc": 0, + "effectivePlanTime": null, + "effectivePriority": 0, + "enableDelay": 60, + "enableThreshold": 0, + "enabled": false, + "limitEnergy": 0, + "limitSoc": 0, + "maxCurrent": 16, + "minCurrent": 6, + "mode": "pv", + "phaseAction": "inactive", + "phaseRemaining": 0, + "phasesActive": 1, + "phasesConfigured": 0, + "phasesEnabled": 1, + "planActive": false, + "planEnergy": 0, + "planOverrun": 0, + "planProjectedEnd": null, + "planProjectedStart": null, + "planTime": null, + "priority": 0, + "pvAction": "inactive", + "pvRemaining": 0, + "sessionCo2PerKWh": null, + "sessionEnergy": 20693, + "sessionPrice": 4.972, + "sessionPricePerKWh": 0.24, + "sessionSolarPercentage": 2.418, + "smartCostActive": false, + "smartCostLimit": 0.15, + "smartCostNextStart": null, + "title": "Carport", + "vehicleClimaterActive": null, + "vehicleDetectionActive": false, + "vehicleLimitSoc": 0, + "vehicleName": "db:2", + "vehicleOdometer": 0, + "vehicleRange": 0, + "vehicleSoc": 0, + "vehicleWelcomeActive": false + }, + { + "batteryBoost": false, + "chargeCurrent": 0, + "chargeCurrents": [ + 0, + 0, + 0 + ], + "chargeDuration": 916, + "chargePower": 0, + "chargeRemainingDuration": 0, + "chargeRemainingEnergy": 0, + "chargeTotalImport": 4658.952, + "chargedEnergy": 2580, + "chargerFeatureHeating": false, + "chargerFeatureIntegratedDevice": false, + "chargerIcon": null, + "chargerPhases1p3p": true, + "chargerPhysicalPhases": null, + "chargerStatusReason": "unknown", + "charging": false, + "connected": false, + "connectedDuration": 988, + "disableDelay": 60, + "disableThreshold": 0, + "effectiveLimitSoc": 100, + "effectiveMaxCurrent": 16, + "effectiveMinCurrent": 6, + "effectivePlanId": 0, + "effectivePlanSoc": 0, + "effectivePlanTime": null, + "effectivePriority": 0, + "enableDelay": 60, + "enableThreshold": 0, + "enabled": false, + "limitEnergy": 0, + "limitSoc": 0, + "maxCurrent": 16, + "minCurrent": 6, + "mode": "pv", + "phaseAction": "inactive", + "phaseRemaining": 0, + "phasesActive": 3, + "phasesConfigured": 0, + "phasesEnabled": 3, + "planActive": false, + "planEnergy": 0, + "planOverrun": 0, + "planProjectedEnd": null, + "planProjectedStart": null, + "planTime": null, + "priority": 0, + "pvAction": "inactive", + "pvRemaining": 0, + "sessionCo2PerKWh": null, + "sessionEnergy": 2580, + "sessionPrice": 0.378, + "sessionPricePerKWh": 0.146, + "sessionSolarPercentage": 56.202, + "smartCostActive": false, + "smartCostLimit": 0.15, + "smartCostNextStart": null, + "title": "Werkstatt", + "vehicleClimaterActive": null, + "vehicleDetectionActive": false, + "vehicleLimitSoc": 0, + "vehicleName": "", + "vehicleOdometer": 0, + "vehicleRange": 0, + "vehicleSoc": 0, + "vehicleWelcomeActive": false + } + ], + "messaging": true, + "modbusproxy": null, + "mqtt": { + "broker": "192.x.x.x:1883", + "topic": "evcc", + "user": "user" + }, + "network": { + "schema": "http", + "host": "evcc.local", + "port": 7070 + }, + "prioritySoc": 95, + "pv": [ + { + "power": 775 + } + ], + "pvEnergy": 0, + "pvPower": 775, + "residualPower": 100, + "siteTitle": "Zuhause", + "smartCostType": "pricestatic", + "sponsor": { + "name": "User1", + "expiresAt": "2099-06-29T15:40:24Z" + }, + "statistics": { + "30d": { + "avgCo2": 0, + "avgPrice": 0.2257843853957783, + "chargedKWh": 365.92899999999827, + "solarPercentage": 8.68052140421579 + }, + "365d": { + "avgCo2": 0, + "avgPrice": 0.10277902273522503, + "chargedKWh": 4327.012840234998, + "solarPercentage": 57.953047221359846 + }, + "thisYear": { + "avgCo2": 0, + "avgPrice": 0.22577860817228562, + "chargedKWh": 365.8329999999987, + "solarPercentage": 8.682799301657521 + }, + "total": { + "avgCo2": 0, + "avgPrice": 0.10542330704153126, + "chargedKWh": 7790.785389968811, + "solarPercentage": 58.223150150734874 + } + }, + "tariffFeedIn": 0.07, + "tariffGrid": 0.245, + "tariffPriceHome": 0.137, + "tariffPriceLoadpoints": 0.245, + "vehicles": { + "db:1": { + "title": "TestCar1", + "icon": "car", + "capacity": 90, + "limitSoc": 85, + "features": [ + "CoarseCurrent" + ], + "repeatingPlans": [] + }, + "db:2": { + "title": "TestCar2", + "icon": "car", + "capacity": 77, + "repeatingPlans": [] + } + }, + "version": "0.133.0" + } +} \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/smartevse3.txt b/UnitTestsTeslalogger/testdata/smartevse3.txt new file mode 100644 index 000000000..6b75b9f06 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/smartevse3.txt @@ -0,0 +1,94 @@ +{ + "version": "v3.6.10", + "serialnr": 1234, + "mode": "NORMAL", + "mode_id": 1, + "car_connected": true, + "wifi": { + "status": "WL_CONNECTED", + "ssid": "Network", + "rssi": -24, + "bssid": "01:23:45:67:89:0A" + }, + "evse": { + "temp": 20, + "temp_max": 70, + "connected": true, + "access": true, + "mode": 0, + "loadbl": 0, + "pwm": 169, + "solar_stop_timer": 0, + "state": "Charging", + "state_id": 2, + "error": "None", + "error_id": 0, + "rfid": "Not Installed" + }, + "settings": { + "charge_current": 100, + "override_current": 100, + "current_min": 6, + "current_max": 16, + "current_main": 25, + "current_max_circuit": 16, + "current_max_sum_mains": 0, + "max_sum_mains_time": 0, + "solar_max_import": 0, + "solar_start_current": 12, + "solar_stop_time": 30, + "enable_C2": "Solar Off", + "mains_meter": "API", + "starttime": 0, + "stoptime": 0, + "repeat": 0 + }, + "mqtt": { + "host": "192.168.0.1", + "port": 1883, + "topic_prefix": "SmartEVSE/1234", + "username": "", + "password_set": false, + "status": "Connected" + }, + "home_battery": { + "current": 0, + "last_update": 0 + }, + "ev_meter": { + "description": "Eastron3P", + "address": 20, + "import_active_power": 6.800000191, + "total_kwh": 2874.199951, + "charged_kwh": 13.80000019, + "currents": { + "TOTAL": 302, + "L1": 100, + "L2": 101, + "L3": 101 + }, + "import_active_energy": 2874.199951, + "export_active_energy": 0 + }, + "mains_meter": { + "import_active_energy": 3456.98765, + "export_active_energy": 0 + }, + "phase_currents": { + "TOTAL": 339, + "L1": 121, + "L2": 106, + "L3": 112, + "last_data_update": 1736631027, + "original_data": { + "TOTAL": 339, + "L1": 121, + "L2": 106, + "L3": 112 + } + }, + "backlight": { + "timer": 120, + "status": "ON" + } +} \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_evse_state.txt b/UnitTestsTeslalogger/testdata/warp_evse_state.txt new file mode 100644 index 000000000..a3ae32f46 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_evse_state.txt @@ -0,0 +1 @@ +{"iec61851_state":0,"charger_state":0,"contactor_state":0,"contactor_error":0,"allowed_charging_current":0,"error_state":0,"lock_state":0,"dc_fault_current_state":0} \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_grid_value_ids.txt b/UnitTestsTeslalogger/testdata/warp_grid_value_ids.txt new file mode 100644 index 000000000..bc6af67f1 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_grid_value_ids.txt @@ -0,0 +1 @@ +[74,209,211] \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_grid_values.txt b/UnitTestsTeslalogger/testdata/warp_grid_values.txt new file mode 100644 index 000000000..9759ce361 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_grid_values.txt @@ -0,0 +1 @@ +[-17,5762.71875,13432.32129] \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_infos_version.txt b/UnitTestsTeslalogger/testdata/warp_infos_version.txt new file mode 100644 index 000000000..09034e87f --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_infos_version.txt @@ -0,0 +1 @@ +{"firmware":"2.6.6+675aeb99","config":"2.6.6","config_type":"warp"} \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_wallbox_value_ids.txt b/UnitTestsTeslalogger/testdata/warp_wallbox_value_ids.txt new file mode 100644 index 000000000..779f2b2ec --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_wallbox_value_ids.txt @@ -0,0 +1 @@ +[1,2,3,13,17,21,39,48,57,122,130,138,83,91,99,353,354,355,7,29,33,74,154,115,356,364,209,211,4,5,6,8,25,213,277,214,210,212,14,18,22] \ No newline at end of file diff --git a/UnitTestsTeslalogger/testdata/warp_wallbox_values.txt b/UnitTestsTeslalogger/testdata/warp_wallbox_values.txt new file mode 100644 index 000000000..324860896 --- /dev/null +++ b/UnitTestsTeslalogger/testdata/warp_wallbox_values.txt @@ -0,0 +1 @@ +[232.3265228,233.3556213,232.8416901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,232.9503174,0,0,0,0,0,0,50.04000092,544.4099731,0.006,402.7033081,407.1804504,400.4727478,403.4683533,0,544.4160156,9.642000198,544.4160156,544.4099731,0.006,0,0,0] \ No newline at end of file