How do I find the date and time in the script

  • Have a nice day,

    please, how can I find out the current time with the help of the 4PM PRO shell script.

    this doesn't work:

    let currentTime = Date.now();

    print("Current time: " + currentTime);

    not this either:

    let now = new Date();

    print(now);

    can you advise... thanks

    Best regards

    Pavel Prochazka.zde.cz

  • I already figured it out, I took the help of artificial intelligence, although it didn't tell me the exact code, it kept spinning in circles, but it managed to tell me where to go. I ended up compiling this code:

    Shelly.call("Sys.GetStatus",{},

    function(result, err_code, err_message, user_data) {

    if (err_code === 0) {

    // processing successful result

    console.log("Result:", result.time);

    } else {

    // error handling

    console.log("Error:", err_message);

    }

    },

    null);

    Which, after running, writes the current time in the device to the console. And as you can see, with the help of this construction, you can find out any value that is given on the link, see the contribution above....

    Hopefully this will help someone else in writing a script for SHELLY 4PM PRO.