Entwicklung/Sensormat/Shelly/Shelly1PM/SensorEntity.cs
2025-09-23 10:21:23 +02:00

40 lines
1.2 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Shelly.Shelly1PM.SensorEntity
// Assembly: Shelly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 2DDB6D74-8C37-490A-B928-07FB0E37240C
// Assembly location: \\192.168.178.26\Freigabe\Shelly.dll
using Newtonsoft.Json;
using Sensormat;
using Sensormat.Entities;
using System;
#nullable disable
namespace Shelly.Shelly1PM
{
public class SensorEntity : ISensor
{
public override bool Execute()
{
try
{
int id = this.Sensor.ID;
new ResultSet().XMLSerializeData<ResultSet>();
string str = this.HttpRequest(this.Sensor.URL);
if (str != null)
{
this.LastValue = JsonConvert.DeserializeObject<ResultSet>(str).meters?[0]?.total.ToString();
this.LastValueDate = new DateTime?(DateTime.Now);
return true;
}
}
catch (Exception ex)
{
Console.WriteLine((object)ex);
this.ErrorMsg = ex.Message;
}
return false;
}
}
}