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

      hmm, nun geht nix mehr 🙂

      Entweder spinnt iobroker oder er mag den "Befehl" nicht

      fhem.0	2017-07-17 18:20:18.935	warn	Readings "Swi" still not found in "ESP03_Innenlicht" after JsonList2
      fhem.0	2017-07-17 18:20:18.455	info	Unknown state "ESP03_Innenlicht.Swi
      fhem.0	2017-07-17 18:20:08.256	warn	Readings "Swi" still not found in "ESP03_Heizung" after JsonList2
      fhem.0	2017-07-17 18:20:07.581	info	Unknown state "ESP03_Heizung.Swi
      fhem.0	2017-07-17 18:20:04.155	warn	Readings "Swi" still not found in "ESP03_Notlicht" after JsonList2
      fhem.0	2017-07-17 18:20:03.622	info	Unknown state "ESP03_Notlicht.Swi
      fhem.0	2017-07-17 18:20:03.133	warn	Readings "Swi" still not found in "ESP03_Innenlicht" after JsonList2
      fhem.0	2017-07-17 18:20:02.568	info	Unknown state "ESP03_Innenlicht.Swi
      host.raspberrypi	2017-07-17 18:20:01.139	info	Restart adapter system.adapter.javascript.0 because enabled
      host.raspberrypi	2017-07-17 18:20:01.137	error	instance system.adapter.javascript.0 terminated with code 0 (OK)
      javascript.0	2017-07-17 18:20:01.019	error	at Timer.listOnTimeout (timers.js:92:15)
      javascript.0	2017-07-17 18:20:01.019	error	at null._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:479:11)
      javascript.0	2017-07-17 18:20:01.019	error	at Job.invoke (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:175:10)
      javascript.0	2017-07-17 18:20:01.019	error	at Job.job (/opt/iobroker/node_modules/iobroker.javascript/javascript.js:1501:34)
      javascript.0	2017-07-17 18:20:01.019	error	at Object. (script.js.common.Astro:103:4)
      javascript.0	2017-07-17 18:20:01.019	error	at zeiten_speichern (script.js.common.Astro:63:44)
      javascript.0	2017-07-17 18:20:01.019	error	TypeError: Cannot read property 'toLocaleTimeString' of undefined
      javascript.0	2017-07-17 18:20:00.995	error	uncaught exception: Cannot read property 'toLocaleTimeString' of undefined
      javascript.0	2017-07-17 18:20:00.971	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:20:00.969	error	Longitude or latitude does not set. Cannot use astro.
      fhem.0	2017-07-17 18:20:00.412	warn	Readings "Cou" still not found in "ESP04_Gaszaehler" after JsonList2
      fhem.0	2017-07-17 18:20:00.343	warn	Unknown event "ESPEasy ESP03_Notlicht on"
      fhem.0	2017-07-17 18:20:00.314	warn	Unknown event "ESPEasy ESP03_Innenlicht off"
      fhem.0	2017-07-17 18:19:59.775	info	Unknown state "ESP04_Gaszaehler.Cou
      fhem.0	2017-07-17 18:19:57.120	warn	Readings "Swi" still not found in "ESP03_Aussenlicht" after JsonList2
      fhem.0	2017-07-17 18:19:56.556	info	Unknown state "ESP03_Aussenlicht.Swi
      fhem.0	2017-07-17 18:19:55.878	warn	Readings "Tem" still not found in "ESP03_Temperatur" after JsonList2
      fhem.0	2017-07-17 18:19:55.368	info	Unknown state "ESP03_Temperatur.Tem
      javascript.0	2017-07-17 18:19:39.299	info	script.js.common.Müllkalender2push: registered 0 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:19:39.286	info	Start javascript script.js.common.Müllkalender2push
      javascript.0	2017-07-17 18:19:39.281	info	script.js.common.Müllkalender: registered 1 subscription and 1 schedule
      javascript.0	2017-07-17 18:19:39.253	info	script.js.common.Müllkalender: Muellwarnung.GelbeTonne
      javascript.0	2017-07-17 18:19:39.252	info	script.js.common.Müllkalender: Muellwarnung.GrueneTonne
      javascript.0	2017-07-17 18:19:39.250	info	script.js.common.Müllkalender: Muellwarnung.BlaueTonne
      javascript.0	2017-07-17 18:19:39.248	info	script.js.common.Müllkalender: Muellwarnung.Reststoff
      javascript.0	2017-07-17 18:19:39.239	info	Start javascript script.js.common.Müllkalender
      javascript.0	2017-07-17 18:19:39.235	info	script.js.common.Hühnerstall: registered 4 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:19:39.214	info	Start javascript script.js.common.Hühnerstall
      javascript.0	2017-07-17 18:19:39.209	info	script.js.common.LowBat: registered 4 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:19:39.204	info	script.js.common.LowBat: lowbat(4):
      javascript.0	2017-07-17 18:19:39.047	info	Start javascript script.js.common.LowBat
      javascript.0	2017-07-17 18:19:39.034	info	script.js.common.Denon: registered 39 subscriptions and 0 schedules
      javascript.0	2017-07-17 18:19:39.021	error	script.js.common.Denon: ungültige IP Adresse
      javascript.0	2017-07-17 18:19:38.982	info	Start javascript script.js.common.Denon
      javascript.0	2017-07-17 18:19:38.975	info	script.js.common.Astro: registered 0 subscriptions and 9 schedules
      javascript.0	2017-07-17 18:19:38.953	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.953	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.952	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.952	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.951	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.951	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.950	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.948	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:38.919	info	Start javascript script.js.common.Astro
      javascript.0	2017-07-17 18:19:38.912	info	script.js.common.PoolPumpe: registered 2 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:19:38.812	info	Start javascript script.js.common.PoolPumpe
      javascript.0	2017-07-17 18:19:38.600	info	received all objects
      javascript.0	2017-07-17 18:19:37.748	info	received all states
      javascript.0	2017-07-17 18:19:35.912	info	requesting all objects
      javascript.0	2017-07-17 18:19:35.905	info	requesting all states
      javascript.0	2017-07-17 18:19:35.861	info	starting. Version 3.2.6 in /opt/iobroker/node_modules/iobroker.javascript, node: v4.6.2
      host.raspberrypi	2017-07-17 18:19:31.130	info	instance system.adapter.javascript.0 started with pid 997
      fhem.0	2017-07-17 18:19:30.282	warn	Readings "Cou" still not found in "ESP04_Gaszaehler" after JsonList2
      fhem.0	2017-07-17 18:19:29.746	info	Unknown state "ESP04_Gaszaehler.Cou
      fhem.0	2017-07-17 18:19:08.277	warn	Readings "Swi" still not found in "ESP03_Heizung" after JsonList2
      fhem.0	2017-07-17 18:19:07.506	info	Unknown state "ESP03_Heizung.Swi
      fhem.0	2017-07-17 18:19:04.032	warn	Readings "Swi" still not found in "ESP03_Notlicht" after JsonList2
      fhem.0	2017-07-17 18:19:03.563	info	Unknown state "ESP03_Notlicht.Swi
      fhem.0	2017-07-17 18:19:03.092	warn	Readings "Swi" still not found in "ESP03_Innenlicht" after JsonList2
      fhem.0	2017-07-17 18:19:02.503	info	Unknown state "ESP03_Innenlicht.Swi
      host.raspberrypi	2017-07-17 18:19:01.104	info	Restart adapter system.adapter.javascript.0 because enabled
      host.raspberrypi	2017-07-17 18:19:01.102	error	instance system.adapter.javascript.0 terminated with code 0 (OK)
      javascript.0	2017-07-17 18:19:01.014	error	at Timer.listOnTimeout (timers.js:92:15)
      javascript.0	2017-07-17 18:19:01.014	error	at null._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:479:11)
      javascript.0	2017-07-17 18:19:01.014	error	at Job.invoke (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:175:10)
      javascript.0	2017-07-17 18:19:01.014	error	at Job.job (/opt/iobroker/node_modules/iobroker.javascript/javascript.js:1501:34)
      javascript.0	2017-07-17 18:19:01.014	error	at Object. (script.js.common.Astro:103:4)
      javascript.0	2017-07-17 18:19:01.014	error	at zeiten_speichern (script.js.common.Astro:63:44)
      javascript.0	2017-07-17 18:19:01.014	error	TypeError: Cannot read property 'toLocaleTimeString' of undefined
      javascript.0	2017-07-17 18:19:00.991	error	uncaught exception: Cannot read property 'toLocaleTimeString' of undefined
      javascript.0	2017-07-17 18:19:00.962	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:19:00.960	error	Longitude or latitude does not set. Cannot use astro.
      fhem.0	2017-07-17 18:19:00.680	warn	Readings "Cou" still not found in "ESP04_Gaszaehler" after JsonList2
      fhem.0	2017-07-17 18:19:00.363	warn	Unknown event "ESPEasy ESP03_Notlicht on"
      fhem.0	2017-07-17 18:19:00.280	warn	Unknown event "ESPEasy ESP03_Innenlicht off"
      fhem.0	2017-07-17 18:18:59.715	info	Unknown state "ESP04_Gaszaehler.Cou
      fhem.0	2017-07-17 18:18:57.102	warn	Readings "Swi" still not found in "ESP03_Aussenlicht" after JsonList2
      fhem.0	2017-07-17 18:18:56.477	info	Unknown state "ESP03_Aussenlicht.Swi
      fhem.0	2017-07-17 18:18:55.818	warn	Readings "Tem" still not found in "ESP03_Temperatur" after JsonList2
      fhem.0	2017-07-17 18:18:55.290	info	Unknown state "ESP03_Temperatur.Tem
      javascript.0	2017-07-17 18:18:48.280	info	script.js.common.Müllkalender2push: registered 0 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:18:48.267	info	Start javascript script.js.common.Müllkalender2push
      javascript.0	2017-07-17 18:18:48.263	info	script.js.common.Müllkalender: registered 1 subscription and 1 schedule
      javascript.0	2017-07-17 18:18:48.228	info	script.js.common.Müllkalender: Muellwarnung.GelbeTonne
      javascript.0	2017-07-17 18:18:48.227	info	script.js.common.Müllkalender: Muellwarnung.GrueneTonne
      javascript.0	2017-07-17 18:18:48.225	info	script.js.common.Müllkalender: Muellwarnung.BlaueTonne
      javascript.0	2017-07-17 18:18:48.223	info	script.js.common.Müllkalender: Muellwarnung.Reststoff
      javascript.0	2017-07-17 18:18:48.214	info	Start javascript script.js.common.Müllkalender
      javascript.0	2017-07-17 18:18:48.210	info	script.js.common.Hühnerstall: registered 4 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:18:48.192	info	Start javascript script.js.common.Hühnerstall
      javascript.0	2017-07-17 18:18:48.187	info	script.js.common.LowBat: registered 4 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:18:48.183	info	script.js.common.LowBat: lowbat(4):
      javascript.0	2017-07-17 18:18:48.009	info	Start javascript script.js.common.LowBat
      javascript.0	2017-07-17 18:18:48.003	info	script.js.common.Denon: registered 39 subscriptions and 0 schedules
      javascript.0	2017-07-17 18:18:47.997	error	script.js.common.Denon: ungültige IP Adresse
      javascript.0	2017-07-17 18:18:47.962	info	Start javascript script.js.common.Denon
      javascript.0	2017-07-17 18:18:47.956	info	script.js.common.Astro: registered 0 subscriptions and 9 schedules
      javascript.0	2017-07-17 18:18:47.940	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.940	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.939	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.939	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.938	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.938	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.937	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.936	error	Longitude or latitude does not set. Cannot use astro.
      javascript.0	2017-07-17 18:18:47.907	info	Start javascript script.js.common.Astro
      javascript.0	2017-07-17 18:18:47.901	info	script.js.common.PoolPumpe: registered 2 subscriptions and 1 schedule
      javascript.0	2017-07-17 18:18:47.786	info	Start javascript script.js.common.PoolPumpe
      javascript.0	2017-07-17 18:18:47.619	info	received all objects
      javascript.0	2017-07-17 18:18:46.891	info	received all states
      javascript.0	2017-07-17 18:18:45.212	info	requesting all objects
      javascript.0	2017-07-17 18:18:45.204	info	requesting all states
      javascript.0	2017-07-17 18:18:45.161	info	starting. Version 3.2.6 in /opt/iobroker/node_modules/iobroker.javascript, node: v4.6.2
      
      1 Reply Last reply Reply Quote 0
      • paul53
        paul53 last edited by

        javascript.0   2017-07-17 18:18:47.936   error   Longitude or latitude does not set. Cannot use astro.
        

        Du solltest erst einmal die Koordinaten eingeben, damit die Funktion isAstroDay() funktionieren kann.

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

          Erzeuge erst einmal ein reines Test-Skript, damit wir über die Werte Bescheid wissen.

          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;
          
          log('Temp ' + temp + ' ' + typeof temp);
          log('Innen ' + aktor_Innenlicht + ' ' + typeof aktor_Innenlicht);
          log('Not ' + aktor_Notlicht + ' ' + typeof aktor_Notlicht);
          log('Heizung ' + aktor_Heizung + ' ' + typeof aktor_Heizung);
          
          
          1 Reply Last reply Reply Quote 0
          • N
            noxx last edited by

            sind drin, auch vorher schon.

            hatte iobroker gerade upgedatet (discovery/vis)

            nun spinnt er… wenns wieder läuft, kommt das LOG

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

              so

              22:12:56.811	[info]	javascript.0 Start javascript script.js.common.test
              22:12:56.815	[info]	javascript.0 script.js.common.test: Temp 18.5 number
              22:12:56.816	[info]	javascript.0 script.js.common.test: Innen Swi: off string
              22:12:56.816	[info]	javascript.0 script.js.common.test: Not Swi: off string
              22:12:56.818	[info]	javascript.0 script.js.common.test: Heizung Swi: off string
              22:12:56.819	[info]	javascript.0 script.js.common.test: registered 0 subscriptions and 0 schedules
              
              1 Reply Last reply Reply Quote 0
              • paul53
                paul53 last edited by

                Dann sollte das Skript an ein paar Stellen umgebaut werden.

                ! ````
                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 = false;
                if(getState(idAktor_Innenlicht).val.indexOf('on') != -1) aktor_Innenlicht = true;
                var aktor_Notlicht = false;
                if(getState(idAktor_Notlicht).val.indexOf('on') != -1) aktor_Notlicht = true;
                var aktor_Heizung = false;
                if(getState(idAktor_Heizung).val.indexOf('on') != -1) aktor_Heizung = true;
                var timer = null;
                ! function Zeitschaltung()
                {
                var nacht = compareTime('22:00', '06:00', 'between');
                if(nacht && !isAstroDay())
                {
                if(!aktor_Innenlicht) setState(idAktor_Innenlicht, true);
                }
                else if(aktor_Innenlicht) setState(idAktor_Innenlicht, false);
                }
                ! function heizung()
                {
                if (temp < 0)
                {
                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({id: idAktor_Innenlicht, ack: true}, function(dp) {
                if(typeof dp.state.val == 'string') {
                if(dp.state.val.indexOf('on') != -1) aktor_Innenlicht = true;
                else aktor_Innenlicht = false;
                }
                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({id: idAktor_Notlicht, ack: true}, function(dp) {
                if(typeof dp.state.val == 'string'){
                if(dp.state.val.indexOf('on') != -1) aktor_Notlicht = true;
                else aktor_Notlicht = false;
                }
                });
                ! on({id: idAktor_Heizung, ack: true}, function(dp) {
                if(typeof dp.state.val == 'string') {
                if(dp.state.val.indexOf('on') != -1) aktor_Heizung = true;
                else aktor_Heizung = false;
                }
                });

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

                  @paul53:

                  Allerdings hätte ich erwartet, dass der FHEM-Adapter diese Anpassungen vornimmt. `
                  Habe mir den FHEM-Adapter mal angesehen und festgestellt, dass der Adapter die Anpassung macht: ' on' –> true, ' off' --> false.

                  Allerdings kann er er mit 'Swi: on' und 'Swi: off' nichts anfangen. Woher kommt das 'Swi:' ? Hast Du eventuell die FHEM-Namenskonventionen nicht beachtet ?

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

                    Bekomme immer noch einen Fehler bei deiner Anpassung

                    javascript.0	2017-07-18 19:08:16.743	error	at script.js.common.Hühnerstall:112:37
                    javascript.0	2017-07-18 19:08:16.743	error	script.js.common.Hühnerstall: TypeError: getState(...).val.indexOf is not a function
                    javascript.0	2017-07-18 19:08:16.683	warn	Cannot calculate "night" for 53.0000, 7.0000
                    javascript.0	2017-07-18 19:08:16.679	warn	Cannot calculate "nightEnd" for 53.0000, 7.0000
                    javascript.0	2017-07-18 19:08:16.676	warn	Cannot calculate "night" for 53.0000, 7.0000
                    javascript.0	2017-07-18 19:08:16.613	info	Start javascript script.js.common.Hühnerstall
                    

                    sowie diese Warnung

                    javascript.0	2017-07-18 21:09:44.246	warn	Wrong type of fhem.0.ESP03_Notlicht.state: "boolean". Please fix, while deprecated and will not work in next versions.
                    

                    > Hast Du eventuell die FHEM-Namenskonventionen nicht beachtet ?
                    Wo? Wird eigentlich alles von selbst erkannt, habe nichts einstellen müssen.

                    Sehe aber, das das SWI aus dem FHEM Modul kommt. Muss mal gucken, wie man das

                    ändert
                    2880_unbenannt.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            740
                                            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