Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private IOBrokerJSONGet getResult(string iobrokertag)
        {
            IOBrokerJSONGet ioJson = new IOBrokerJSONGet();

            IOBrokerClusterConnector wc = new IOBrokerClusterConnector();

            ioJson = wc.GetIOBrokerValue("zigbee.0.00158d00045c0c7c.temperature");



            return(ioJson);
        }
Exemplo n.º 3
0
        public void TestGetValue()
        {
            try
            {
                IOBrokerJSONGet          ioJson = new IOBrokerJSONGet();
                IOBrokerClusterConnector wc     = new IOBrokerClusterConnector();
                ioJson = wc.GetIOBrokerValue("zwave2.0.Node_003.Basic.currentValue");
            }

            catch (Exception ex)
            {
                Console.WriteLine("Fehler beim lesen von IOBroker", ex);
                //throw;
            }
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        public void TestIntBool()
        {
            try
            {
                //zwave2.0.Node_003.Multilevel_Sensor.humidity
                using (WebClient wc = new WebClient())
                {
                    IOBrokerJSONGet ioJson = new IOBrokerJSONGet();

                    string downString = IOBrokerApi + "zwave2.0.Node_024.Binary_Sensor.any";
                    Console.WriteLine("Download String '{0}'", downString);


                    var json = wc.DownloadString(downString);
                    ioJson = JsonConvert.DeserializeObject <IOBrokerJSONGet>(json);
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine("Fehler beim lesen von IOBroker", ex);
                //throw;
            }
        }