Beiträge von Liemberger

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,
    ich bekomme seit kurzem den Fehler "This schedule contains invalid call method or params" obwohl ich am Aufruf

    Schedule.create", { "id": 3, "enable": true, "timespec": "0 0 0 * * SUN-SAT", "calls": [{ "method": "Script.start", "params": { "id": 1}}]})

    nichts geändert habe.

    Bitte um Hilfe - Danke!
    Karl

    Hier mal mein Skript um Warmwasser zum günstigen Zeitpunkt mit aWattar zu erzeugen:

    let date = "noch keine Antwort"; //string

    let Abfrage = function(antwort){

    if (antwort.code === 200){

    let obj = JSON.parse(antwort.body);

    date = obj.datetime;

    asyncLogic();

    };

    };

    function PreisErmitteln() {

    //print (date.substr(0,10)+'T12:30:00');

    let time1330 = Date.parse(date.substr(0,10)+'T00:00:00');

    //time1330 = Date.parse('2023-11-01T00:00:00');

    print (date.substr(0,10), 'T00:00:00', ' ist gleich ', time1330);

    //print ('2023-10-31T00:00:00', ' ist gleich ', time1330);

    let turnOnTime = new Date();

    let minimum = 9999999;

    let url = "https://api.awattar.de/v1/marketdata?start=" + time1330;

    Shelly.call(

    "HTTP.GET",

    {url: url },

    function(result, error_code, error_message) {

    if (error_code != 0) {

    print('ERROR');

    } else {

    let resobj = JSON.parse(result.body);


    /*

    let array_werte = resobj["data"].sort;


    array_werte.sort((a,b) => {

    if(a.marktprice < b.marktprice){

    return -1;

    }

    else{

    return 1;

    }

    return 0;

    }));

    */


    for (let i = 0; i < 24 ; i++) {

    print (resobj.data[i]);

    if (minimum > resobj.data[i].marketprice) {

    minimum = resobj.data[i].marketprice;

    starttime = resobj.data[i].start_timestamp;

    endtime = resobj.data[i].end_timestamp;

    }

    }

    print ("marketprice:", minimum, "starttime:", starttime );

    let starthour = new Date(starttime);

    let startstunde = starthour.getHours();

    print (startstunde);

    let setswitch = "0 0 " + startstunde + " * * SUN-SAT" ;

    print (setswitch);

    print(Shelly.call("Schedule.Create", { "id": 0, "enable": true, "timespec": setswitch,

    "calls": [{ "method": "Switch.Set", "params": { id: 0, "on": true }}]}));

    let setswitch = "0 55 " + startstunde + " * * SUN-SAT" ;

    print(Shelly.call("Schedule.Create", { "id": 0, "enable": true, "timespec": setswitch,

    "calls": [{ "method": "Switch.Set", "params": { id: 0, "on": false }}]}));

    // Schedule for the script itself

    print("Starting the script at 0:00")

    print(Shelly.call("Schedule.create", { "id": 3, "enable": true, "timespec": "0 0 0 * * SUN-SAT", "calls": [{ "method": "Script.start", "params": { "id": 1}}]}));

    }

    });

    }

    // Script läuft täglich um 13:30

    print('Karl - Start');

    Shelly.call("HTTP.GET",{url:"https://worldtimeapi.org/api/timezone/Europe/Berlin"},Abfrage);

    function asyncLogic(){

    print("Zeit/Datum: "+ date);

    print(Shelly.call("Schedule.DeleteAll"));

    PreisErmitteln();

    }

    //Stop this script in one minute from now

    Timer.set(60 * 1000, false, function () { print("Stopping the script"); Shelly.call("Script.stop", { "id": 1 })});

    print('Karl - finish');