Beispiel #1
0
 public void SwitchToggle()
 {
     using (HttpClient httpClient = new HttpClient())
     {
         var result = httpClient.GetStringAsync(string.Format("{0}/relay/{1}?turn=toggle", Parent.deviceUrl, Id)).Result;
         RelayTurnResponse response = Newtonsoft.Json.JsonConvert.DeserializeObject <RelayTurnResponse>(result);
         this.Ison = response.Ison;
     }
 }
Beispiel #2
0
        // public static Relay FromJson(string json) => JsonConvert.DeserializeObject<Relay>(json);


        private void UpdateRelay(object state)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                var result = httpClient.GetStringAsync(string.Format("{0}/relay/{1}", Parent.deviceUrl, Id)).Result;
                RelayTurnResponse response = Newtonsoft.Json.JsonConvert.DeserializeObject <RelayTurnResponse>(result);
                this.Ison = response.Ison;
            }
        }