Esempio n. 1
0
        static void Main(string[] args)
        {
            //var nestSharp = NestSharpBuilder.Authorize("", "", "").Result;
            INestApi nestSharp = NestApiBuilder.WithExistingAccessToken("");
            var devices = nestSharp.GetDeviceInformation().Result;
            var structures = nestSharp.GetStructureInformation().Result;

            /*ThermostatRequest request = new ThermostatRequest();
            request.DeviceId = devices.Thermostats.First().Value.DeviceId;
            request.TemperatureScale = NestSharp.Api.TemperatureScale.Fahrenheit;
            request.TargetTemperatureFahrenheit = 76;
            nestSharp.SetThermostat(request).Wait();*/

            StructureRequest request = new StructureRequest();
            request.StructureId = structures.First().Value.StructureId;
            request.Away = AwayState.Away;
            nestSharp.SetStructure(request).Wait();
        }
Esempio n. 2
0
 /// <summary>
 /// Updates a structure
 /// </summary>
 /// <param name="request">Request information</param>
 /// <returns></returns>
 public async Task SetStructure(StructureRequest request)
 {
     string url = string.Format("structures/{0}", request.StructureId);
     StructureRequest response = await _client.PutRequest<StructureRequest, StructureRequest>(url, request);
 }