TeslaTibberCharger 1.1.0

dotnet add package TeslaTibberCharger --version 1.1.0                
NuGet\Install-Package TeslaTibberCharger -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TeslaTibberCharger" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TeslaTibberCharger --version 1.1.0                
#r "nuget: TeslaTibberCharger, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TeslaTibberCharger as a Cake Addin
#addin nuget:?package=TeslaTibberCharger&version=1.1.0

// Install TeslaTibberCharger as a Cake Tool
#tool nuget:?package=TeslaTibberCharger&version=1.1.0                

Tesla Tibber Charger

This package will offer you an option to charge your car if enough solar power is available. We will use the TibberSDK to get your current home power usage trough Tibber Pulse. Tibber Pulse is installed on your energy meter. If we detect a negative power consumption above 'MinProductionPower' in W we will try to start charging if your cable is conneted to the car and your are at your home position. If the connection to tibber fails we will reconnect the realtime subscription.

Usage

var httpClient = new HttpClient();
var teslaAccessToken = "";
var homeLatitude = "";
var homeLongitude = "";
var tibberToken = "";
var teslaProvider = new TeslaAdapter(httpClient, teslaAccessToken, homeLatitude, homeLongitude);
var tibberRrovider = new TibberAdapter(tibberToken);
var curentHomePower = await tibberRrovider.ListenToCurrentHomerPowerAsync();
var teslaObserver = new TeslaRealtimeTibberCharger(teslaProvider);
teslaObserver.OnConnectionClosed += TeslaObserver_OnConnectionIssue;

curentHomePower.Subscribe(teslaObserver);

void TeslaObserver_OnConnectionIssue()
{
    curentHomePower = tibberProvider.ListenToCurrentHomerPowerAsync().Result;
    curentHomePower.Subscribe(teslaObserver);
}

Contribution

Feel free to help to make it better

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 195 5/20/2023
1.0.2 180 5/3/2023
1.0.1 182 4/13/2023
1.0.0 162 4/13/2023