22 lines
891 B
C#
22 lines
891 B
C#
|
using System.Text.Json.Nodes;
|
||
|
|
||
|
namespace InnovEnergy.Lib.Victron.VictronVRM;
|
||
|
|
||
|
|
||
|
/// Settings are *read* as part of the json (Installation class) returned by GetInstallation*
|
||
|
/// Settings are *written* using a special request VrmAccount.SettingsRequest
|
||
|
|
||
|
public readonly partial record struct Installation
|
||
|
{
|
||
|
|
||
|
public Task<Boolean> SetNotes (String notes) => SetSettings(new JsonObject { ["notes"] = notes });
|
||
|
public Task<Boolean> SetName (String name) => SetSettings(new JsonObject { ["description"] = name });
|
||
|
public Task<Boolean> SetPhoneNumber(String phoneNb) => SetSettings(new JsonObject { ["phonenumber"] = phoneNb });
|
||
|
|
||
|
private async Task<Boolean> SetSettings(JsonObject settings)
|
||
|
{
|
||
|
var reply = await VrmAccount.SettingsRequest(IdSite).TryPostJson(settings);
|
||
|
var vrmReply = new Reply(reply);
|
||
|
return vrmReply.Success;
|
||
|
}
|
||
|
}
|