Skip to content

Set sch_week via http api? #303

@DumSkidderik

Description

@DumSkidderik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions