Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #998

Merged
merged 41 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ef616d6
refactor(BaseConfigService): remove unused usings
pkuehnel Nov 27, 2023
b5b7560
feat(EF): Add TeslaToken to database
pkuehnel Nov 27, 2023
47a8e77
feat(TeslaTokenService): add TeslaTokenService
pkuehnel Nov 27, 2023
5f7d3d3
feat(TeslaFleetApi): Implement charge start, stop and amp set
pkuehnel Nov 27, 2023
8390a1f
feat(TeslaFleetApiService): can refresh token
pkuehnel Nov 27, 2023
a0ce117
feat(TeslaFleetApiService): allow adding new Tokens
pkuehnel Nov 28, 2023
72f36b3
Merge pull request #992 from pkuehnel/feat/fleetApi
pkuehnel Nov 28, 2023
8797494
fix(BaseConfigurationService): Do not backup carConfig.json as is not…
pkuehnel Nov 28, 2023
d922155
Merge pull request #999 from pkuehnel/fix/backupNonExistingFile
pkuehnel Nov 29, 2023
7e46ab7
feat(TeslaFleetApiService): log responses
pkuehnel Nov 29, 2023
5b7154b
feat(TeslaFleetApiService): wake up car if needed and resume teslamat…
pkuehnel Nov 29, 2023
411b014
Merge pull request #1002 from pkuehnel/feat/logTeslaFleetApiResults
pkuehnel Nov 29, 2023
75e223a
feat(Index.razor): Display installation Id
pkuehnel Dec 1, 2023
8758007
Merge pull request #1003 from pkuehnel/feat/InstallationId
pkuehnel Dec 1, 2023
50694a0
feat(TeslaFleetApiService): add UI for fleet api
pkuehnel Dec 3, 2023
afd2d0c
feat(TeslaFleetApiService): autorefresh token
pkuehnel Dec 3, 2023
a46bfa1
feat(BackendApiServicE): remove token on creating new one
pkuehnel Dec 3, 2023
4c8d764
Merge pull request #1004 from pkuehnel/feat/teslaFleetApiUI
pkuehnel Dec 3, 2023
628c514
feat(TscConfigurationService): add option to post installation inform…
pkuehnel Dec 3, 2023
784a449
Merge pull request #1005 from pkuehnel/feat/installInfo
pkuehnel Dec 3, 2023
7949013
feat(TeslaFleetApiService): log errors to backend
pkuehnel Dec 3, 2023
d575891
Merge pull request #1006 from pkuehnel/feat/logErrors
pkuehnel Dec 3, 2023
88bf97b
feat(TeslaFleetApiService): add status codes to error logs
pkuehnel Dec 4, 2023
64d3ac8
Merge pull request #1008 from pkuehnel/feat/betterErrorLogs
pkuehnel Dec 4, 2023
f63b982
feat(IssueValidationService): display issues based on token state
pkuehnel Dec 4, 2023
a1ce5b0
feat(TeslaFleetApiService): do not retry getting a tiken if request h…
pkuehnel Dec 4, 2023
406607f
Merge pull request #1009 from pkuehnel/feat/fleetApiIssues
pkuehnel Dec 4, 2023
c60049b
feat(TeslaFleetApiService): add scheduledChargingSupport
pkuehnel Dec 4, 2023
3745521
Merge pull request #1010 from pkuehnel/feat/FleetApiScheduledCharging
pkuehnel Dec 4, 2023
cca31e0
feat(FleetApiService): can handle unauthorized on token refresh
pkuehnel Dec 4, 2023
5057493
feat(TeslaFleetApiService):L do correct deserialization of command re…
pkuehnel Dec 4, 2023
feb7cfb
Merge pull request #1012 from pkuehnel/feat/handleUnauthorizedRefresh…
pkuehnel Dec 4, 2023
91561c7
feat(TeslaFleetApiService): add Tesla response string on unauthorized
pkuehnel Dec 6, 2023
ec4f1a3
feat(FleetApiController): Add Dev only Set Charge Limit endpoint
pkuehnel Dec 6, 2023
af1bab0
feat(TeslaMateApiService): use Expires in to avoid first refresh imme…
pkuehnel Dec 6, 2023
f54056e
Merge pull request #1013 from pkuehnel/fix/tokenRefreshIssue
pkuehnel Dec 6, 2023
adae6f6
feat(TeslaApiService): can handle not enough scopes
pkuehnel Dec 6, 2023
83346fa
fix(BaseConfigurationRazor): fix link to Tesla third party apps
pkuehnel Dec 6, 2023
035b3a7
Merge pull request #1014 from pkuehnel/feat/HandleRequiredScopes
pkuehnel Dec 6, 2023
4b49c16
feat(README): add privacy notes
pkuehnel Dec 6, 2023
fc1fa2c
Merge pull request #1015 from pkuehnel/feat/READMEprivacyNotes
pkuehnel Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TeslaSolarCharger is a service to set one or multiple Teslas' charging current u
- [How to use](#how-to-use)
- [Charge Modes](#charge-modes)
- [Generate logfiles](#generate-logfiles)
- [Privacy notes](#privacy-notes)

## How to install

Expand Down Expand Up @@ -1031,3 +1032,9 @@ If you get an error like `Error: No such container:` you can look up the contain
```bash
docker ps
```


As the new Tesla Fleet API requires a domain and external Token creation from version 2.23.0 onwards, TSC transfers some data to the owner of this repository. By using this software, you accept the transfer of this data. As this is open source, you can see which data is transferred. For now (6th December 2023), the following data is transferred:
- Your access code is used to get the access token from Tesla (Note: the token itself is only stored locally in your TSC installation. It is only transferred via my server, but the token only exists in memory on the server itself. It is not stored in a database or log file)
- Your installation ID (GUID) is at the bottom of the page. Do not post this GUID in public forums, as it is used to deliver the Tesla access token to your installation. Note: There is only a five-minute time window between requesting and providing the token using the installation ID. After these 5 minutes, all requests are blocked.)
- Your installed version.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public interface ITeslaSolarChargerContext
Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken());
DatabaseFacade Database { get; }
DbSet<SpotPrice> SpotPrices { get; set; }
DbSet<TeslaToken> TeslaTokens { get; set; }
DbSet<TscConfiguration> TscConfigurations { get; set; }
void RejectChanges();
}
14 changes: 14 additions & 0 deletions TeslaSolarCharger.Model/Entities/TeslaSolarCharger/TeslaToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.Extensions.Primitives;
using TeslaSolarCharger.Model.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class TeslaToken
{
public int Id { get; set; }
public string AccessToken { get; set; }
public string RefreshToken { get; set; }
public string IdToken { get; set; }
public DateTime ExpiresAtUtc { get; set; }
public TeslaFleetApiRegion Region { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class TscConfiguration
{
public int Id { get; set; }
public string Key { get; set; }
public string? Value { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class TeslaSolarChargerContext : DbContext, ITeslaSolarChargerContext
public DbSet<HandledCharge> HandledCharges { get; set; } = null!;
public DbSet<PowerDistribution> PowerDistributions { get; set; } = null!;
public DbSet<SpotPrice> SpotPrices { get; set; } = null!;
public DbSet<TeslaToken> TeslaTokens { get; set; } = null!;
public DbSet<TscConfiguration> TscConfigurations { get; set; } = null!;

// ReSharper disable once UnassignedGetOnlyAutoProperty
public string DbPath { get; }
Expand Down Expand Up @@ -41,6 +43,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<ChargePrice>()
.Property(c => c.EnergyProvider)
.HasDefaultValue(EnergyProvider.OldTeslaSolarChargerConfig);

modelBuilder.Entity<TscConfiguration>()
.HasIndex(c => c.Key)
.IsUnique();
}

#pragma warning disable CS8618
Expand Down
7 changes: 7 additions & 0 deletions TeslaSolarCharger.Model/Enums/TeslaFleetApiRegion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace TeslaSolarCharger.Model.Enums;

public enum TeslaFleetApiRegion
{
Emea,
NorthAmerica,
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions TeslaSolarCharger.Model/Migrations/20231127233402_AddTeslaToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TeslaSolarCharger.Model.Migrations
{
/// <inheritdoc />
public partial class AddTeslaToken : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TeslaTokens",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AccessToken = table.Column<string>(type: "TEXT", nullable: false),
RefreshToken = table.Column<string>(type: "TEXT", nullable: false),
IdToken = table.Column<string>(type: "TEXT", nullable: false),
ExpiresAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
Region = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TeslaTokens", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TeslaTokens");
}
}
}
Loading
Loading