HTTP.Request headers length too short

Hinweis zur Nutzung von Skripten (für Nutzer)

Die Verwendung von Skripten erfolgt ausdrücklich auf eigene Gefahr. Weder Shelly noch die jeweiligen Autoren oder Entwickler der Skripte übernehmen irgendeine Form der Haftung für mögliche Schäden, Fehlfunktionen, Datenverluste oder anderweitige Beeinträchtigungen, die durch die Nutzung dieser Skripte entstehen könnten. Bitte stellen Sie vor dem Einsatz sicher, dass Sie den Quellcode verstehen und sich der möglichen Auswirkungen bewusst sind. Die Skripte werden ohne Gewähr bereitgestellt und unterliegen keiner regelmäßigen Wartung oder offiziellen Unterstützung.


Hinweis für Entwickler

Wenn Sie eigene Skripte bereitstellen, achten Sie bitte darauf, eine klare Beschreibung, eventuelle Einschränkungen und Sicherheitsaspekte zu dokumentieren. Beachten Sie zudem, dass Nutzer Ihre Skripte grundsätzlich auf eigenes Risiko verwenden. Eine Haftung für Schäden ist ausgeschlossen, sofern diese nicht vorsätzlich oder grob fahrlässig verursacht wurden oder gesetzlich anderweitig geregelt ist.

  • Hi,

    I try to make an HTTP.Request on my Home Assistant server, but after some times, I found my problem:

    Invalid argument 'headers': length should be less than 128!

    Because the generate token is very long !

    token.length ==>> 191

    Do you see a solution for this ? because I think that other application can have very long token.

    Thankyou

  • Can I have the screenshot?

    this is my test script ( with fake token of course :-) )

    And this, the log of shelly:

  • same problem here - but i "only" want to flip the state of a Shelly 1 PM Plus relais from a Shelly i4...


    as describled here https://shelly-api-docs.shelly.cloud/gen2/General/Authentication i need to use a two step request - this is the source of the second call:

    [script] [/script]

    [script] let url = '{"method": "GET", ' +
    ' "url":"http://admin:asdfasdf@10.2.0.215/rpc/Switch.Set?id=0&on=false", ' +
    ' "headers": {"Authorization": "Digest username=\\"admin\\", realm=\\"shellyplus1pm-7c87asdf48f0\\", nonce=\\"635asdf1b\\", cnonce=\\"OGI2MzMwYzFlMjVmZjg0MjasdfYzZDYwY2ZmZTFmOTY=\\", nc=00000001, qop=auth, response=\\"6df8a5a2328b4aasdfffbedf0f537eecf7b47f876c85ecf1b9f0597e9eb5ac33\\", algorithm=SHA-256"}' +
    '}';
    print(url);
    Shelly.call( 'HTTP.Request',
    url,
    function callback(result, error_code, error_message, userdata)
    { //some further processing [/script]

    [script] }, [/script]

    [script] null); [/script]

    [script][/script]

    if i shorten the headers-parameter i can not fit everything needed in it. if i fit all needed information into the string it is longer than 128 chars.


    or do you know another way of controling in a script another shelly without HTTP? (without using MQTT to Homeassistant, ioBroker that calls then the other shelly)


    a older shelly (eg 1pm, led rgbw2) works fine with this code (basic auth):
    [script] [/script]

    [script]Shelly.call( 'HTTP.GET',
                    '{"url":"http://admin:asdfasdf@10.2.0.217/white/1?turn=off"}}',
                    function callback(result, error_code, error_message, userdata)
    {
    //some processing
    },
                  null); [/script]

    [script][/script]

  • this is my test script ( with fake token of course :-) )

    Code
    Invalid argument 'headers': length should be less than 128! 10:29:29.522

    Did you find a solution?

    I'm stuck at the same problem, need to get some parameters from HA since I want to controll a heater mixer with the shelly. And the logic should be intentionally implemented within the shelly to eliminate overheating of the floor if HA is not available

  • Dieses Thema enthält 6 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.