-
Notifications
You must be signed in to change notification settings - Fork 23
Set sch_week via http api? #303
Copy link
Copy link
Open
Description
I'm getting "httpd_query_key_value() failed with ESP_ERR_HTTPD_RESULT_TRUNC" erros when trying to set my ranges using the powershell below, i assume the GET string is too long. How should i format the JSON?
$chargerIP = "192.168.1.173"
Build the sch_week object
$schWeek = @{
control = 1
ranges = @(
@{
begin = @{ hour = 6; minute = 0; second = 0 }
end = @{ hour = 14; minute = 0; second = 0 }
},
@{
begin = @{ hour = 0; minute = 0; second = 0 }
end = @{ hour = 0; minute = 0; second = 0 }
}
)
}
Convert to compact JSON
$json = ($schWeek | ConvertTo-Json -Depth 6 -Compress)
URL‑encode the JSON for the GET-style API
$encoded = [System.Web.HttpUtility]::UrlEncode($json)
Build final URL
$url = "http://$chargerIP/api/set?sch_week=$encoded"
Send it
Invoke-RestMethod -Uri $url -Method GET
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels