MyStrom Switch |
https://mystrom.ch/wifi-switch-ch/ |
Product page |
|
https://api.mystrom.ch/ |
Restful API documentation |
|
<ip> | Your local myStrom IP address |
Results |
http://<ip>/ | Home page - for configuration |
|
http://<ip>/report |
Returns JSON page | https://api.mystrom.ch/ |
http://<ip>/api/v1/settings | Current status |
{"rest":true,"panel":true,"name":"","temp_offset":0} |
http://<ip>/relay?state=1 | Turn On | |
http://<ip>/relay?state=0 | Turn Off | |
VB example |
JSON = urlLaunch("http://<ip>/report") |
Get the JSON status result or blank if offline |
VB6 routine (requires Microsoftl XML, v5.0 reference ) |
Private Function urlLaunch(ByVal URL As String) As String Dim Ans As String Dim oHTTP As MSXML2.XMLHTTP, sBuffer As String ModuleName = "urlLaunch" On Error GoTo HandleError 100 Set oHTTP = CreateObject("MSXML2.ServerXMLHTTP") 105 oHTTP.setTimeouts 3500, 3500, 3500, 3500 110 oHTTP.open "GET", URL, False 120 oHTTP.send 130 sBuffer = oHTTP.responseText 140 Set oHTTP = Nothing 150 urlLaunch = sBuffer HandleExit: Exit Function HandleError: urlLaunch = "" Set oHTTP = Nothing On Error GoTo 0 End Function |
|
VB6 convert JSON result to readable |
Function JSONFormat(JSON As String) As String y = Replace(JSON, vbTab, "") y = Replace(y, vbLf, "") y = Replace(y, "{", "{" & vbCrLf) y = Replace(y, "}", vbCrLf & "}") y = Replace(y, ",", vbCrLf) JSONFormat = y End Function |
Download Windows JSON.exe Converter tool Download Windows JSON.zip Converter tool |