Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Hilfe bei script

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    Hilfe bei script

    This topic has been deleted. Only users with topic management privileges can see it.
    • fischi87
      fischi87 last edited by

      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

      bahnuhr liv-in-sky 2 Replies Last reply Reply Quote 0
      • bahnuhr
        bahnuhr Forum Testing Most Active @fischi87 last edited by

        @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 ?

        fischi87 2 Replies Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active last edited by bahnuhr

          @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);
          });
          
          1 Reply Last reply Reply Quote 0
          • bahnuhr
            bahnuhr Forum Testing Most Active last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • fischi87
              fischi87 @bahnuhr last edited by fischi87

              @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 Reply Quote 0
              • bahnuhr
                bahnuhr Forum Testing Most Active last edited by

                Lösung siehe oben.

                fischi87 1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @fischi87 last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • fischi87
                    fischi87 @bahnuhr last edited by

                    @bahnuhr

                    danke euch 👍🏻

                    1 Reply Last reply Reply Quote 0
                    • fischi87
                      fischi87 @bahnuhr last edited by fischi87

                      @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 Reply Quote 0
                      • First post
                        Last post

                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      867
                      Online

                      31.8k
                      Users

                      80.0k
                      Topics

                      1.3m
                      Posts

                      javascript
                      3
                      9
                      374
                      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