Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Timer erstellen und bei Bedarf wieder löschen

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Timer erstellen und bei Bedarf wieder löschen

    This topic has been deleted. Only users with topic management privileges can see it.
    • mickym
      mickym Most Active @MichMein last edited by mickym

      @michmein sagte in Timer erstellen und bei Bedarf wieder löschen:

      @mickym
      Erstmal vielen Dank für deine Mühen!
      Ich habe an dem ganzen nun schon ein paar Stunden verbracht gehabt und es war immer so das ich den ezTimer nicht zurücksetzen konnte, wenn er einmal gestellt war blieb er so und sein Event zur eingegeben Zeit ausgegeben. Dann habe ich eine "uraltes" Script von bluefox im Forum gefunden (das sind deine "???" aus deiner ersten Antwort) und habe das getestet. Aber auch dies führte nicht zu meinem Ergebnis.
      Schlußendlich habe ich das Logik-Node installiert und damit klappt nun mein gewünschtes Szenario.

      und schon wieder jemand, der eine Logik-Node installiert.

      Was genau soll das bedeuten? Spricht etwas gegen die Logik-Nodes oder magst du sie einfach nicht?

      Ja ich mag sie nicht. 😉 - Ich bin generell gegen Nodes oder Adapter, die nichts weiter machen, als bereits vorhandene Informationen aufzubereiten, die man aber mit wenigen Handgriffen auch aus dem Standardbaukasten zusammensetzen kann. Wenn man dann mal solche Bausteine hat, dann speichere ich mir die als Flows oder einzelne Nodes in meiner lokalen Biblothek von NodeRed ab und habe sie dann schnell zur Verfügung.

      In diesem Post - ist vielleicht nicht für Deinen speziellen Fall relevant, habe ich mal alle Möglichen Verknüfungen mit ChangeNodes und JSONATA zusammgefasst um logisch Eigenschaften eines Javascripts zu überprüfen:

      https://forum.iobroker.net/topic/49835/vergleich-von-zwei-eingangswerten-um-wert-festzulegen/11?_=1641062799345

      ... Da ist cronplus wesentlich leistungsfähiger, aber egal ...

      Den habe ich auch installiert, konnte aber nichts wirklich finden wie dieser "extern" mit einer Zeit bestückt werden kann.

      Na dann muss man auch mal die Hilfe lesen zu der Node - ich schau mal ob es in der BEschreibung auch drin steht. Nee steht nur in der Hilfe zu dieser Node.

      5e6923d4-75c8-4456-8bf5-9b5e61a2af8b-image.png
      Also neben der Superflexibilität des crontab systems,

      Wenn Du mal unter Date sequenz nachschaust, dann kannst Du in die crontab nicht nur cron Ausdrücke, sondern sogar ein Liste oder ein Array von Datums, angeben:

      96c47329-790d-4591-9020-ab4d2fc59bbd-image.png

      eb7ce9f0-9fb2-42da-b67a-0e23c90c3698-image.png

      Ich nutze zum Beispiel die Datesequenz um über Nachrichten den Fernsehkanal zu einer bestimmten Zeit zu wechseln, wenn ich eine Sendung sehen möchte. 😉

      Außerdem siehst Du bei der crontab auch genauso wie beim eztimer was als nächsten passiert im Status.

      Im Übrigen gibt die Hilfe Dir sogar 2 Beispiele wie Du die Node extern bestücken kannst:

      cedd78d1-26a6-4c7b-80fa-a6e00a461d55-image.png

      Zwar nicht das Date, aber solar oder cron events kannst Du auch über die payload einspeisen und müssen nicht in der Node gespeichert werden.

      Du kannst sogar in der Node über die

      30bec029-3ee9-457b-9b96-c8a47fff93a0-image.png

      view dynamic schedules anschauen, welcher Ereignisse Du über die payload dynamisch konfiguriert hast.

      c20a90e4-a70e-4150-847a-96fc4b28c2a3-image.png

      Hier auch ein paar Beispiele, die ich mir selbst gemacht habe:

      [
         {
             "id": "13a691f8.fe6dee",
             "type": "cronplus",
             "z": "c13d5a4f.b76118",
             "name": "",
             "outputField": "payload",
             "timeZone": "",
             "persistDynamic": false,
             "commandResponseMsgOutput": "output1",
             "outputs": 1,
             "options": [
                 {
                     "name": "skyQ",
                     "topic": "change_switchSkyChannel",
                     "payloadType": "default",
                     "payload": "",
                     "expressionType": "dates",
                     "expression": "2021-11-23 00:00",
                     "location": "",
                     "offset": "0",
                     "solarType": "all",
                     "solarEvents": "sunrise,sunset"
                 }
             ],
             "x": 740,
             "y": 1360,
             "wires": [
                 [
                     "9b031d34.b54d3"
                 ]
             ]
         },
         {
             "id": "128da478.7d94ec",
             "type": "inject",
             "z": "c13d5a4f.b76118",
             "name": "Add every 6",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "[{\"command\":\"add\",\"name\":\"every 6\",\"expression\":\"*/12 * * * * * *\",\"expressionType\":\"cron\",\"payloadType\":\"default\",\"limit\":3}]",
             "payloadType": "json",
             "x": 490,
             "y": 1440,
             "wires": [
                 []
             ]
         },
         {
             "id": "9b031d34.b54d3",
             "type": "debug",
             "z": "c13d5a4f.b76118",
             "name": "",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "true",
             "targetType": "full",
             "statusVal": "",
             "statusType": "auto",
             "x": 950,
             "y": 1360,
             "wires": []
         },
         {
             "id": "b7211fb2.1c702",
             "type": "inject",
             "z": "c13d5a4f.b76118",
             "name": "Remove every 6",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "[{\"command\":\"remove\",\"name\":\"every 6\"}]",
             "payloadType": "json",
             "x": 480,
             "y": 1400,
             "wires": [
                 []
             ]
         },
         {
             "id": "61d860e7.95cfd",
             "type": "inject",
             "z": "c13d5a4f.b76118",
             "name": "",
             "props": [
                 {
                     "p": "topic",
                     "vt": "str"
                 },
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "status",
             "payload": "skyQ",
             "payloadType": "str",
             "x": 490,
             "y": 1280,
             "wires": [
                 [
                     "13a691f8.fe6dee"
                 ]
             ]
         },
         {
             "id": "1e753131.99647f",
             "type": "inject",
             "z": "c13d5a4f.b76118",
             "name": "Update existing scheduler",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "{\"command\":\"update\",\"name\":\"skyQ\",\"expression\":\"2022-11-05 23:45\",\"expressionType\":\"dates\"}",
             "payloadType": "json",
             "x": 450,
             "y": 1320,
             "wires": [
                 [
                     "13a691f8.fe6dee"
                 ]
             ]
         },
         {
             "id": "9e31a89f.f964e8",
             "type": "comment",
             "z": "c13d5a4f.b76118",
             "name": "Ergänzende Hilfe cronplus",
             "info": "### Expressiontypes\n - \"expressionType\": \"cron\"\n - \"expressionType\": \"dates\"\n - \"expressionType\": \"solar\"\n\n\n### Update Kommandos in payload.command \n\n\n - \"add\": //single \n - \"clear\": //single\n - \"debug\": //single\n - \"debug-\": //multiple\n - \"delete\": //single\n - \"describe\": //single\n - \"export\": //single\n - \"export-\": //multiple\n - \"list-\": //multiple\n - \"pause\": //single\n - \"pause-\": //multiple\n - \"remove\": //single\n - \"remove-\": //multiple\n - \"start\": //single\n - \"start-\": //multiple\n - \"status\": //single\n - \"status-\": //multiple\n - \"stop\": //single\n - \"stop-\": //multiple\n - \"trigger\": //single\n - \"trigger-\": //multiple\n - \"update\": //single",
             "x": 740,
             "y": 1240,
             "wires": []
         },
         {
             "id": "d8c5df46.1349a",
             "type": "inject",
             "z": "c13d5a4f.b76118",
             "name": "Stop existing scheduler",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "{\"command\":\"stop\",\"name\":\"skyQ\"}",
             "payloadType": "json",
             "x": 460,
             "y": 1360,
             "wires": [
                 [
                     "13a691f8.fe6dee"
                 ]
             ]
         }
      ]
      

      8294cf44-7ac7-4cb4-86ad-ef71211e0792-image.png

      In der Kommentar-Node findest Du noch ein paar zusätzliche Kommandos, die ich mir aus dem Quellcode der Node gezogen habe.

      c64f9eb8-d515-45c7-91db-71f7040ef3dc-image.png

      Für mich ist das die genialste Timer Node ever . 🙂 - Da kommt kein Bigtimer mit und der EZ-Timer schon gleich 2 mal nicht. 😉

      Im Übrigen kannst Du beliebig viele Scheduler erstellen in einer Node, externe und interne Scheduler mischen und auch die Payload festlegen, die verschickt werden soll. Also flexibler geht eigentlich kaum noch.

      MichMein F 2 Replies Last reply Reply Quote 0
      • MichMein
        MichMein @mickym last edited by

        Hi @mickym,
        vielen Dank für deine sehr Ausführlichen Erklärungen und Beispiele.

        Ich habe mir dein Beispiel mal importiert und werde es mir anschauen und versuchen zu verstehen.
        Das alles sind meine ersten Gehversuche und es fühlt sich vorerst gut an Erfolge sehen zu können. Node-red bietet scheinbar sehr viele Möglichkeiten die ich zur Zeit offensichtlich noch nicht benötige und auch nicht annähernd überblicken kann. Mal schauen was die Zukunft da so bringen wird.

        1 Reply Last reply Reply Quote 0
        • F
          frankyboy73 @mickym last edited by

          @mickym Hi, die Crontab Plus habe ich mir jetzt auch mal angeschaut. Vor allem die Möglichkeit per Input Zeiten zu setzen hört sich gut an.
          Leider hänge ich gerade bei meiner Umsetzung, ne Wecker Zeit aus dem Alexa 2 Adapter auszulesen und da rein zu bekommen.
          Mein Ziel ist, per Alexa einen Wecker zu stellen, dann die Zeit auszulesen und dann ne bestimmte Zeit (z.B. 30 Minuten) vorher die Heizung im Bad hoch zu fahren.
          Ich habe 3 Datenpunkte zur Verfügung, einer ob der Alarm eingeschlatet ist, dann die Uhrzeit des Alarms und ob er ausgelöst ist.
          Crontab2.jpg
          Wenn ein Alarm hinzugefügt wird bzw. true wird, will ich die Zeit abfragen und die dann minus 30 Minuten an den Timer weitergeben. Den True Wert und die Zeitabfrage kriege ich hin, nur weiß ich nicht wie ich die Zeit in den Timer kriege. Wenn ich mit deinem Beispiel die Zeit sende gibts ne Fehlermeldung, wahrscheinlich weil das Datum fehlt?
          Crontab1.jpg

          [
             {
                 "id": "66c6962f.fc95d8",
                 "type": "switch",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "property": "payload",
                 "propertyType": "msg",
                 "rules": [
                     {
                         "t": "true"
                     }
                 ],
                 "checkall": "true",
                 "repair": false,
                 "outputs": 1,
                 "x": 550,
                 "y": 1900,
                 "wires": [
                     [
                         "35e830a.a1846d"
                     ]
                 ]
             },
             {
                 "id": "d28133e1.78a2",
                 "type": "ioBroker in",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "topic": "alexa2.0.Echo-Devices.G2A0U204933506NS.Alarm.*.enabled",
                 "payloadType": "value",
                 "onlyack": "",
                 "func": "rbe",
                 "gap": "",
                 "fireOnStart": "false",
                 "x": 260,
                 "y": 1900,
                 "wires": [
                     [
                         "66c6962f.fc95d8"
                     ]
                 ]
             },
             {
                 "id": "bbd3a395.bd8d3",
                 "type": "debug",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "false",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 770,
                 "y": 2100,
                 "wires": []
             },
             {
                 "id": "c6b7a22d.81e99",
                 "type": "ioBroker get",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "topic": "",
                 "attrname": "payload",
                 "payloadType": "value",
                 "x": 240,
                 "y": 1980,
                 "wires": [
                     [
                         "f66bea1c.732678"
                     ]
                 ]
             },
             {
                 "id": "35e830a.a1846d",
                 "type": "change",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "rules": [
                     {
                         "t": "change",
                         "p": "topic",
                         "pt": "msg",
                         "from": "enabled",
                         "fromt": "str",
                         "to": "time",
                         "tot": "str"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 710,
                 "y": 1900,
                 "wires": [
                     [
                         "c6b7a22d.81e99"
                     ]
                 ]
             },
             {
                 "id": "87d4ef3f.8dfa2",
                 "type": "cronplus",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "outputField": "payload",
                 "timeZone": "",
                 "persistDynamic": false,
                 "commandResponseMsgOutput": "output1",
                 "outputs": 1,
                 "options": [
                     {
                         "name": "Boost",
                         "topic": "Boost",
                         "payloadType": "default",
                         "payload": "",
                         "expressionType": "dates",
                         "expression": "2021-11-23 00:00",
                         "location": "",
                         "offset": "0",
                         "solarType": "all",
                         "solarEvents": "sunrise,sunset"
                     }
                 ],
                 "x": 700,
                 "y": 1980,
                 "wires": [
                     []
                 ]
             },
             {
                 "id": "f66bea1c.732678",
                 "type": "change",
                 "z": "42e1e0df.44b9f",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "payload",
                         "pt": "msg",
                         "to": "{\t    \"command\": \"update\",\t    \"name\": \"Boost\",\t    \"expression\": payload,\t    \"expressionType\": \"dates\"\t}",
                         "tot": "jsonata"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 490,
                 "y": 1980,
                 "wires": [
                     [
                         "87d4ef3f.8dfa2",
                         "bbd3a395.bd8d3"
                     ]
                 ]
             }
          ]
          

          MichMein mickym 2 Replies Last reply Reply Quote 0
          • MichMein
            MichMein @frankyboy73 last edited by

            Hi @frankyboy73,
            ich kann dir bei deiner Fragestellung vielleicht helfen, allerdings nicht in Verbindung mit dem "cron-plus" sondern nur mit Hilfe des "eztimer".

            3cc8fbb8-f6d7-4f37-9599-0905cd6bd3dd-grafik.png

            [
               {
                   "id": "76c099af.f7c52",
                   "type": "tab",
                   "label": "Ausschalttimer TV Lilly",
                   "disabled": false,
                   "info": ""
               },
               {
                   "id": "b3cbeec.9653d1",
                   "type": "eztimer",
                   "z": "76c099af.f7c52",
                   "name": "ezTimer",
                   "debug": false,
                   "autoname": "17:00",
                   "tag": "eztimer",
                   "topic": "",
                   "suspended": false,
                   "sendEventsOnSuspend": false,
                   "latLongSource": "manual",
                   "latLongHaZone": "zone.home",
                   "lat": "",
                   "lon": "",
                   "timerType": "2",
                   "startupMessage": false,
                   "ontype": "2",
                   "ontimesun": "dawn",
                   "ontimetod": "17:00",
                   "onpropertytype": "msg",
                   "onproperty": "payload",
                   "onvaluetype": "bool",
                   "onvalue": "true",
                   "onoffset": 0,
                   "onrandomoffset": 0,
                   "onsuppressrepeats": false,
                   "offtype": "9",
                   "offtimesun": "dusk",
                   "offtimetod": "dusk",
                   "offduration": "00:01:00",
                   "offpropertytype": "msg",
                   "offproperty": "payload",
                   "offvaluetype": "num",
                   "offvalue": 0,
                   "offoffset": 0,
                   "offrandomoffset": 0,
                   "offsuppressrepeats": false,
                   "resend": false,
                   "resendInterval": "0s",
                   "mon": true,
                   "tue": true,
                   "wed": true,
                   "thu": true,
                   "fri": true,
                   "sat": true,
                   "sun": true,
                   "x": 500,
                   "y": 300,
                   "wires": [
                       [
                           "488b354d.6eb57c",
                           "794819e5.e5cdf8"
                       ]
                   ]
               },
               {
                   "id": "9e2ab0ca.693f78",
                   "type": "ioBroker get",
                   "z": "76c099af.f7c52",
                   "name": "Ausschaltzeit Lilly",
                   "topic": "0_userdata.0.Diverses.virtuelle_Schalter.Ausschaltzeit_Lilly",
                   "attrname": "payload",
                   "payloadType": "value",
                   "x": 310,
                   "y": 240,
                   "wires": [
                       [
                           "ba93ec83.f49e98"
                       ]
                   ]
               },
               {
                   "id": "ba93ec83.f49e98",
                   "type": "change",
                   "z": "76c099af.f7c52",
                   "name": "ontime generieren",
                   "rules": [
                       {
                           "t": "move",
                           "p": "payload",
                           "pt": "msg",
                           "to": "payload.ontime",
                           "tot": "msg"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 310,
                   "y": 300,
                   "wires": [
                       [
                           "b3cbeec.9653d1"
                       ]
                   ]
               },
               {
                   "id": "d88f8ced.6c6dc8",
                   "type": "ioBroker in",
                   "z": "76c099af.f7c52",
                   "name": "Timer on/off",
                   "topic": "0_userdata.0.Diverses.virtuelle_Schalter.Ausschalttimer_Lilly",
                   "payloadType": "value",
                   "onlyack": "",
                   "func": "all",
                   "gap": "",
                   "fireOnStart": "false",
                   "x": 170,
                   "y": 180,
                   "wires": [
                       [
                           "586cbd7d.346c44",
                           "488b354d.6eb57c"
                       ]
                   ]
               },
               {
                   "id": "dd1f8133.ac2198",
                   "type": "ioBroker out",
                   "z": "76c099af.f7c52",
                   "name": "Timer on/off",
                   "topic": "0_userdata.0.Diverses.virtuelle_Schalter.Ausschalttimer_Lilly",
                   "ack": "false",
                   "autoCreate": "false",
                   "stateName": "",
                   "role": "",
                   "payloadType": "",
                   "readonly": "",
                   "stateUnit": "",
                   "stateMin": "",
                   "stateMax": "",
                   "x": 550,
                   "y": 180,
                   "wires": []
               },
               {
                   "id": "586cbd7d.346c44",
                   "type": "switch",
                   "z": "76c099af.f7c52",
                   "name": "only true",
                   "property": "payload",
                   "propertyType": "msg",
                   "rules": [
                       {
                           "t": "true"
                       }
                   ],
                   "checkall": "true",
                   "repair": false,
                   "outputs": 1,
                   "x": 340,
                   "y": 180,
                   "wires": [
                       [
                           "9e2ab0ca.693f78"
                       ]
                   ]
               },
               {
                   "id": "4d2e5d98.8e7514",
                   "type": "ioBroker out",
                   "z": "76c099af.f7c52",
                   "name": "SD Lilly TV",
                   "topic": "sonoff.0.Steckdose TV Lilly.POWER",
                   "ack": "false",
                   "autoCreate": "false",
                   "stateName": "",
                   "role": "",
                   "payloadType": "",
                   "readonly": "",
                   "stateUnit": "",
                   "stateMin": "",
                   "stateMax": "",
                   "x": 730,
                   "y": 420,
                   "wires": []
               },
               {
                   "id": "31cdef55.b0a18",
                   "type": "debug",
                   "z": "76c099af.f7c52",
                   "name": "nach UND Verknüpfung",
                   "active": false,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 590,
                   "y": 380,
                   "wires": []
               },
               {
                   "id": "488b354d.6eb57c",
                   "type": "BooleanLogicUltimate",
                   "z": "76c099af.f7c52",
                   "name": "AND",
                   "filtertrue": "onlytrue",
                   "persist": true,
                   "sInitializeWith": "WaitForPayload",
                   "triggertopic": "trigger",
                   "outputtriggeredby": "all",
                   "inputCount": 2,
                   "topic": "result",
                   "restrictinputevaluation": true,
                   "x": 340,
                   "y": 440,
                   "wires": [
                       [
                           "31cdef55.b0a18",
                           "7ca43ca5.c344b4"
                       ],
                       [],
                       []
                   ]
               },
               {
                   "id": "794819e5.e5cdf8",
                   "type": "change",
                   "z": "76c099af.f7c52",
                   "name": "true > false",
                   "rules": [
                       {
                           "t": "change",
                           "p": "payload",
                           "pt": "msg",
                           "from": "true",
                           "fromt": "bool",
                           "to": "false",
                           "tot": "bool"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 330,
                   "y": 360,
                   "wires": [
                       [
                           "dd1f8133.ac2198",
                           "488b354d.6eb57c"
                       ]
                   ]
               },
               {
                   "id": "7ca43ca5.c344b4",
                   "type": "change",
                   "z": "76c099af.f7c52",
                   "name": "true > false",
                   "rules": [
                       {
                           "t": "change",
                           "p": "payload",
                           "pt": "msg",
                           "from": "true",
                           "fromt": "bool",
                           "to": "false",
                           "tot": "bool"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 550,
                   "y": 420,
                   "wires": [
                       [
                           "4d2e5d98.8e7514"
                       ]
                   ]
               }
            ]
            

            F 1 Reply Last reply Reply Quote 0
            • F
              frankyboy73 @MichMein last edited by

              @michmein sagte in Timer erstellen und bei Bedarf wieder löschen:

              Hi, vielen Dank. Wie sieht denn deine Ausgabe von der Get Node "Ausschaltzeit Lilly" aus, bzw. was für ein Format hat die Zeit?
              EZtimer.jpg
              Bei mir sieht das so aus.
              Crontab3.jpg
              Bevor ich mir noch nen zusätzlichen Timer installiere will ich lieber sichergehen ob das auch passt.

              MichMein 1 Reply Last reply Reply Quote 0
              • MichMein
                MichMein @frankyboy73 last edited by MichMein

                @frankyboy73

                So sieht es bei mir aus

                b03ad26a-61e8-4089-8e13-fa4e5782d832-grafik.png

                und hier die Raw Daten des Zeit-DP

                {
                  "common": {
                    "name": "Ausschaltzeit Lilly",
                    "desc": "Manuell erzeugt",
                    "role": "state",
                    "type": "string",
                    "read": true,
                    "write": true,
                    "def": ""
                  },
                  "type": "state",
                  "from": "system.adapter.admin.0",
                  "user": "system.user.admin",
                  "ts": 1640897648132,
                  "_id": "0_userdata.0.Diverses.virtuelle_Schalter.Ausschaltzeit_Lilly",
                  "acl": {
                    "object": 1636,
                    "state": 1636,
                    "owner": "system.user.admin",
                    "ownerGroup": "system.group.administrator"
                  }
                }
                

                EDIT: mit z.B. 19:00:00 wie in deinem DP funktioert es auch

                1 Reply Last reply Reply Quote 0
                • mickym
                  mickym Most Active @frankyboy73 last edited by mickym

                  @frankyboy73 Ja - wenn kein festes Dateobjekt vorhanden ist, sprich das Datum fehlt - würde ich auch eher mit der cron expression arbeiten, das ist eigenlich ganz easy.

                  Ich habe mal Deine 17:00:00 einfach in eine Inject Node verpackt. Du kannst den Scheduler entweder komplett dynamisch verwalten oder aber wie Du teilweise in der Node definieren und dann von aussen manipulieren.

                  Wenn Du mit Cron arbeitest - musst Du halt den Scheduler nach jeder Ausführung manuell stoppen, sonst gibt es den Alarm halt täglich.

                  63133cf3-0790-4fbc-aa18-c53ca0515b0a-image.png

                  [
                     {
                         "id": "87d4ef3f.8dfa2",
                         "type": "cronplus",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "outputField": "payload",
                         "timeZone": "",
                         "persistDynamic": false,
                         "commandResponseMsgOutput": "output1",
                         "outputs": 1,
                         "options": [
                             {
                                 "name": "Boost",
                                 "topic": "Boost",
                                 "payloadType": "default",
                                 "payload": "",
                                 "expressionType": "cron",
                                 "expression": "0 * * * * * *",
                                 "location": "",
                                 "offset": "0",
                                 "solarType": "all",
                                 "solarEvents": "sunrise,sunset"
                             }
                         ],
                         "x": 640,
                         "y": 2440,
                         "wires": [
                             [
                                 "a9b37688.caa278",
                                 "bb7de91a.b10928"
                             ]
                         ]
                     },
                     {
                         "id": "3342ccea.cb9354",
                         "type": "inject",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "props": [
                             {
                                 "p": "payload"
                             }
                         ],
                         "repeat": "",
                         "crontab": "",
                         "once": false,
                         "onceDelay": 0.1,
                         "topic": "",
                         "payload": "17:00:00",
                         "payloadType": "str",
                         "x": 220,
                         "y": 2440,
                         "wires": [
                             [
                                 "68d561c1.7a512"
                             ]
                         ]
                     },
                     {
                         "id": "68d561c1.7a512",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "cron Expression",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "$split(payload, ':')\t",
                                 "tot": "jsonata"
                             },
                             {
                                 "t": "set",
                                 "p": "cron",
                                 "pt": "msg",
                                 "to": "$number(payload[2]) & ' ' & $number(payload[1]) & ' ' & $number(payload[0]) & ' ' & '* * *'\t",
                                 "tot": "jsonata"
                             },
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "{\t   \"command\": \"update\",\t   \"name\": \"Boost\",\t   \"expressionType\": \"cron\",\t   \"payloadType\": \"bool\",\t   \"payload\": true\t}",
                                 "tot": "jsonata"
                             },
                             {
                                 "t": "move",
                                 "p": "cron",
                                 "pt": "msg",
                                 "to": "payload.expression",
                                 "tot": "msg"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 400,
                         "y": 2440,
                         "wires": [
                             [
                                 "87d4ef3f.8dfa2"
                             ]
                         ]
                     },
                     {
                         "id": "a9b37688.caa278",
                         "type": "debug",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "active": true,
                         "tosidebar": true,
                         "console": false,
                         "tostatus": false,
                         "complete": "payload",
                         "targetType": "msg",
                         "statusVal": "",
                         "statusType": "auto",
                         "x": 870,
                         "y": 2440,
                         "wires": []
                     },
                     {
                         "id": "bb7de91a.b10928",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "Stop",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "{\"command\":\"stop\",\"name\":\"Boost\"}",
                                 "tot": "json"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 630,
                         "y": 2380,
                         "wires": [
                             [
                                 "87d4ef3f.8dfa2"
                             ]
                         ]
                     },
                     {
                         "id": "9d4b0c5b.9dd2d",
                         "type": "inject",
                         "z": "54b226bc.0793e8",
                         "name": "manual stop",
                         "props": [
                             {
                                 "p": "payload"
                             }
                         ],
                         "repeat": "",
                         "crontab": "",
                         "once": false,
                         "onceDelay": 0.1,
                         "topic": "",
                         "payload": "true",
                         "payloadType": "bool",
                         "x": 430,
                         "y": 2380,
                         "wires": [
                             [
                                 "bb7de91a.b10928"
                             ]
                         ]
                     }
                  ]
                  

                  Wenn Du lieber mit absoluten Datums arbeiten willst - dann machst Du halt Deinen Alarm zu einem vollständigen Date Objekt.

                  Habe Dir mal hier einen Flow gemacht - der dann auch noch Deine 30 Minuten vom Alarm abzieht.

                  4502a0a5-6d41-4be9-8123-8dcff24987cb-image.png

                  [
                     {
                         "id": "5bcd8e82.59724",
                         "type": "switch",
                         "z": "54b226bc.0793e8",
                         "name": "morgen?",
                         "property": "$moment(payload,'HH:mm:ss').isBefore($moment())",
                         "propertyType": "jsonata",
                         "rules": [
                             {
                                 "t": "true"
                             },
                             {
                                 "t": "false"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 2,
                         "x": 590,
                         "y": 2740,
                         "wires": [
                             [
                                 "5b8e5917.919648"
                             ],
                             [
                                 "c9217130.bc94b"
                             ]
                         ]
                     },
                     {
                         "id": "6efdae7e.c153f",
                         "type": "inject",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "props": [
                             {
                                 "p": "payload"
                             }
                         ],
                         "repeat": "",
                         "crontab": "",
                         "once": false,
                         "onceDelay": 0.1,
                         "topic": "",
                         "payload": "17:00:00",
                         "payloadType": "str",
                         "x": 440,
                         "y": 2740,
                         "wires": [
                             [
                                 "5bcd8e82.59724"
                             ]
                         ]
                     },
                     {
                         "id": "5b8e5917.919648",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "$moment(payload,'HH:mm:ss').add(1, 'd')",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 770,
                         "y": 2700,
                         "wires": [
                             [
                                 "eaf7d0a9.90235"
                             ]
                         ]
                     },
                     {
                         "id": "cb97a519.2a5b98",
                         "type": "cronplus",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "outputField": "payload",
                         "timeZone": "",
                         "persistDynamic": false,
                         "commandResponseMsgOutput": "output1",
                         "outputs": 1,
                         "options": [
                             {
                                 "name": "Boost",
                                 "topic": "Boost",
                                 "payloadType": "default",
                                 "payload": "",
                                 "expressionType": "dates",
                                 "expression": "2021-11-23 00:00",
                                 "location": "",
                                 "offset": "0",
                                 "solarType": "all",
                                 "solarEvents": "sunrise,sunset"
                             }
                         ],
                         "x": 1480,
                         "y": 2760,
                         "wires": [
                             []
                         ]
                     },
                     {
                         "id": "c7b6a7a.e0d8458",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "update cron plus",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "{\t    \"command\": \"update\",\t    \"name\": \"Boost\",\t    \"expression\": payload,\t    \"expressionType\": \"dates\"\t}",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 1250,
                         "y": 2760,
                         "wires": [
                             [
                                 "cb97a519.2a5b98"
                             ]
                         ]
                     },
                     {
                         "id": "c9217130.bc94b",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "$moment(payload,'HH:mm:ss')",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 770,
                         "y": 2760,
                         "wires": [
                             [
                                 "eaf7d0a9.90235"
                             ]
                         ]
                     },
                     {
                         "id": "eaf7d0a9.90235",
                         "type": "change",
                         "z": "54b226bc.0793e8",
                         "name": "Alarm - 30 Minuten",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "$moment(payload).subtract(30, 'minutes').format('YYYY-MM-DD HH:mm:ss')\t",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 1030,
                         "y": 2760,
                         "wires": [
                             [
                                 "c7b6a7a.e0d8458"
                             ]
                         ]
                     }
                  ]
                  

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    frankyboy73 @mickym last edited by

                    @mickym Hi, vielen Dank dafür. So habe ich mir das vorgestell. Ich mache das jetzt komplett dynamisch, also Timer hinzufügen und dann wieder löschen, je nach dem von welchem Echo der Wecker ist dann mit verschiedenen Namen. Und die Boost Zeit gebe ich als payload vor.
                    Das einzige was mir aufgefallen ist, da die 30 Minuten nach der Morgen Abfrage abgezogen werden, ist es theretisch möglich einen Timer in der Vergangenheit zu setzen. Aber das ist egal, 30 Minuten vorher ist es eh zu spät für den Boost. Ist auch eher dafür gedacht, das das Badezimmer morgens bei aufstehen schön warm ist.
                    Crontab4.jpg

                    [
                       {
                           "id": "66c6962f.fc95d8",
                           "type": "switch",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "property": "payload",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "true"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 1,
                           "x": 470,
                           "y": 1900,
                           "wires": [
                               [
                                   "35e830a.a1846d"
                               ]
                           ]
                       },
                       {
                           "id": "d28133e1.78a2",
                           "type": "ioBroker in",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "topic": "alexa2.0.Echo-Devices.*.Alarm.*.enabled",
                           "payloadType": "value",
                           "onlyack": "",
                           "func": "rbe",
                           "gap": "",
                           "fireOnStart": "false",
                           "x": 200,
                           "y": 1900,
                           "wires": [
                               [
                                   "66c6962f.fc95d8"
                               ]
                           ]
                       },
                       {
                           "id": "c6b7a22d.81e99",
                           "type": "ioBroker get",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "topic": "",
                           "attrname": "payload",
                           "payloadType": "value",
                           "x": 860,
                           "y": 1900,
                           "wires": [
                               [
                                   "7c8fb836.84fd28"
                               ]
                           ]
                       },
                       {
                           "id": "35e830a.a1846d",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "rules": [
                               {
                                   "t": "change",
                                   "p": "topic",
                                   "pt": "msg",
                                   "from": "enabled",
                                   "fromt": "str",
                                   "to": "time",
                                   "tot": "str"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 650,
                           "y": 1900,
                           "wires": [
                               [
                                   "c6b7a22d.81e99"
                               ]
                           ]
                       },
                       {
                           "id": "5454b574.29fd1c",
                           "type": "cronplus",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "outputField": "payload",
                           "timeZone": "",
                           "persistDynamic": false,
                           "commandResponseMsgOutput": "output1",
                           "outputs": 1,
                           "options": [],
                           "x": 1200,
                           "y": 2040,
                           "wires": [
                               [
                                   "bc278d69.f5884",
                                   "5f10eb32.1dbd64",
                                   "52dc4c8e.9f6144"
                               ]
                           ]
                       },
                       {
                           "id": "f39d6a7f.bdf478",
                           "type": "inject",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "props": [
                               {
                                   "p": "payload"
                               },
                               {
                                   "p": "topic",
                                   "vt": "str"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "1111",
                           "payload": "22:30:00",
                           "payloadType": "str",
                           "x": 130,
                           "y": 2180,
                           "wires": [
                               [
                                   "7c8fb836.84fd28"
                               ]
                           ]
                       },
                       {
                           "id": "bc278d69.f5884",
                           "type": "debug",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "active": true,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 1430,
                           "y": 2040,
                           "wires": []
                       },
                       {
                           "id": "dac0533b.30d27",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "Löschen2",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\"command\":\"delete\",\"name\":\"Boost1\"}",
                                   "tot": "json"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1260,
                           "y": 2120,
                           "wires": [
                               [
                                   "5454b574.29fd1c"
                               ]
                           ]
                       },
                       {
                           "id": "6538fc08.58e924",
                           "type": "inject",
                           "z": "42e1e0df.44b9f",
                           "name": "Löschen",
                           "props": [
                               {
                                   "p": "payload"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "",
                           "payload": "true",
                           "payloadType": "bool",
                           "x": 760,
                           "y": 2140,
                           "wires": [
                               [
                                   "dac0533b.30d27",
                                   "b6c35686.4145d8"
                               ]
                           ]
                       },
                       {
                           "id": "5f10eb32.1dbd64",
                           "type": "switch",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "property": "topic",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "eq",
                                   "v": "Boost1",
                                   "vt": "str"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 1,
                           "x": 1090,
                           "y": 2120,
                           "wires": [
                               [
                                   "dac0533b.30d27"
                               ]
                           ]
                       },
                       {
                           "id": "b6c35686.4145d8",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "Löschen2",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\"command\":\"delete\",\"name\":\"Boost2\"}",
                                   "tot": "json"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1260,
                           "y": 2180,
                           "wires": [
                               [
                                   "5454b574.29fd1c"
                               ]
                           ]
                       },
                       {
                           "id": "52dc4c8e.9f6144",
                           "type": "switch",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "property": "topic",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "eq",
                                   "v": "Boost2",
                                   "vt": "str"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 1,
                           "x": 1090,
                           "y": 2180,
                           "wires": [
                               [
                                   "b6c35686.4145d8"
                               ]
                           ]
                       },
                       {
                           "id": "2280e696.7ca70a",
                           "type": "switch",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "property": "topic",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "cont",
                                   "v": "1111",
                                   "vt": "str"
                               },
                               {
                                   "t": "cont",
                                   "v": "2222",
                                   "vt": "str"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 2,
                           "x": 790,
                           "y": 2040,
                           "wires": [
                               [
                                   "aa751299.8bf"
                               ],
                               [
                                   "b58af3f7.ef134"
                               ]
                           ]
                       },
                       {
                           "id": "c2183d56.03118",
                           "type": "inject",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "props": [
                               {
                                   "p": "payload"
                               },
                               {
                                   "p": "topic",
                                   "vt": "str"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "2222",
                           "payload": "22:25:00",
                           "payloadType": "str",
                           "x": 150,
                           "y": 2240,
                           "wires": [
                               [
                                   "7c8fb836.84fd28"
                               ]
                           ]
                       },
                       {
                           "id": "7c8fb836.84fd28",
                           "type": "switch",
                           "z": "42e1e0df.44b9f",
                           "name": "morgen?",
                           "property": "$moment(payload,'HH:mm:ss').isBefore($moment())",
                           "propertyType": "jsonata",
                           "rules": [
                               {
                                   "t": "true"
                               },
                               {
                                   "t": "false"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 2,
                           "x": 140,
                           "y": 2000,
                           "wires": [
                               [
                                   "5f0ddd35.6405d4"
                               ],
                               [
                                   "8cfc62f3.7cb33"
                               ]
                           ]
                       },
                       {
                           "id": "5f0ddd35.6405d4",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "$moment(payload,'HH:mm:ss').add(1, 'd')",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 320,
                           "y": 1960,
                           "wires": [
                               [
                                   "9bf3497b.586198"
                               ]
                           ]
                       },
                       {
                           "id": "aa751299.8bf",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "update cron plus",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\t    \"command\": \"add\",\t    \"name\": \"Boost1\",\t    \"expression\": payload,\t    \"expressionType\": \"dates\",\t    \"payloadType\": \"number\",\t    \"payload\": 30\t}",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 970,
                           "y": 2020,
                           "wires": [
                               [
                                   "5454b574.29fd1c"
                               ]
                           ]
                       },
                       {
                           "id": "8cfc62f3.7cb33",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "$moment(payload,'HH:mm:ss')",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 330,
                           "y": 2040,
                           "wires": [
                               [
                                   "9bf3497b.586198"
                               ]
                           ]
                       },
                       {
                           "id": "9bf3497b.586198",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "Alarm - 30 Minuten",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "$moment(payload).subtract(30, 'minutes').format('YYYY-MM-DD HH:mm:ss')\t",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 570,
                           "y": 2040,
                           "wires": [
                               [
                                   "2280e696.7ca70a"
                               ]
                           ]
                       },
                       {
                           "id": "b58af3f7.ef134",
                           "type": "change",
                           "z": "42e1e0df.44b9f",
                           "name": "update cron plus",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\t    \"command\": \"add\",\t    \"name\": \"Boost2\",\t    \"expression\": payload,\t    \"expressionType\": \"dates\",\t    \"payloadType\": \"number\",\t    \"payload\": 30\t}",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 970,
                           "y": 2060,
                           "wires": [
                               [
                                   "5454b574.29fd1c"
                               ]
                           ]
                       }
                    ]
                    

                    @MichMein vielen Dank für deinen Lösungsvorschlag und deine Debug Ausgabe. Ich versuche es aber erst mal mit dem Crontab

                    MichMein mickym 2 Replies Last reply Reply Quote 0
                    • MichMein
                      MichMein @frankyboy73 last edited by

                      @frankyboy73 sehr gerne.
                      Ich werde meinen Timer auch irgendwann auf cron-plus umstellen, aber zur Zeit bastel ich an anderen Baustellen und mit dem eztimer funktioniert es ja erstmal.

                      1 Reply Last reply Reply Quote 0
                      • mickym
                        mickym Most Active @frankyboy73 last edited by mickym

                        @frankyboy73 sagte in Timer erstellen und bei Bedarf wieder löschen:

                        Das einzige was mir aufgefallen ist, da die 30 Minuten nach der Morgen Abfrage abgezogen werden, ist es theretisch möglich einen Timer in der Vergangenheit zu setzen.

                        Erwischt - da hast Du natürlich Recht - aber ich trau Dir zu dass Du es auch selbst so umstellst, dass Du die letzte Node vor den Switch stellst- Du musst dann nur die Formatausgabe an die beiden $moments in den Changen Nodes nach dem morgen angeben. 😉 Ist ja eigentlich auch logischer.

                        5e3282ab-a154-45a3-a7a6-51f5c1d686ce-image.png

                        [
                           {
                               "id": "5bcd8e82.59724",
                               "type": "switch",
                               "z": "54b226bc.0793e8",
                               "name": "morgen?",
                               "property": "$moment(payload,'HH:mm:ss').isBefore($moment())",
                               "propertyType": "jsonata",
                               "rules": [
                                   {
                                       "t": "true"
                                   },
                                   {
                                       "t": "false"
                                   }
                               ],
                               "checkall": "true",
                               "repair": false,
                               "outputs": 2,
                               "x": 840,
                               "y": 2780,
                               "wires": [
                                   [
                                       "5b8e5917.919648"
                                   ],
                                   [
                                       "c9217130.bc94b"
                                   ]
                               ]
                           },
                           {
                               "id": "6efdae7e.c153f",
                               "type": "inject",
                               "z": "54b226bc.0793e8",
                               "name": "",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "23:40:00",
                               "payloadType": "str",
                               "x": 460,
                               "y": 2780,
                               "wires": [
                                   [
                                       "ca868119.52d0d"
                                   ]
                               ]
                           },
                           {
                               "id": "5b8e5917.919648",
                               "type": "change",
                               "z": "54b226bc.0793e8",
                               "name": "",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "payload",
                                       "pt": "msg",
                                       "to": "$moment(payload).add(1, 'd').format('YYYY-MM-DD HH:mm:ss')\t",
                                       "tot": "jsonata"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 1020,
                               "y": 2740,
                               "wires": [
                                   [
                                       "c7b6a7a.e0d8458"
                                   ]
                               ]
                           },
                           {
                               "id": "cb97a519.2a5b98",
                               "type": "cronplus",
                               "z": "54b226bc.0793e8",
                               "name": "",
                               "outputField": "payload",
                               "timeZone": "",
                               "persistDynamic": false,
                               "commandResponseMsgOutput": "output1",
                               "outputs": 1,
                               "options": [
                                   {
                                       "name": "Boost",
                                       "topic": "Boost",
                                       "payloadType": "default",
                                       "payload": "",
                                       "expressionType": "dates",
                                       "expression": "2021-11-23 00:00",
                                       "location": "",
                                       "offset": "0",
                                       "solarType": "all",
                                       "solarEvents": "sunrise,sunset"
                                   }
                               ],
                               "x": 1480,
                               "y": 2780,
                               "wires": [
                                   []
                               ]
                           },
                           {
                               "id": "c7b6a7a.e0d8458",
                               "type": "change",
                               "z": "54b226bc.0793e8",
                               "name": "update cron plus",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "payload",
                                       "pt": "msg",
                                       "to": "{\t    \"command\": \"update\",\t    \"name\": \"Boost\",\t    \"expression\": payload,\t    \"expressionType\": \"dates\"\t}",
                                       "tot": "jsonata"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 1250,
                               "y": 2780,
                               "wires": [
                                   [
                                       "cb97a519.2a5b98"
                                   ]
                               ]
                           },
                           {
                               "id": "c9217130.bc94b",
                               "type": "change",
                               "z": "54b226bc.0793e8",
                               "name": "",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "payload",
                                       "pt": "msg",
                                       "to": "$moment(payload).format('YYYY-MM-DD HH:mm:ss')\t",
                                       "tot": "jsonata"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 1010,
                               "y": 2820,
                               "wires": [
                                   [
                                       "c7b6a7a.e0d8458"
                                   ]
                               ]
                           },
                           {
                               "id": "ca868119.52d0d",
                               "type": "change",
                               "z": "54b226bc.0793e8",
                               "name": "Alarm - 30 Minuten",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "payload",
                                       "pt": "msg",
                                       "to": "$moment(payload,'HH:mm:ss').subtract(30, 'minutes')",
                                       "tot": "jsonata"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 650,
                               "y": 2780,
                               "wires": [
                                   [
                                       "5bcd8e82.59724"
                                   ]
                               ]
                           }
                        ]
                        

                        Ich habs mal korrigiert: 😉

                        0bab4510-3e14-4847-878e-2d5720ca1605-image.png

                        Freut mich immer sowas gemeinsam zu entwickeln.

                        F 1 Reply Last reply Reply Quote 0
                        • F
                          frankyboy73 @mickym last edited by

                          @mickym Ja, war da schon am rumprobieren, aber irgendwie habe ich das mit der Formatausgabe nicht auf dem Schirm gehabt. Jetzt wo ich deine Lösung sehe leuchtet es mir ein. Danke

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          1.0k
                          Online

                          31.7k
                          Users

                          79.7k
                          Topics

                          1.3m
                          Posts

                          3
                          16
                          1089
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo