-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from pkuehnel/develop
Develop
- Loading branch information
Showing
28 changed files
with
697 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
@page "/BaseConfiguration" | ||
@using TeslaSolarCharger.Shared.Dtos.BaseConfiguration | ||
@using System.Runtime.InteropServices | ||
@inject HttpClient HttpClient | ||
@inject IToastService ToastService | ||
|
||
<PageTitle>Base Configuration</PageTitle> | ||
|
||
<h3>Base Configuration</h3> | ||
|
||
@if (_dtoBaseConfiguration == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<EditForm Model="@_dtoBaseConfiguration" OnValidSubmit="@HandleValidSubmit"> | ||
<DataAnnotationsValidator /> | ||
<ValidationSummary /> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="carPriorities">Car Ids</label> | ||
<InputText id="carPriorities" @bind-Value="_dtoBaseConfiguration.CarPriorities" placeholder="1|3|2" class="form-control" /> | ||
<small id="powerBufferHelp" class="form-text text-muted">Car Ids separated by '|'. Note: The order of the IDs is the order of power distribution.</small> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridUrl">Grid Power Url</label> | ||
<InputText id="currentPowerToGridUrl" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridUrl" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="powerBuffer">Power Buffer (Watt)</label> | ||
<InputNumber id="powerBuffer" @bind-Value="_dtoBaseConfiguration.PowerBuffer" class="form-control" /> | ||
<small id="powerBufferHelp" class="form-text text-muted">Set values higher than 0 to e.g. charge your home battery first, or lower than minimum adjustable power to charge your car first (e.g. 230V * 1A * 3 phases => -691W).</small> | ||
</div> | ||
<div class="form-group"> | ||
<InputCheckbox id="currentPowerToGridInvertValue" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridInvertValue" class="form-check-input" /> | ||
<label for="currentPowerToGridInvertValue">Invert Grid Power Value</label> | ||
<div> | ||
<small id="currentPowerToGridInvertValueHelp" class="form-text text-muted">Use this if consuming power from the grid is a positive value.</small> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridJsonPattern">Grid Power Json Pattern</label> | ||
<InputText id="currentPowerToGridJsonPattern" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridJsonPattern" placeholder="$.data.overage" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridXmlPattern">Grid Power XML Pattern</label> | ||
<InputText id="currentPowerToGridXmlPattern" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridXmlPattern" placeholder="Device/Measurements/Measurement" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridXmlAttributeHeaderName">Grid Power XML Attribute Header Name</label> | ||
<InputText id="currentPowerToGridXmlAttributeHeaderName" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridXmlAttributeHeaderName" placeholder="AttributeHeaderName" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridXmlAttributeHeaderValue">Grid Power XML Attribute Header Value</label> | ||
<InputText id="currentPowerToGridXmlAttributeHeaderValue" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridXmlAttributeHeaderValue" placeholder="AttributeHeaderValue" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridXmlAttributeValueName">Grid Power XML Attribute Header Value</label> | ||
<InputText id="currentPowerToGridXmlAttributeValueName" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridXmlAttributeValueName" placeholder="AttributeValueName" class="form-control" /> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="currentInverterPowerUrl">Inverter Power Url</label> | ||
<InputText id="currentInverterPowerUrl" @bind-Value="_dtoBaseConfiguration.CurrentInverterPowerUrl" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentInverterPowerJsonPattern">Inverter Power Json Pattern</label> | ||
<InputText id="currentInverterPowerJsonPattern" @bind-Value="_dtoBaseConfiguration.CurrentInverterPowerJsonPattern" placeholder="$.data.overage" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentPowerToGridXmlPattern">Grid Power XML Pattern</label> | ||
<InputText id="currentPowerToGridXmlPattern" @bind-Value="_dtoBaseConfiguration.CurrentPowerToGridXmlPattern" placeholder="Device/Measurements/Measurement" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentInverterPowerXmlAttributeHeaderName">Inverter Power XML Attribute Header Name</label> | ||
<InputText id="currentInverterPowerXmlAttributeHeaderName" @bind-Value="_dtoBaseConfiguration.CurrentInverterPowerXmlAttributeHeaderName" placeholder="AttributeHeaderName" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentInverterPowerXmlAttributeHeaderValue">Inverter Power XML Attribute Header Value</label> | ||
<InputText id="currentInverterPowerXmlAttributeHeaderValue" @bind-Value="_dtoBaseConfiguration.CurrentInverterPowerXmlAttributeHeaderValue" placeholder="AttributeHeaderValue" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="currentInverterPowerXmlAttributeValueName">Inverter Power XML Attribute Header Value</label> | ||
<InputText id="currentInverterPowerXmlAttributeValueName" @bind-Value="_dtoBaseConfiguration.CurrentInverterPowerXmlAttributeValueName" placeholder="AttributeValueName" class="form-control" /> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="updateIntervalSeconds">Car Power Adjustment Intervall (seconds)</label> | ||
<InputNumber id="updateIntervalSeconds" @bind-Value="_dtoBaseConfiguration.UpdateIntervalSeconds" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="pvValueUpdateIntervalSeconds">Solar plant adjustment intervall (seconds)</label> | ||
<InputNumber id="pvValueUpdateIntervalSeconds" @bind-Value="_dtoBaseConfiguration.PvValueUpdateIntervalSeconds" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="minutesUntilSwitchOn">Time with enough solar power until charging starts (minutes)</label> | ||
<InputNumber id="minutesUntilSwitchOn" @bind-Value="_dtoBaseConfiguration.MinutesUntilSwitchOn" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="minutesUntilSwitchOff">Time without enough solar power until charging stops (minutes)</label> | ||
<InputNumber id="minutesUntilSwitchOff" @bind-Value="_dtoBaseConfiguration.MinutesUntilSwitchOff" class="form-control" /> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="teslaMateApiBaseUrl">Teslamate API Base Url</label> | ||
<InputText id="teslaMateApiBaseUrl" @bind-Value="_dtoBaseConfiguration.TeslaMateApiBaseUrl" placeholder="http://teslamateapi:8080" class="form-control" /> | ||
<small id="teslaMateApiBaseUrlHelp" class="form-text text-muted">You can use the name of the container and the default port even though you changed the external port.</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="geoFence">Relevant Geofence</label> | ||
<InputText id="geoFence" @bind-Value="_dtoBaseConfiguration.GeoFence" placeholder="http://teslamateapi:8080" class="form-control" /> | ||
<small id="geoFenceHelp" class="form-text text-muted">You have to add a geofence with the same name in TeslaMate</small> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="teslaMateDbServer">TeslaMate Database Server Name</label> | ||
<InputText id="teslaMateDbServer" @bind-Value="_dtoBaseConfiguration.TeslaMateDbServer" placeholder="database" class="form-control" /> | ||
<small id="geoFenceHelp" class="form-text text-muted">You can use the name of the TeslaMate database container</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="teslaMateDbPort">TeslaMate Database Server Port</label> | ||
<InputNumber id="teslaMateDbPort" @bind-Value="_dtoBaseConfiguration.TeslaMateDbPort" placeholder="5432" class="form-control" /> | ||
<small id="geoFenceHelp" class="form-text text-muted">You can use the internal port of the TeslaMate database container</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="teslaMateDbUser">TeslaMate Database Username</label> | ||
<InputText id="teslaMateDbUser" @bind-Value="_dtoBaseConfiguration.TeslaMateDbUser" placeholder="username" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="teslaMateDbPassword">TeslaMate Database Server Password</label> | ||
<InputText type="password" id="teslaMateDbPassword" @bind-Value="_dtoBaseConfiguration.TeslaMateDbPassword" placeholder="secret" class="form-control" /> | ||
</div> | ||
<hr /> | ||
<div class="form-group"> | ||
<label for="mosquitoServer">Mosquito servername</label> | ||
<InputText id="mosquitoServer" @bind-Value="_dtoBaseConfiguration.MosquitoServer" placeholder="mosquitto" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="mqqtClientId">Mqqt ClientId</label> | ||
<InputText id="mqqtClientId" @bind-Value="_dtoBaseConfiguration.MqqtClientId" placeholder="TeslaSolarCharger" class="form-control" /> | ||
</div> | ||
<hr /> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</EditForm> | ||
} | ||
|
||
@code { | ||
private DtoBaseConfiguration? _dtoBaseConfiguration; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
_dtoBaseConfiguration = await HttpClient.GetFromJsonAsync<DtoBaseConfiguration>("/api/BaseConfiguration/GetBaseConfiguration"); | ||
} | ||
private async Task HandleValidSubmit() | ||
{ | ||
var result = await HttpClient.PutAsJsonAsync($"api/BaseConfiguration/UpdateBaseConfiguration", _dtoBaseConfiguration); | ||
if (result.IsSuccessStatusCode) | ||
{ | ||
ToastService.ShowSuccess("Base Configuration updated"); | ||
} | ||
else | ||
{ | ||
ToastService.ShowError("Error updating base configuration"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
TeslaSolarCharger/Server/Contracts/IEnvironmentVariableConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TeslaSolarCharger.Server.Contracts; | ||
|
||
public interface IEnvironmentVariableConverter | ||
{ | ||
Task ConvertAllValues(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.