Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        public void UpdateHelligkeit()
        {
            IOBrokerJSONGet jsonResult = clusterConn.GetIOBrokerValue(ObjektHelligkeitId);

            if (jsonResult == null && jsonResult.valInt != null)
            {
                Console.WriteLine("keine Daten erhalten");
                return;
            }
            Helligkeit = jsonResult.valInt.Value;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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;
            }
        }