Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Skript Frage - 2tes Gerät 10 Minuten später

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [gelöst] Skript Frage - 2tes Gerät 10 Minuten später

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

      FHEM ist nun angepasst, nun haben ich einen "Schalter" in den Objekten:

      21:20:13.829	[info]	javascript.0 Start javascript script.js.common.test
      21:20:13.832	[info]	javascript.0 script.js.common.test: Temp 22.5 number
      21:20:13.832	[info]	javascript.0 script.js.common.test: Innen false boolean
      21:20:13.832	[info]	javascript.0 script.js.common.test: Not true boolean
      21:20:13.832	[info]	javascript.0 script.js.common.test: Heizung false boolean
      21:20:13.832	[info]	javascript.0 script.js.common.test: registered 0 subscriptions and 9 schedules
      

      Notlicht springt aber immer noch sofort an.

      Hänge mal die FHEM Settings an, nicht das ich das mal vergesse 🙂

      EDIT

      Habe nun mal wieder die erste Version drauf, mal sehen obs nun geht. Bisher ist "Notlicht" aus
      2880_1.png

      1 Reply Last reply Reply Quote 0
      • paul53
        paul53 last edited by

        @noxx:

        FHEM ist nun angepasst, nun haben ich einen "Schalter" in den Objekten: `
        Das sieht gut aus !
        @noxx:

        Notlicht springt aber immer noch sofort an. `
        Dann ergänze mal im on() im Skript aus meinem ersten Beitrag

        on({id: idAktor_Innenlicht, change: 'ne', ack: true}, function(dp) {
        
        1 Reply Last reply Reply Quote 0
        • N
          noxx last edited by

          gemacht, ich warte ab.

          das Astroscript spinnt aber wohl rum

          javascript.0 2017-07-18 21:28:34.135 warn Cannot calculate "night" for 53.0000, 7.0000

          javascript.0 2017-07-18 21:28:34.122 warn Cannot calculate "nightEnd" for 53.0000, 7.0000

          javascript.0 2017-07-18 21:28:34.117 warn Cannot calculate "night" for 53.0000, 7.0000

          1 Reply Last reply Reply Quote 0
          • N
            noxx last edited by

            hmm, nun ist das Innenlicht an. sollte ab 22:00 dunkel sein 🙂

            > javascript.0 2017-07-18 22:11:00.364 info script.js.common.Hühnerstall: Innenlicht: true

            ! ````
            var idTemp = "fhem.0.ESP03_Temperatur.Temperature"/ESP03_Temperatur Temperature/;
            var idAktor_Innenlicht = "fhem.0.ESP03_Innenlicht.state"/ESP03_Innenlicht state/;
            var idAktor_Notlicht = "fhem.0.ESP03_Notlicht.state"/ESP03_Notlicht state/;
            var idAktor_Heizung = "fhem.0.ESP03_Heizung.state"/ESP03_Heizung state/;
            ! var temp = getState(idTemp).val;
            var aktor_Innenlicht = getState(idAktor_Innenlicht).val;
            var aktor_Notlicht = getState(idAktor_Notlicht).val;
            var aktor_Heizung = getState(idAktor_Heizung).val;
            var timer = null;
            ! function Zeitschaltung()
            {
            var nacht = compareTime('22:00', '06:00', 'between');
            log('User-Log: Innenlicht: ' + aktor_Innenlicht);
            log('User-Log: Nacht: ' + nacht);
            if(nacht && !isAstroDay())
            {
            if(!aktor_Innenlicht) setState(idAktor_Innenlicht, true);
            }
            else if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
            }
            ! function heizung()
            {
            if (temp < 1)
            {
            if (!aktor_Heizung) setState(idAktor_Heizung, true);
            }
            else if (aktor_Heizung) setState(idAktor_Heizung, false);
            }
            ! schedule('* * * * *', Zeitschaltung);
            ! on(idTemp, function(dp) {
            temp = dp.state.val;
            heizung();
            });
            ! on(idAktor_Innenlicht, function(dp) {
            aktor_Innenlicht = dp.state.val;
            if(timer) clearTimeout(timer);
            if(!aktor_Innenlicht) { // schaltet aus
            setState(idAktor_Notlicht, true); // Notlicht ein
            timer = setTimeout(function() {
            setState(idAktor_Notlicht, false);
            }, 600000); // nach 10 Minuten aus
            }
            });
            ! on(idAktor_Notlicht, function(dp) {
            aktor_Notlicht = dp.state.val;
            });
            ! on(idAktor_Heizung, function(dp) {
            aktor_Heizung = dp.state.val;
            });

            
            

            22:16:00.542 [info] javascript.0 script.js.common.Hühnerstall: User-Log: Innenlicht: true
            22:16:00.544 [info] javascript.0 script.js.common.Hühnerstall: User-Log: Nacht: true

            
            EDIT
            
            Habs mal umgedreht, nun gehts wie es soll (hoffe ich)
            
            var nacht = compareTime('06:00', '22:00', 'between');
            1 Reply Last reply Reply Quote 0
            • paul53
              paul53 last edited by

              Ach so, vor 22:00 soll das Licht einschalten, wenn es draußen dunkel wird. Dann so:

                 var tag = compareTime('06:00', '22:00', 'between');
                 if(tag && !isAstroDay())
              
              
              1 Reply Last reply Reply Quote 0
              • paul53
                paul53 last edited by

                @noxx:

                das Astroscript spinnt aber wohl rum

                javascript.0 2017-07-18 21:28:34.135 warn Cannot calculate "night" for 53.0000, 7.0000

                javascript.0 2017-07-18 21:28:34.122 warn Cannot calculate "nightEnd" for 53.0000, 7.0000

                javascript.0 2017-07-18 21:28:34.117 warn Cannot calculate "night" for 53.0000, 7.0000 `
                Bei 53° nördlicher Breite sollte es funktionieren (habe es damit gerade getestet). Weiter nördlich kann es im Sommer zu solchen Warnungen kommen.

                1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 last edited by

                  change: 'ne', ack: true gleichzeitig zu verwenden, ist wohl eher unproduktiv (triggert nie), da die Wertänderung Folge von setState() ist und ack = true Folge der Rückmeldung des Aktors (FHEM) bei unverändertem Wert. Außerdem sollte bei der Heizung eine Hysterese verwendet werden, da sonst zu häufig ein- und ausgeschaltet wird. So sollte es funktionieren:

                  var idTemp = "fhem.0.ESP03_Temperatur.Temperature"/*ESP03_Temperatur Temperature*/;
                  var idAktor_Innenlicht = "fhem.0.ESP03_Innenlicht.state"/*ESP03_Innenlicht state*/;
                  var idAktor_Notlicht = "fhem.0.ESP03_Notlicht.state"/*ESP03_Notlicht state*/;
                  var idAktor_Heizung = "fhem.0.ESP03_Heizung.state"/*ESP03_Heizung state*/;
                  
                  var temp = getState(idTemp).val;
                  var aktor_Innenlicht = getState(idAktor_Innenlicht).val;
                  var aktor_Notlicht = getState(idAktor_Notlicht).val;
                  var aktor_Heizung = getState(idAktor_Heizung).val;
                  var timer = null;
                  
                  function Zeitschaltung() {
                      var tag = compareTime('06:00', '22:00', 'between');
                      if(tag && !isAstroDay()) {
                          if(!aktor_Innenlicht) setState(idAktor_Innenlicht, true);
                      }
                      else if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
                  }
                  
                  function heizung() {
                      if (temp < 0 && !aktor_Heizung) setState(idAktor_Heizung, true);
                      else if (temp > 1 && aktor_Heizung) setState(idAktor_Heizung, false);
                  }
                  
                  schedule('* * * * *', Zeitschaltung);
                  
                  on(idTemp, function(dp) {
                      temp = dp.state.val;
                      heizung();
                  });
                  
                  on({id: idAktor_Innenlicht, ack: true}, function(dp) {
                      aktor_Innenlicht = dp.state.val;
                      if(!aktor_Innenlicht) setState(idAktor_Notlicht, true);  // Notlicht ein
                  });
                  
                  on({id: idAktor_Notlicht, ack: true}, function(dp) {
                      aktor_Notlicht = dp.state.val;
                      if(aktor_Notlicht) {  // hat eingeschaltet
                          if(timer) clearTimeout(timer);
                          timer = setTimeout(function() {
                              setState(idAktor_Notlicht, false);
                          }, 600000);  // nach 10 Minuten aus
                      }    
                  });
                  
                  on({id: idAktor_Heizung, ack: true}, function(dp) {
                      aktor_Heizung = dp.state.val;
                  });
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • N
                    noxx last edited by

                    danke, aber habe dann wieder das Problem, das die Notlampe dauer leuchtet.

                    1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 last edited by

                      @noxx:

                      habe dann wieder das Problem, das die Notlampe dauer leuchtet. `
                      Wie sieht der Zustand (Wert, Bestätigt) des Aktors Notlicht im Reiter Zustände aus, wenn die Notlampe leuchtet ?

                      1 Reply Last reply Reply Quote 0
                      • N
                        noxx last edited by

                        Notlicht An:

                        ! ````
                        fhem.0.ESP03_Notlicht.off ESP03_Notlicht off ESP03_Notlicht off
                        fhem.0.ESP03_Notlicht.on ESP03_Notlicht on ESP03_Notlicht on
                        fhem.0.ESP03_Notlicht.check ESP03_Notlicht check ESP03_Notlicht check
                        fhem.0.ESP03_Notlicht.buzzer ESP03_Notlicht buzzer ESP03_Notlicht buzzer
                        fhem.0.ESP03_Notlicht.candle ESP03_Notlicht candle ESP03_Notlicht candle
                        fhem.0.ESP03_Notlicht.clearreadings ESP03_Notlicht clearreadings ESP03_Notlicht clearreadings
                        fhem.0.ESP03_Notlicht.dmx ESP03_Notlicht dmx ESP03_Notlicht dmx
                        fhem.0.ESP03_Notlicht.dots ESP03_Notlicht dots ESP03_Notlicht dots
                        fhem.0.ESP03_Notlicht.erase ESP03_Notlicht erase ESP03_Notlicht erase
                        fhem.0.ESP03_Notlicht.event ESP03_Notlicht event ESP03_Notlicht event
                        fhem.0.ESP03_Notlicht.gpio ESP03_Notlicht gpio ESP03_Notlicht gpio
                        fhem.0.ESP03_Notlicht.help ESP03_Notlicht help ESP03_Notlicht help
                        fhem.0.ESP03_Notlicht.inputswitchstate ESP03_Notlicht inputswitchstate ESP03_Notlicht inputswitchstate
                        fhem.0.ESP03_Notlicht.irsend ESP03_Notlicht irsend ESP03_Notlicht irsend
                        fhem.0.ESP03_Notlicht.lcd ESP03_Notlicht lcd ESP03_Notlicht lcd
                        fhem.0.ESP03_Notlicht.lcdcmd ESP03_Notlicht lcdcmd ESP03_Notlicht lcdcmd
                        fhem.0.ESP03_Notlicht.lights ESP03_Notlicht lights ESP03_Notlicht lights
                        fhem.0.ESP03_Notlicht.longpulse ESP03_Notlicht longpulse ESP03_Notlicht longpulse
                        fhem.0.ESP03_Notlicht.mcpgpio ESP03_Notlicht mcpgpio ESP03_Notlicht mcpgpio
                        fhem.0.ESP03_Notlicht.motorshieldcmd ESP03_Notlicht motorshieldcmd ESP03_Notlicht motorshieldcmd
                        fhem.0.ESP03_Notlicht.neopixel ESP03_Notlicht neopixel ESP03_Notlicht neopixel
                        fhem.0.ESP03_Notlicht.neopixelall ESP03_Notlicht neopixelall ESP03_Notlicht neopixelall
                        fhem.0.ESP03_Notlicht.neopixelfx ESP03_Notlicht neopixelfx ESP03_Notlicht neopixelfx
                        fhem.0.ESP03_Notlicht.neopixelline ESP03_Notlicht neopixelline ESP03_Notlicht neopixelline
                        fhem.0.ESP03_Notlicht.oled ESP03_Notlicht oled ESP03_Notlicht oled
                        fhem.0.ESP03_Notlicht.oledcmd ESP03_Notlicht oledcmd ESP03_Notlicht oledcmd
                        fhem.0.ESP03_Notlicht.oledframedcmd ESP03_Notlicht oledframedcmd ESP03_Notlicht oledframedcmd
                        fhem.0.ESP03_Notlicht.pcapwm ESP03_Notlicht pcapwm ESP03_Notlicht pcapwm
                        fhem.0.ESP03_Notlicht.pcfgpio ESP03_Notlicht pcfgpio ESP03_Notlicht pcfgpio
                        fhem.0.ESP03_Notlicht.pcflongpulse ESP03_Notlicht pcflongpulse ESP03_Notlicht pcflongpulse
                        fhem.0.ESP03_Notlicht.pcfpulse ESP03_Notlicht pcfpulse ESP03_Notlicht pcfpulse
                        fhem.0.ESP03_Notlicht.pulse ESP03_Notlicht pulse ESP03_Notlicht pulse
                        fhem.0.ESP03_Notlicht.pwm ESP03_Notlicht pwm ESP03_Notlicht pwm
                        fhem.0.ESP03_Notlicht.pwmfade ESP03_Notlicht pwmfade ESP03_Notlicht pwmfade
                        fhem.0.ESP03_Notlicht.raw ESP03_Notlicht raw ESP03_Notlicht raw false admin.0 2017-07-18 21:19:21.723 2017-07-18 21:19:21.723
                        fhem.0.ESP03_Notlicht.reboot ESP03_Notlicht reboot ESP03_Notlicht reboot
                        fhem.0.ESP03_Notlicht.reset ESP03_Notlicht reset ESP03_Notlicht reset
                        fhem.0.ESP03_Notlicht.rtttl ESP03_Notlicht rtttl ESP03_Notlicht rtttl
                        fhem.0.ESP03_Notlicht.serialsend ESP03_Notlicht serialsend ESP03_Notlicht serialsend
                        fhem.0.ESP03_Notlicht.servo ESP03_Notlicht servo ESP03_Notlicht servo
                        fhem.0.ESP03_Notlicht.status ESP03_Notlicht status ESP03_Notlicht status
                        fhem.0.ESP03_Notlicht.statusrequest ESP03_Notlicht statusrequest ESP03_Notlicht statusrequest
                        fhem.0.ESP03_Notlicht.tone ESP03_Notlicht tone ESP03_Notlicht tone
                        fhem.0.ESP03_Notlicht.Switch ESP03_Notlicht Switch ESP03_Notlicht Switch true true fhem.0 2017-07-20 22:01:02.155 2017-07-18 21:17:38.590
                        fhem.0.ESP03_Notlicht.presence ESP03_Notlicht presence ESP03_Notlicht presence present true fhem.0 2017-07-20 21:59:53.648 2017-07-18 21:21:56.434
                        fhem.0.ESP03_Notlicht.state ESP03_Notlicht state ESP03_Notlicht state true true fhem.0 2017-07-20 22:01:02.163 2017-07-20 21:59:43.319

                        
                        Notlicht Aus:
                        
                        >! ````
                        fhem.0.ESP03_Notlicht.off	ESP03_Notlicht off	ESP03_Notlicht off	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.on	ESP03_Notlicht on	ESP03_Notlicht on	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.check	ESP03_Notlicht check	ESP03_Notlicht check	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.buzzer	ESP03_Notlicht buzzer	ESP03_Notlicht buzzer	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.candle	ESP03_Notlicht candle	ESP03_Notlicht candle	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.clearreadings	ESP03_Notlicht clearreadings	ESP03_Notlicht clearreadings	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.dmx	ESP03_Notlicht dmx	ESP03_Notlicht dmx	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.dots	ESP03_Notlicht dots	ESP03_Notlicht dots	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.erase	ESP03_Notlicht erase	ESP03_Notlicht erase	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.event	ESP03_Notlicht event	ESP03_Notlicht event	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.gpio	ESP03_Notlicht gpio	ESP03_Notlicht gpio	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.help	ESP03_Notlicht help	ESP03_Notlicht help	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.inputswitchstate	ESP03_Notlicht inputswitchstate	ESP03_Notlicht inputswitchstate	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.irsend	ESP03_Notlicht irsend	ESP03_Notlicht irsend	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.lcd	ESP03_Notlicht lcd	ESP03_Notlicht lcd	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.lcdcmd	ESP03_Notlicht lcdcmd	ESP03_Notlicht lcdcmd	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.lights	ESP03_Notlicht lights	ESP03_Notlicht lights	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.longpulse	ESP03_Notlicht longpulse	ESP03_Notlicht longpulse	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.mcpgpio	ESP03_Notlicht mcpgpio	ESP03_Notlicht mcpgpio	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.motorshieldcmd	ESP03_Notlicht motorshieldcmd	ESP03_Notlicht motorshieldcmd	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.neopixel	ESP03_Notlicht neopixel	ESP03_Notlicht neopixel	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.neopixelall	ESP03_Notlicht neopixelall	ESP03_Notlicht neopixelall	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.neopixelfx	ESP03_Notlicht neopixelfx	ESP03_Notlicht neopixelfx	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.neopixelline	ESP03_Notlicht neopixelline	ESP03_Notlicht neopixelline	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.oled	ESP03_Notlicht oled	ESP03_Notlicht oled	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.oledcmd	ESP03_Notlicht oledcmd	ESP03_Notlicht oledcmd	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.oledframedcmd	ESP03_Notlicht oledframedcmd	ESP03_Notlicht oledframedcmd	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pcapwm	ESP03_Notlicht pcapwm	ESP03_Notlicht pcapwm	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pcfgpio	ESP03_Notlicht pcfgpio	ESP03_Notlicht pcfgpio	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pcflongpulse	ESP03_Notlicht pcflongpulse	ESP03_Notlicht pcflongpulse	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pcfpulse	ESP03_Notlicht pcfpulse	ESP03_Notlicht pcfpulse	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pulse	ESP03_Notlicht pulse	ESP03_Notlicht pulse	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pwm	ESP03_Notlicht pwm	ESP03_Notlicht pwm	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.pwmfade	ESP03_Notlicht pwmfade	ESP03_Notlicht pwmfade	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.raw	ESP03_Notlicht raw	ESP03_Notlicht raw	 	false	admin.0	2017-07-18 21:19:21.723	2017-07-18 21:19:21.723
                        fhem.0.ESP03_Notlicht.reboot	ESP03_Notlicht reboot	ESP03_Notlicht reboot	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.reset	ESP03_Notlicht reset	ESP03_Notlicht reset	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.rtttl	ESP03_Notlicht rtttl	ESP03_Notlicht rtttl	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.serialsend	ESP03_Notlicht serialsend	ESP03_Notlicht serialsend	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.servo	ESP03_Notlicht servo	ESP03_Notlicht servo	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.status	ESP03_Notlicht status	ESP03_Notlicht status	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.statusrequest	ESP03_Notlicht statusrequest	ESP03_Notlicht statusrequest	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.tone	ESP03_Notlicht tone	ESP03_Notlicht tone	 	 	 	 	 
                        fhem.0.ESP03_Notlicht.Switch	ESP03_Notlicht Switch	ESP03_Notlicht Switch	true	true	fhem.0	2017-07-20 22:02:21.741	2017-07-18 21:17:38.590
                        fhem.0.ESP03_Notlicht.presence	ESP03_Notlicht presence	ESP03_Notlicht presence	present	true	fhem.0	2017-07-20 21:59:53.648	2017-07-18 21:21:56.434
                        fhem.0.ESP03_Notlicht.state	ESP03_Notlicht state	ESP03_Notlicht state	false	true	fhem.0	2017-07-20 22:02:21.754	2017-07-20 22:02:21.583
                        
                        1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 last edited by

                          Wenn Wert und Bestätigt true sind, müsste das Notlicht nach 10 Minuten ausschalten. Bau mal zum Testen Logs ein:

                          on({id: idAktor_Notlicht, ack: true}, function(dp) {
                              aktor_Notlicht = dp.state.val;
                              log('Notlicht: ' + aktor_Notlicht + ' bestätigt: ' + dp.state.ack);
                              if(aktor_Notlicht) {  // hat eingeschaltet
                                  if(timer) clearTimeout(timer);
                                  timer = setTimeout(function() {
                                      log('10 Minuten sind um');
                                      setState(idAktor_Notlicht, false);
                                  }, 600000);  // nach 10 Minuten aus
                              }   
                          });
                          
                          
                          1 Reply Last reply Reply Quote 0
                          • N
                            noxx last edited by

                            ok, läuft. mich wunder das das Notlicht mit dem Skript immer

                            sofort nach speichern anspringt.

                            1 Reply Last reply Reply Quote 0
                            • N
                              noxx last edited by

                              geht nicht wieder aus

                              22:31:42.612	[info]	javascript.0 Stop script script.js.common.Hühnerstall
                              22:31:42.955	[info]	javascript.0 Start javascript script.js.common.Hühnerstall
                              22:31:42.956	[info]	javascript.0 script.js.common.Hühnerstall: registered 4 subscriptions and 1 schedule
                              22:31:59.131	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:32:00.110	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:32:04.182	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:32:59.288	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:33:04.255	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:33:59.351	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:34:04.313	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:34:59.423	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:35:04.370	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:35:10.564	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:35:17.336	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:35:59.466	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:36:04.439	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:36:59.598	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:37:04.513	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:37:59.660	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:38:04.566	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:38:59.683	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:39:04.620	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:39:59.822	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:40:04.686	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:40:13.793	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:40:18.375	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:41:00.026	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:41:04.742	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:42:00.022	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:42:04.801	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:42:59.943	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:43:04.858	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:43:59.993	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              22:44:04.939	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                              
                              1 Reply Last reply Reply Quote 0
                              • N
                                noxx last edited by

                                dachte der Timer hat auch einen Wert

                                23:00:27.773	[info]	javascript.0 script.js.common.Hühnerstall: Timer: [object Object]
                                23:00:27.978	[info]	javascript.0 script.js.common.Hühnerstall: Notlicht: true bestätigt: true
                                23:00:27.979	[info]	javascript.0 script.js.common.Hühnerstall: Timer: [object Object]
                                
                                on({id: idAktor_Notlicht, ack: true}, function(dp) {
                                    aktor_Notlicht = dp.state.val;
                                    log('Notlicht: ' + aktor_Notlicht + ' bestätigt: ' + dp.state.ack);
                                    if(aktor_Notlicht) {  // hat eingeschaltet
                                        if(timer) clearTimeout(timer);
                                        log('Timer: ' + timer);
                                        timer = setTimeout(function() {
                                            log('10 Minuten sind um');
                                            setState(idAktor_Notlicht, false);
                                        }, 600000);  // nach 10 Minuten aus
                                    }   
                                });
                                
                                1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 last edited by

                                  Es wird jede Minute 2 mal ausgelöst. Dann funktioniert dies nicht wie es soll:

                                      else if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
                                  

                                  Ergänze mal:

                                      else if(aktor_Innenlicht) { setState(idAktor_Innenlicht, false);
                                      log('Innenlicht: ' + aktor_Innenlicht);
                                      }
                                  
                                  

                                  oder schreib es mal so:

                                  function Zeitschaltung() {
                                      var tag = compareTime('06:00', '22:00', 'between');
                                      if(tag && !isAstroDay()) {
                                          if(!aktor_Innenlicht) setState(idAktor_Innenlicht, true);
                                      } else {
                                          if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
                                      }     
                                  }
                                  
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • paul53
                                    paul53 last edited by

                                    Ich habe das Skript mal bei mir getestet (mit Testdatenpunkten): Es läuft wie es soll. Kopiere einfach mal das folgende Skript komplett in Dein Javascript-Fenster und beobachte:

                                    var debug = true;  // nach Test auf false setzen !
                                    
                                    var idTemp = "fhem.0.ESP03_Temperatur.Temperature"/*ESP03_Temperatur Temperature*/;
                                    var idAktor_Innenlicht = "fhem.0.ESP03_Innenlicht.state"/*ESP03_Innenlicht state*/;
                                    var idAktor_Notlicht = "fhem.0.ESP03_Notlicht.state"/*ESP03_Notlicht state*/;
                                    var idAktor_Heizung = "fhem.0.ESP03_Heizung.state"/*ESP03_Heizung state*/;
                                    
                                    var temp = getState(idTemp).val;
                                    var aktor_Innenlicht = getState(idAktor_Innenlicht).val;
                                    var aktor_Notlicht = getState(idAktor_Notlicht).val;
                                    var aktor_Heizung = getState(idAktor_Heizung).val;
                                    var timer = null;
                                    
                                    function Zeitschaltung() {
                                        var tag = compareTime('06:00', '22:00', 'between');
                                        if(tag && !isAstroDay()) {
                                            if(!aktor_Innenlicht) setState(idAktor_Innenlicht, true);
                                        }
                                        else if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
                                    }
                                    
                                    function heizung() {
                                        if (temp < 0 && !aktor_Heizung) setState(idAktor_Heizung, true);
                                        else if (temp > 1 && aktor_Heizung) setState(idAktor_Heizung, false);
                                    }
                                    
                                    schedule('* * * * *', Zeitschaltung);
                                    
                                    on(idTemp, function(dp) {
                                        temp = dp.state.val;
                                        heizung();
                                    });
                                    
                                    on({id: idAktor_Innenlicht, ack: true}, function(dp) {
                                        aktor_Innenlicht = dp.state.val;
                                        if(debug) log('Innenlicht: ' + aktor_Innenlicht);
                                        if(!aktor_Innenlicht) setState(idAktor_Notlicht, true);  // Notlicht ein
                                    });
                                    
                                    on({id: idAktor_Notlicht, ack: true}, function(dp) {
                                        aktor_Notlicht = dp.state.val;
                                        if(debug) log('Notlicht: ' + aktor_Notlicht);
                                        if(aktor_Notlicht) {  // hat eingeschaltet
                                            if(timer) clearTimeout(timer);
                                            timer = setTimeout(function() {
                                                setState(idAktor_Notlicht, false);
                                            }, 600000);  // nach 10 Minuten aus
                                        }   
                                    });
                                    
                                    on({id: idAktor_Heizung, ack: true}, function(dp) {
                                        aktor_Heizung = dp.state.val;
                                        if(debug) log('Heizung: ' + aktor_Heizung);
                                    });
                                    
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      noxx last edited by

                                      habs nun noch keine 10 Minuten am laufen, aber auch hier geht Notlicht sofort an.

                                      in 10 Minuten mehr….

                                      ! ````
                                      18:26:14.134 [info] javascript.0 Stop script script.js.common.Hühnerstall
                                      18:26:14.499 [info] javascript.0 Start javascript script.js.common.Hühnerstall
                                      18:26:14.501 [info] javascript.0 script.js.common.Hühnerstall: registered 4 subscriptions and 1 schedule
                                      18:26:14.859 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:26:18.976 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:26:23.951 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                      18:27:14.103 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                      18:27:14.198 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:27:18.999 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:27:23.994 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                      18:28:14.129 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                      18:28:14.162 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:28:19.065 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:28:24.075 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                      18:29:14.240 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                      18:29:14.288 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:29:19.114 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                      18:29:24.113 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false

                                      1 Reply Last reply Reply Quote 0
                                      • paul53
                                        paul53 last edited by

                                        Unverständlich ! Sogar der Heizungsaktor, der mit der Zeitschaltung nichts zu tun hat, wird jede Minute geloggt. Da ist etwas faul, aber was ?

                                        1 Reply Last reply Reply Quote 0
                                        • N
                                          noxx last edited by

                                          ich weiß es leider nicht, auch nach 12 Minuten keine Änderung:

                                          ! ````
                                          18:26:14.134 [info] javascript.0 Stop script script.js.common.Hühnerstall
                                          18:26:14.499 [info] javascript.0 Start javascript script.js.common.Hühnerstall
                                          18:26:14.501 [info] javascript.0 script.js.common.Hühnerstall: registered 4 subscriptions and 1 schedule
                                          18:26:14.859 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:26:18.976 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:26:23.951 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:27:14.103 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:27:14.198 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:27:18.999 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:27:23.994 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:28:14.129 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:28:14.162 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:28:19.065 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:28:24.075 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:29:14.240 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:29:14.288 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:29:19.114 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:29:24.113 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:29:58.085 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:30:14.206 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:30:14.246 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:30:14.742 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:30:14.785 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:30:19.180 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:30:24.179 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:30:30.354 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:31:14.231 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:31:14.270 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:31:19.239 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:31:24.231 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:32:14.290 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:32:14.337 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:32:19.295 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:32:24.290 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:33:14.347 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:33:14.389 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:33:19.366 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:33:24.363 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:34:14.410 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:34:14.451 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:34:19.422 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:34:24.422 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:35:01.657 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:35:14.478 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:35:14.562 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:35:16.894 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:35:16.939 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:35:19.484 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:35:24.477 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:35:32.418 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:36:14.545 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:36:14.570 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:36:19.541 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:36:24.535 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:37:14.590 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:37:14.635 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:37:19.599 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:37:24.601 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false
                                          18:38:14.654 [info] javascript.0 script.js.common.Hühnerstall: Innenlicht: false
                                          18:38:14.689 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:38:19.665 [info] javascript.0 script.js.common.Hühnerstall: Notlicht: true
                                          18:38:24.666 [info] javascript.0 script.js.common.Hühnerstall: Heizung: false

                                          1 Reply Last reply Reply Quote 0
                                          • paul53
                                            paul53 last edited by

                                            Das kann nur mit FHEM bzw. dem Adapter zutun haben. Dann tausche mal in allen on() das

                                            ack: true
                                            

                                            gegen

                                            change: 'ne'
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            721
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            2
                                            54
                                            4696
                                            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