Setting target temperature with VB.NET


#1

Hi,

Can anyone please let me know why the following code runs without error, but the target_temperature_c on the thermostat is never updated. The settings work fine using postman. Apologies if this is the wrong forum - I’m very new to all this…

    Dim uri As String = "https://developer-api.nest.com/devices/thermostats/" & NestDeviceID
    Dim client As Http.HttpClient = New Http.HttpClient()
    Dim content As Http.StringContent = New Http.StringContent("{""target_temperature_c"": 19.0}")
    content.Headers.ContentType = New Http.Headers.MediaTypeHeaderValue("application/json")
    client.DefaultRequestHeaders.Add("Authorization", "Bearer " & auth)
    Dim tsk As Task(Of Http.HttpResponseMessage) = client.PutAsync(uri, content)

Many thanks in advance