// Decompiled with JetBrains decompiler // Type: Shelly.Shelly3PM.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; using System.Collections.Generic; using System.Linq; #nullable disable namespace Shelly.Shelly3PM { public class SensorEntity : ISensor { private Config cfg; public override bool Execute() { try { this.cfg = this.getConfiguration(); new ResultSet().XMLSerializeData(); string str = this.HttpRequest(this.Sensor.URL); if (str != null) { ResultSet resultSet = JsonConvert.DeserializeObject(str); if (this.cfg.Sum) this.LastValue = ((IEnumerable)resultSet.emeters).Sum((Func)(f => f.total)).ToString(); else this.LastValue = resultSet.emeters?[this.cfg.index]?.total.ToString(); this.LastValueDate = new DateTime?(DateTime.Now); return true; } } catch (Exception ex) { Console.WriteLine((object)ex); this.ErrorMsg = ex.Message; } return false; } } }