30 lines
793 B
C#
30 lines
793 B
C#
|
using System.Text.Json;
|
||
|
using System.Text.Json.Nodes;
|
||
|
|
||
|
namespace InnovEnergy.Lib.Victron.VictronVRM;
|
||
|
|
||
|
|
||
|
public readonly partial record struct Installation
|
||
|
{
|
||
|
|
||
|
public async Task<IReadOnlyList<String>> GetAlarms()
|
||
|
{
|
||
|
var reply = await VrmAccount.AlarmsRequest(IdSite).TryGetJson();
|
||
|
|
||
|
var vrmReply = new Reply(reply);
|
||
|
if (!vrmReply.Success)
|
||
|
throw new Exception(nameof(GetAlarms) + " failed");
|
||
|
|
||
|
return vrmReply.Alarms;
|
||
|
}
|
||
|
|
||
|
public async Task<Boolean> SetAlarms(JsonObject tags)
|
||
|
{
|
||
|
var reply = await VrmAccount.AlarmsRequest(IdSite).TryPostJson(tags);
|
||
|
var vrmReply = new Reply(reply);
|
||
|
if (!vrmReply.Success)
|
||
|
throw new Exception(nameof(SetAlarms) + " failed");
|
||
|
|
||
|
return vrmReply.Success;
|
||
|
}
|
||
|
}
|