public IOBrokerJSONGet GetIOBrokerValue(string objectId) { try { if (DNSHelper.GetIP(IOBrokerHost) == null) { return(null); } //zwave2.0.Node_003.Multilevel_Sensor.humidity using (WebClient wc = new WebClient()) { IOBrokerJSONGet ioJson = new IOBrokerJSONGet(); string downString = IOBrokerGetApi() + System.Web.HttpUtility.UrlEncode(objectId); Console.WriteLine("Download String '{0}'", downString); var json = wc.DownloadString(downString); ioJson = JsonConvert.DeserializeObject <IOBrokerJSONGet>(json); return(ioJson); } } catch (Exception ex) { Console.WriteLine("Fehler beim lesen von IOBroker MicroService", ex); throw; } }
public void UpdateHelligkeit() { IOBrokerJSONGet jsonResult = clusterConn.GetIOBrokerValue(ObjektHelligkeitId); if (jsonResult == null && jsonResult.valInt != null) { Console.WriteLine("keine Daten erhalten"); return; } Helligkeit = jsonResult.valInt.Value; }
public override void Update() { IOBrokerJSONGet jsonResult = clusterConn.GetIOBrokerValue(ObjektId); if (jsonResult == null && jsonResult.valInt != null) { Console.WriteLine("keine Daten erhalten"); return; } Feuchtigkeit = jsonResult.valInt.Value; LastChange = jsonResult.LastChange; }
public override void Update() { IOBrokerJSONGet jsonResult = clusterConn.GetIOBrokerValue(ObjektId); if (jsonResult == null && jsonResult.valBool != null) { Console.WriteLine("Error: keine Daten erhalten"); return; } Status = jsonResult.valBool.Value; LastChange = jsonResult.LastChange; }
public override void Update() { IOBrokerJSONGet jsonResult = clusterConn.GetIOBrokerValue(ObjektId); if (SourceType == SourceType.TrueFalse) { if (jsonResult == null && jsonResult.valBool != null) { Console.WriteLine("Error: keine Daten erhalten"); return; } LastChange = jsonResult.LastChange; Status = jsonResult.valBool.Value; } else if (SourceType == SourceType.Integer) { if (jsonResult == null && jsonResult.valInt != null) { Console.WriteLine("Error: keine Daten erhalten"); return; } if (jsonResult.valInt.Value == 255) { Status = true; } else { Status = false; } LastChange = jsonResult.LastChange; } if (Status == true) { LastChangeTrue = LastChange; } else { LastChangeFalse = LastChange; } }