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

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. [Gelöst] Delay für Licht ein/aus

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    662

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    5.7k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

[Gelöst] Delay für Licht ein/aus

Scheduled Pinned Locked Moved JavaScript
26 Posts 5 Posters 2.4k 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.
  • T Do not disturb
    T Do not disturb
    ticaki
    wrote on last edited by ticaki
    #21

    Das hatte Asgothian in seinem Beispiel erstellt. Du hast es umgebaut das es was anders macht was du nicht willst.

    function AmazonLicht(dp, status) {
      setState(dp, status);
      setStateDelayed(dp, true, 3000);// das ist falsch
    }
    
    function MeineNeueFunktion() {
       AmazonLicht('mein Licht', true oder false);// hier ändere ich dinge
    }
    
    function AmazonLicht(dp, status) { // hier nicht
      setState(dp, status);
      setStateDelayed(dp, status, 3000);
    }
    

    Weather-Warnings Espresense NSPanel-Lovelace-ui Tagesschau

    Spenden

    BENNI32154B 1 Reply Last reply
    0
    • T ticaki

      Das hatte Asgothian in seinem Beispiel erstellt. Du hast es umgebaut das es was anders macht was du nicht willst.

      function AmazonLicht(dp, status) {
        setState(dp, status);
        setStateDelayed(dp, true, 3000);// das ist falsch
      }
      
      function MeineNeueFunktion() {
         AmazonLicht('mein Licht', true oder false);// hier ändere ich dinge
      }
      
      function AmazonLicht(dp, status) { // hier nicht
        setState(dp, status);
        setStateDelayed(dp, status, 3000);
      }
      
      BENNI32154B Offline
      BENNI32154B Offline
      BENNI32154
      wrote on last edited by
      #22

      @ticaki sagte in Delay für Licht ein/aus:

      Das hatte Asgothian in seinem Beispiel erstellt. Du hast es umgebaut das es was anders macht was du nicht willst.

      function AmazonLicht(dp, status) {
        setState(dp, status);
        setStateDelayed(dp, true, 3000);// das ist falsch
      }
      
      function MeineNeueFunktion() {
      AmazonLicht('mein Licht', true oder false);// hier ändere ich dinge
      }
      
      function AmazonLicht(dp, status) { // hier nicht
        setState(dp, status);
        setStateDelayed(dp, status, 3000);
      }
      

      aber so hatte es nicht funktioniert.

      T 1 Reply Last reply
      0
      • BENNI32154B BENNI32154

        @ticaki sagte in Delay für Licht ein/aus:

        Das hatte Asgothian in seinem Beispiel erstellt. Du hast es umgebaut das es was anders macht was du nicht willst.

        function AmazonLicht(dp, status) {
          setState(dp, status);
          setStateDelayed(dp, true, 3000);// das ist falsch
        }
        
        function MeineNeueFunktion() {
        AmazonLicht('mein Licht', true oder false);// hier ändere ich dinge
        }
        
        function AmazonLicht(dp, status) { // hier nicht
          setState(dp, status);
          setStateDelayed(dp, status, 3000);
        }
        

        aber so hatte es nicht funktioniert.

        T Do not disturb
        T Do not disturb
        ticaki
        wrote on last edited by
        #23

        @BENNI32154
        Was soll ich sagen... das funktioniert. :)

        vielleicht postest du mal das komplette Skript, so dass man sieht welche Funktion von wo wann aufgerufen wird.

        Weather-Warnings Espresense NSPanel-Lovelace-ui Tagesschau

        Spenden

        BENNI32154B 1 Reply Last reply
        0
        • T ticaki

          @BENNI32154
          Was soll ich sagen... das funktioniert. :)

          vielleicht postest du mal das komplette Skript, so dass man sieht welche Funktion von wo wann aufgerufen wird.

          BENNI32154B Offline
          BENNI32154B Offline
          BENNI32154
          wrote on last edited by
          #24

          @ticaki sagte in Delay für Licht ein/aus:

          @BENNI32154
          Was soll ich sagen... das funktioniert. :)

          vielleicht postest du mal das komplette Skript, so dass man sieht welche Funktion von wo wann aufgerufen wird.

          So ist das Skript ohne Delay:

          const idTV     = 'lgtv.0.states.on';
          const idLicht1 = 'id1.powerState';
          const idLicht2 = 'id2.powerState';
          const idLicht3 = 'id3.powerState';
          const idLicht4 = 'wifilight.0.192_168_178_150.on';
          const idLicht5 = 'wifilight.0.192_168_178_157.on';
          const idLicht6 = 'id6.powerState';
          const idSzene = 'id7.active';
           
          var tv = getState(idTV).val;
           
          function licht(ein) {
             setState(idLicht1, ein);
             setState(idLicht2, ein);
             setState(idLicht3, ein);
             setState(idLicht4, ein);
             setState(idLicht5, ein);
             setState(idLicht6, ein);
             var txt = 'ausgeschaltet';
             if(ein) txt = 'eingeschaltet';
             if (ein) setStateDelayed(idSzene, true, 6000);
             if(tv) setState('lgtv.0.states.popup', 'Das Licht ist ' + txt);
          }
           
          // Skriptstart
          if(!isAstroDay() && tv) licht(true);
          else licht(false);
           
          on(idTV, function(dp) { // Triggert bei Wertänderung
             tv = dp.state.val;
             if(tv && !isAstroDay()) licht(true);
             else licht(false);
          });
           
          schedule({astro: "sunset"}, function () {
             if(tv) licht(true);
          });
           
          schedule({astro: "sunrise"}, function () {
             licht(false);
          });
          
          T 1 Reply Last reply
          0
          • BENNI32154B BENNI32154

            @ticaki sagte in Delay für Licht ein/aus:

            @BENNI32154
            Was soll ich sagen... das funktioniert. :)

            vielleicht postest du mal das komplette Skript, so dass man sieht welche Funktion von wo wann aufgerufen wird.

            So ist das Skript ohne Delay:

            const idTV     = 'lgtv.0.states.on';
            const idLicht1 = 'id1.powerState';
            const idLicht2 = 'id2.powerState';
            const idLicht3 = 'id3.powerState';
            const idLicht4 = 'wifilight.0.192_168_178_150.on';
            const idLicht5 = 'wifilight.0.192_168_178_157.on';
            const idLicht6 = 'id6.powerState';
            const idSzene = 'id7.active';
             
            var tv = getState(idTV).val;
             
            function licht(ein) {
               setState(idLicht1, ein);
               setState(idLicht2, ein);
               setState(idLicht3, ein);
               setState(idLicht4, ein);
               setState(idLicht5, ein);
               setState(idLicht6, ein);
               var txt = 'ausgeschaltet';
               if(ein) txt = 'eingeschaltet';
               if (ein) setStateDelayed(idSzene, true, 6000);
               if(tv) setState('lgtv.0.states.popup', 'Das Licht ist ' + txt);
            }
             
            // Skriptstart
            if(!isAstroDay() && tv) licht(true);
            else licht(false);
             
            on(idTV, function(dp) { // Triggert bei Wertänderung
               tv = dp.state.val;
               if(tv && !isAstroDay()) licht(true);
               else licht(false);
            });
             
            schedule({astro: "sunset"}, function () {
               if(tv) licht(true);
            });
             
            schedule({astro: "sunrise"}, function () {
               licht(false);
            });
            
            T Do not disturb
            T Do not disturb
            ticaki
            wrote on last edited by ticaki
            #25

            @BENNI32154

            Und wenn du das hier unten nimmst geht es dann?

            const idTV     = 'lgtv.0.states.on';
            const idLicht1 = 'id1.powerState';
            const idLicht2 = 'id2.powerState';
            const idLicht3 = 'id3.powerState';
            const idLicht4 = 'wifilight.0.192_168_178_150.on';
            const idLicht5 = 'wifilight.0.192_168_178_157.on';
            const idLicht6 = 'id6.powerState';
            const idSzene = 'id7.active';
             
            var tv = getState(idTV).val;
             
            function licht(ein) {
               AmazonLicht(idLicht1, ein);
               AmazonLicht(idLicht2, ein);
               AmazonLicht(idLicht3, ein);
               AmazonLicht(idLicht4, ein);
               AmazonLicht(idLicht5, ein);
               AmazonLicht(idLicht6, ein);
               var txt = 'ausgeschaltet';
               if(ein) txt = 'eingeschaltet';
               if (ein) setStateDelayed(idSzene, true, 6000);
               if(tv) setState('lgtv.0.states.popup', 'Das Licht ist ' + txt);
            }
            
            function AmazonLicht(dp, status) { // hier nicht
               setState(dp, status);
               setStateDelayed(dp, status, 3000);
             }
             
            // Skriptstart
            if(!isAstroDay() && tv) licht(true);
            else licht(false);
             
            on(idTV, function(dp) { // Triggert bei Wertänderung
               tv = dp.state.val;
               if(tv && !isAstroDay()) licht(true);
               else licht(false);
            });
            
             
            schedule({astro: "sunset"}, function () {
               if(tv) licht(true);
            });
             
            schedule({astro: "sunrise"}, function () {
               licht(false);
            });
            

            Weather-Warnings Espresense NSPanel-Lovelace-ui Tagesschau

            Spenden

            BENNI32154B 1 Reply Last reply
            0
            • T ticaki

              @BENNI32154

              Und wenn du das hier unten nimmst geht es dann?

              const idTV     = 'lgtv.0.states.on';
              const idLicht1 = 'id1.powerState';
              const idLicht2 = 'id2.powerState';
              const idLicht3 = 'id3.powerState';
              const idLicht4 = 'wifilight.0.192_168_178_150.on';
              const idLicht5 = 'wifilight.0.192_168_178_157.on';
              const idLicht6 = 'id6.powerState';
              const idSzene = 'id7.active';
               
              var tv = getState(idTV).val;
               
              function licht(ein) {
                 AmazonLicht(idLicht1, ein);
                 AmazonLicht(idLicht2, ein);
                 AmazonLicht(idLicht3, ein);
                 AmazonLicht(idLicht4, ein);
                 AmazonLicht(idLicht5, ein);
                 AmazonLicht(idLicht6, ein);
                 var txt = 'ausgeschaltet';
                 if(ein) txt = 'eingeschaltet';
                 if (ein) setStateDelayed(idSzene, true, 6000);
                 if(tv) setState('lgtv.0.states.popup', 'Das Licht ist ' + txt);
              }
              
              function AmazonLicht(dp, status) { // hier nicht
                 setState(dp, status);
                 setStateDelayed(dp, status, 3000);
               }
               
              // Skriptstart
              if(!isAstroDay() && tv) licht(true);
              else licht(false);
               
              on(idTV, function(dp) { // Triggert bei Wertänderung
                 tv = dp.state.val;
                 if(tv && !isAstroDay()) licht(true);
                 else licht(false);
              });
              
               
              schedule({astro: "sunset"}, function () {
                 if(tv) licht(true);
              });
               
              schedule({astro: "sunrise"}, function () {
                 licht(false);
              });
              
              BENNI32154B Offline
              BENNI32154B Offline
              BENNI32154
              wrote on last edited by
              #26

              @ticaki sagte in Delay für Licht ein/aus:

              @BENNI32154
              Und wenn du das hier unten nimmst geht es dann?
              const idTV = 'lgtv.0.states.on'; const idLicht1 = 'id1.powerState'; const idLicht2 = 'id2.powerState'; const idLicht3 = 'id3.powerState'; const idLicht4 = 'wifilight.0.192_168_178_150.on'; const idLicht5 = 'wifilight.0.192_168_178_157.on'; const idLicht6 = 'id6.powerState'; const idSzene = 'id7.active'; var tv = getState(idTV).val; function licht(ein) { AmazonLicht(idLicht1, ein); AmazonLicht(idLicht2, ein); AmazonLicht(idLicht3, ein); AmazonLicht(idLicht4, ein); AmazonLicht(idLicht5, ein); AmazonLicht(idLicht6, ein); var txt = 'ausgeschaltet'; if(ein) txt = 'eingeschaltet'; if (ein) setStateDelayed(idSzene, true, 6000); if(tv) setState('lgtv.0.states.popup', 'Das Licht ist ' + txt); } function AmazonLicht(dp, status) { // hier nicht setState(dp, status); setStateDelayed(dp, status, 3000); } // Skriptstart if(!isAstroDay() && tv) licht(true); else licht(false); on(idTV, function(dp) { // Triggert bei Wertänderung tv = dp.state.val; if(tv && !isAstroDay()) licht(true); else licht(false); }); schedule({astro: "sunset"}, function () { if(tv) licht(true); }); schedule({astro: "sunrise"}, function () { licht(false); });

              funktioniert perfekt, vielen dank! :)

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              Support us

              ioBroker
              Community Adapters
              Donate

              254

              Online

              32.7k

              Users

              82.6k

              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