public ActionResult Get(string id) //public string Get(string id) { try { Stopwatch sw = new Stopwatch(); sw.Start(); Console.WriteLine("getter aufgerufen: " + id); IOBrokerWebConnector ioColl = new IOBrokerWebConnector(); IOBrokerJSONGet result = ioColl.GetIOBrokerValue(id); if (result != null) { Console.WriteLine("content zurück erhalten, dauer: {0}", sw.ElapsedMilliseconds); return(Content(JsonConvert.SerializeObject(result), "application/json")); } else { Console.WriteLine("content null, ohne error"); return(null); } } catch (Exception ex) { Console.WriteLine("error bei return: " + ex.InnerException); return(null); //throw; } //return "value " + intColl.getIntValue(id); }
public void TestGetIOBrokerValue() { try { IOBrokerJSONGet ioJson = new IOBrokerJSONGet(); IOBrokerWebConnector wc = new IOBrokerWebConnector(); ioJson = wc.GetIOBrokerValue("zigbee.0.00158d00045c0c7c.temperature"); } catch (Exception ex) { Console.WriteLine("Fehler beim lesen von IOBroker", ex); //throw; } }