Skip to content

Commit

Permalink
V1.60.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Dec 7, 2024
1 parent 06cda41 commit 639896d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
7 changes: 5 additions & 2 deletions TeslaLogger/Car.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ private void InitStage3()
if (!DbHelper.GetRegion())
webhelper.GetRegion();

webhelper.CheckVirtualKey();
if (!dbHelper.CheckVirtualKey())
webhelper.CheckVirtualKey();

if (webhelper.GetVehicles() == "NULL")
{
Expand Down Expand Up @@ -1600,7 +1601,9 @@ private void HandleStateChange(TeslaState _oldState, TeslaState _newState)
if (_oldState == TeslaState.Start && _newState == TeslaState.Online)
{
telemetry?.StartConnection();
_ = webhelper.GetOdometerAsync();
if (!FleetAPI)
_ = webhelper.GetOdometerAsync();

Tools.DebugLog($"#{CarInDB}:Start -> Online SendDataToAbetterrouteplannerAsync(utc:{Tools.ToUnixTime(DateTime.UtcNow) * 1000}, soc:{CurrentJSON.current_battery_level}, speed:0, charging:false, power:0, lat:{CurrentJSON.GetLatitude()}, lon:{CurrentJSON.GetLongitude()})");
_ = webhelper.SendDataToAbetterrouteplannerAsync(Tools.ToUnixTime(DateTime.UtcNow) * 1000, CurrentJSON.current_battery_level, 0, false, 0, CurrentJSON.GetLatitude(), CurrentJSON.GetLongitude());
}
Expand Down
34 changes: 34 additions & 0 deletions TeslaLogger/DBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7095,6 +7095,40 @@ id ASC
}
}

internal bool CheckVirtualKey()
{
try
{
using (MySqlConnection con = new MySqlConnection(DBConnectionstring))
{
con.Open();
using (MySqlCommand cmd = new MySqlCommand("SELECT needVirtualKey, virtualkey FROM cars where id = @CarID", con))
{
cmd.Parameters.AddWithValue("@CarID", car.CarInDB);

MySqlDataReader dr = SQLTracer.TraceDR(cmd);
if (dr.Read())
{
if (dr[0] == DBNull.Value)
return false;

if (dr["needVirtualKey"].ToString() == "0" && dr["virtualKey"].ToString() == "1")
{
return true;
}
}
}
}
}
catch (Exception ex)
{
ex.ToExceptionless().FirstCarUserID().Submit();
Logfile.Log(ex.ToString());
}

return false;
}

internal bool GetRegion()
{
try
Expand Down
4 changes: 2 additions & 2 deletions TeslaLogger/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.59.14.0")]
[assembly: AssemblyFileVersion("1.59.14.0")]
[assembly: AssemblyVersion("1.60.0.0")]
[assembly: AssemblyFileVersion("1.60.0.0")]

[assembly: InternalsVisibleTo("UnitTestsTeslaloggerNET8")]
[assembly: InternalsVisibleTo("UnitTestsTeslalogger")]
Binary file modified TeslaLogger/bin/TeslaLogger.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions TeslaLogger/bin/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Version 1.59.14
- Bugfixes
# Version 1.60.0
- Stable version

# Version 1.59.12
- Daily info on admin panel about the need to migrate to Fleet API and the subscription model
Expand Down

0 comments on commit 639896d

Please sign in to comment.