Exemplo n.º 1
0
        public ActionResult Get(string id, string zielwert)
        {
            //datentyp herausfinden
            bool isZielwertBool = true;
            bool zielwertBool   = false;
            int  zielwertInt    = 0;

            if (zielwert == "true")
            {
                zielwertBool = true;
            }
            else if (zielwert == "false")
            {
                zielwertBool = false;
            }
            else
            {
                isZielwertBool = false;
                zielwertInt    = Int32.Parse(zielwert);
            }

            Console.WriteLine("get string: {0}, zielwert= {1}", id, zielwert);

            IOBrokerWebConnector ioSet = new IOBrokerWebConnector();
            IOBrokerJSONSet      result;

            if (isZielwertBool == true)
            {
                result = ioSet.SetIOBrokerValue(id, zielwertBool);
            }
            else
            {
                result = ioSet.SetIOBrokerValue(id, zielwertInt);
            }
            if (result != null)
            {
                Console.WriteLine("content zurück erhalten");
                return(Content(JsonConvert.SerializeObject(result), "application/json"));
            }
            else
            {
                Console.WriteLine("content null, ohne error");
                return(null);
            }


            //return "value " + intColl.getIntValue(id);
        }
Exemplo n.º 2
0
        public void TestSetIOBrokerValue()
        {
            try
            {
                IOBrokerJSONSet      ioJson = new IOBrokerJSONSet();
                IOBrokerWebConnector wc     = new IOBrokerWebConnector();
                ioJson = wc.SetIOBrokerValue("shelly.0.SHSW-25#D8BFC01A2B2A#1.Relay0.Switch", false);
            }

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