Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Hilfe bei script

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.3k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.0k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.4k

Hilfe bei script

Scheduled Pinned Locked Moved Skripten / Logik
javascript
9 Posts 3 Posters 424 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fischi87F Offline
    fischi87F Offline
    fischi87
    wrote on last edited by
    #1

    Hallo Gemeinde, ich habe versucht eine Steuerung zu bauen aber irgendwie funktioniert dieses nicht, könnt ihr mir da bitte helfen?

    Ich möchte das meine poolpumpe jeden tag einmal um 6:00-8:00, 14:00-16:00 und 24:00-02:00 Uhr auf true gesetzt ist. ich habe einmal versucht dies zu realisieren doch leider wird die pumpe nicht geschaltet.

    hier mal mein code:

    function poolpumpe () {
    
        if(compareTime('6:00', '8:00', 'between') || compareTime('14:00', '16:00', 'between') || compareTime('23:59', '02:00', 'between')) { 
            setState('sonoff.0.Poolpumpe.POWER', true);
        } else setState('sonoff.0.Poolpumpe.POWER', false);
    };
    
    schedule('0 6 * * *', poolpumpe);
    schedule('0 8 * * *', poolpumpe);
    schedule('0 14 * * *', poolpumpe);
    schedule('0 16 * * *', poolpumpe);
    schedule('59 23 * * *', poolpumpe);
    schedule('0 2 * * *', poolpumpe);
    

    danke grüße Axel

    bahnuhrB liv-in-skyL 2 Replies Last reply
    0
    • fischi87F fischi87

      Hallo Gemeinde, ich habe versucht eine Steuerung zu bauen aber irgendwie funktioniert dieses nicht, könnt ihr mir da bitte helfen?

      Ich möchte das meine poolpumpe jeden tag einmal um 6:00-8:00, 14:00-16:00 und 24:00-02:00 Uhr auf true gesetzt ist. ich habe einmal versucht dies zu realisieren doch leider wird die pumpe nicht geschaltet.

      hier mal mein code:

      function poolpumpe () {
      
          if(compareTime('6:00', '8:00', 'between') || compareTime('14:00', '16:00', 'between') || compareTime('23:59', '02:00', 'between')) { 
              setState('sonoff.0.Poolpumpe.POWER', true);
          } else setState('sonoff.0.Poolpumpe.POWER', false);
      };
      
      schedule('0 6 * * *', poolpumpe);
      schedule('0 8 * * *', poolpumpe);
      schedule('0 14 * * *', poolpumpe);
      schedule('0 16 * * *', poolpumpe);
      schedule('59 23 * * *', poolpumpe);
      schedule('0 2 * * *', poolpumpe);
      

      danke grüße Axel

      bahnuhrB Online
      bahnuhrB Online
      bahnuhr
      Forum Testing Most Active
      wrote on last edited by
      #2

      @fischi87 sagte in Hilfe bei script:

      tag einmal um 6:00-8:00

      was heißt das:

      um 06:00 ?
      um 07:00 ?
      um 08:00 ?

      schreibe mal genau:
      wann auf true ?
      wann auf false ?


      Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
      Danke.
      gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
      ScreenToGif :https://www.screentogif.com/downloads.html

      fischi87F 2 Replies Last reply
      0
      • bahnuhrB Online
        bahnuhrB Online
        bahnuhr
        Forum Testing Most Active
        wrote on last edited by bahnuhr
        #3

        @fischi87 sagte in Hilfe bei script:

        setState('sonoff.0.Poolpumpe.POWER', false)

        Jetzt hab ich dich verstanden.
        um 06:00 auf true
        und um 08:00 auf false

        dann so:

        schedule('0 0,6,14 * * *', function () {    // um 6, 14, 0 Uhr auf true
            setState('sonoff.0.Poolpumpe.POWER', true);
        });
        
        schedule('0 2,8,16 * * *', function () {    // um 2, 8, 16 Uhr auf true
            setState('sonoff.0.Poolpumpe.POWER', false);
        });
        

        Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
        Danke.
        gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
        ScreenToGif :https://www.screentogif.com/downloads.html

        1 Reply Last reply
        0
        • bahnuhrB Online
          bahnuhrB Online
          bahnuhr
          Forum Testing Most Active
          wrote on last edited by
          #4

          @fischi87 sagte in Hilfe bei script:

          schedule('0 16 * * *', poolpumpe);

          Hier lag dein Fehler!

          Um 16:00 hast du wieder auf true geschaltet.

          d.h. false ist nie eingetreten.

          richtig wäre gewesen:

          schedule('1 16 * * *', poolpumpe);
          

          16:01 wäre dann außerhalb gewesen.


          Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
          Danke.
          gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
          ScreenToGif :https://www.screentogif.com/downloads.html

          1 Reply Last reply
          0
          • bahnuhrB bahnuhr

            @fischi87 sagte in Hilfe bei script:

            tag einmal um 6:00-8:00

            was heißt das:

            um 06:00 ?
            um 07:00 ?
            um 08:00 ?

            schreibe mal genau:
            wann auf true ?
            wann auf false ?

            fischi87F Offline
            fischi87F Offline
            fischi87
            wrote on last edited by fischi87
            #5

            @bahnuhr sagte in Hilfe bei script:

            @fischi87 sagte in Hilfe bei script:

            tag einmal um 6:00-8:00

            was heißt das:

            um 06:00 ?
            um 07:00 ?
            um 08:00 ?

            schreibe mal genau:
            wann auf true ?
            wann auf false ?

            ich möchte das die pumpe 6:00 Uhr true ist bis 8:00 dann false. dann einmal 14:00 Uhr bis 16:00 Uhr und dann einmal von 24 Uhr bis 2 Uhr. besser? sorry für die ungenaue angeben.

            1 Reply Last reply
            0
            • bahnuhrB Online
              bahnuhrB Online
              bahnuhr
              Forum Testing Most Active
              wrote on last edited by
              #6

              Lösung siehe oben.


              Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
              Danke.
              gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
              ScreenToGif :https://www.screentogif.com/downloads.html

              fischi87F 1 Reply Last reply
              0
              • fischi87F fischi87

                Hallo Gemeinde, ich habe versucht eine Steuerung zu bauen aber irgendwie funktioniert dieses nicht, könnt ihr mir da bitte helfen?

                Ich möchte das meine poolpumpe jeden tag einmal um 6:00-8:00, 14:00-16:00 und 24:00-02:00 Uhr auf true gesetzt ist. ich habe einmal versucht dies zu realisieren doch leider wird die pumpe nicht geschaltet.

                hier mal mein code:

                function poolpumpe () {
                
                    if(compareTime('6:00', '8:00', 'between') || compareTime('14:00', '16:00', 'between') || compareTime('23:59', '02:00', 'between')) { 
                        setState('sonoff.0.Poolpumpe.POWER', true);
                    } else setState('sonoff.0.Poolpumpe.POWER', false);
                };
                
                schedule('0 6 * * *', poolpumpe);
                schedule('0 8 * * *', poolpumpe);
                schedule('0 14 * * *', poolpumpe);
                schedule('0 16 * * *', poolpumpe);
                schedule('59 23 * * *', poolpumpe);
                schedule('0 2 * * *', poolpumpe);
                

                danke grüße Axel

                liv-in-skyL Offline
                liv-in-skyL Offline
                liv-in-sky
                wrote on last edited by
                #7

                @fischi87 falls du eine vis hast - dann vielleicht damit:
                https://forum.iobroker.net/topic/31479/test-adapter-time-switch-v1-0-x-github-latest

                nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                1 Reply Last reply
                0
                • bahnuhrB bahnuhr

                  Lösung siehe oben.

                  fischi87F Offline
                  fischi87F Offline
                  fischi87
                  wrote on last edited by
                  #8

                  @bahnuhr

                  danke euch 👍🏻

                  1 Reply Last reply
                  0
                  • bahnuhrB bahnuhr

                    @fischi87 sagte in Hilfe bei script:

                    tag einmal um 6:00-8:00

                    was heißt das:

                    um 06:00 ?
                    um 07:00 ?
                    um 08:00 ?

                    schreibe mal genau:
                    wann auf true ?
                    wann auf false ?

                    fischi87F Offline
                    fischi87F Offline
                    fischi87
                    wrote on last edited by fischi87
                    #9

                    @bahnuhr

                    nochmal hallo, ich musste das Skript nochmal bissl abändern um den State zu benennen, ist dies so okay, würde dies so funktionieren?

                    var logging = true;
                    
                    const idpoolpumpe = getState('sonoff.0.Poolpumpe.POWER').val;
                    var poolpumpe = idpoolpumpe;
                    var poolstate = 'javascript.0.Pool.Status'
                    
                    createState(poolstate, {
                    type: 'string',
                    name: ' ',
                    desc: ' ',
                    def: ' ',
                    role: 'value'
                    });
                    
                    function pool () { 
                        (idpoolpumpe);
                        if(poolpumpe) poolstate = "Ein";
                        else poolstate = "Aus";
                        if(logging) log(poolstate);
                    }
                    
                    on('sonoff.0.Poolpumpe.POWER', function(dp) {
                        poolpumpe = dp.state.val;
                        pool();
                    });
                    
                    schedule('0 1,5,9,13,15,21 * * *', function (dp) {    // um 6, 14, 0 Uhr auf true
                        setState('sonoff.0.Poolpumpe.POWER', true);
                        pool();
                    });
                      
                    schedule('0 2,6,10,14,16,22 * * *', function (dp) {    // um 2, 8, 16 Uhr auf true
                        setState('sonoff.0.Poolpumpe.POWER', false);
                        pool();
                    
                    });
                    
                    pool();
                    
                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    Support us

                    ioBroker
                    Community Adapters
                    Donate

                    571

                    Online

                    32.4k

                    Users

                    81.4k

                    Topics

                    1.3m

                    Posts
                    Community
                    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                    ioBroker Community 2014-2025
                    logo
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Home
                    • Recent
                    • Tags
                    • Unread 0
                    • Categories
                    • Unreplied
                    • Popular
                    • GitHub
                    • Docu
                    • Hilfe