Hi all, I am hoping someone familiar with .NET can help me out (I am a Mac person who recently migrated to HS3 on Windows 7 from Vera and I do not know which way is up in .NET or vbscript).
I attempted to adapt a vb script from @Jon00 's post https://forums.homeseer.com/showpost...3&postcount=12 to make an http PUT to a ha-bridge server running on the same machine as HS3 so I can keep a ha-bridge device's status in sync with a HS3 device:
But it looks like the http PUT call is never made and the response is just logged as the json body (and, embarrassingly, I don't even know enough VB script to know what I am missing!
)
------
When I do the PUT using curl from my Mac:
The ha-bridge device status is correctly updated and the response comes back as:
------
I would really appreciate any suggestions on what I need to change in my HS3 script to get it to actually do the PUT. Thanks!
I attempted to adapt a vb script from @Jon00 's post https://forums.homeseer.com/showpost...3&postcount=12 to make an http PUT to a ha-bridge server running on the same machine as HS3 so I can keep a ha-bridge device's status in sync with a HS3 device:
Code:
Imports System.IO Imports System.Net Sub Main(ByVal Parm As Object) Dim httpWebRequest = DirectCast(WebRequest.Create("http://<ha-bridge ip>:<port>/api/devices/lights/6/bridgeupdatestate"), HttpWebRequest) httpWebRequest.ContentType = "application/json" httpWebRequest.Method = "PUT" Using streamWriter = New StreamWriter(httpWebRequest.GetRequestStream().ToString) Dim json As String = "{""on"": true, ""bri"": 127 }" streamWriter.Write(json) End Using Dim httpResponse = DirectCast(HttpWebRequest.GetResponse(), HttpWebResponse) Using streamReader = New StreamReader(httpResponse.GetResponseStream().ToString) Dim responseText = StreamReader.ReadToEnd() hs.WriteLog("Response", responseText) End Using End Sub

Code:
{"on": true, "bri": 127 }
When I do the PUT using curl from my Mac:
Code:
curl -H "Content-Type: application/json" -X PUT -d '{ "on": true, "bri": 127 }' http://<ha-bridge ip>:<port>/api/devices/lights/6/bridgeupdatestate
Code:
[{"success":{"/lights/6/state/on":true}},{"success":{"/lights/6/state/bri":127}}]
I would really appreciate any suggestions on what I need to change in my HS3 script to get it to actually do the PUT. Thanks!
Comment