I4DC scripting problem - Input.GetConfig

VPN/Proxy erkannt

Es scheint, dass Sie einen VPN- oder Proxy-Dienst verwenden. Bitte beachten Sie, dass die Nutzung eines solchen Dienstes die Funktionalität dieser Webseite einschränken kann.

  • Hi,

    I'm scripting on a I4DC shelly.

    Script:

        print(JSON.stringify(Shelly.call("Input.GetConfig", {id: 3})));

    Returns: nothing!

    I was expecting something like:

        {"id":3, "name":"It worked", "type":"switch","invert":false,"factory_reset":true}

    If I try:

    print(Shelly.call("Input.GetConfig", {id: 3}));

    Returns:

        <foreign_ptr@40169664>

    Am I doing something wrong?

    Any help appreciated.

  • you're doing it wrong, Shelly.call is aynchronous. print doesn' reply anything because the answer from Shelly.Call is still in progress, thus nothing to print.


    This should work as expected because the print is inside the response function.

    Code
    Shelly.call(
        'Input.GetConfig', { id: 3 },
        function (response, error_code, error_message, ud) {
            print(JSON.stringify(response));
        },
        null
    );

    >100 Shellies, darunter so gut wie alles was der Hersteller produziert hat. ;)
    :!: ich beantworte grundsätzlich keine Fragen per persönlicher Nachricht:!: