Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. English
    3. Scripting / Logic
    4. Blockly
    5. ASTRO function. Does not work again

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    ASTRO function. Does not work again

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

      I set the location to:
      f3d7b00c-ab64-48fe-8942-36c7cc69687f-image.png
      3a491ea1-9d37-442a-802b-70f06030008f-image.png
      ssh on HOST sudo reboot -h now
      Run this Blockly:

      <xml xmlns="http://www.w3.org/1999/xhtml">
       <block type="create" id="v72H-N1#%w_zseA#CMc" x="-212" y="-38">
         <field name="NAME">01-Nachtende</field>
         <statement name="STATEMENT">
           <block type="create" id="@kYi)AXak/ydmJCF!oo]">
             <field name="NAME">02-Morgendämmerung</field>
             <statement name="STATEMENT">
               <block type="create" id=";T8PP:ZCKeM4+U5?yi">
                 <field name="NAME">03-Sonnenaufgang</field>
                 <statement name="STATEMENT">
                   <block type="create" id="gIfB:POQ4@(+!BTUapf">
                     <field name="NAME">04-Sonneneaufgang_Ende</field>
                     <statement name="STATEMENT">
                       <block type="create" id="MFJk^e%f2^,QG[vUK4ee">
                         <field name="NAME">05-Golden_Houer_Ende</field>
                         <statement name="STATEMENT">
                           <block type="create" id="hO7B(a7I~WK~vu8.7gDH">
                             <field name="NAME">06-Mittag</field>
                             <statement name="STATEMENT">
                               <block type="create" id="eYe;t8x=FwBT4B,.|k.">
                                 <field name="NAME">07-Golden_Houer</field>
                                 <statement name="STATEMENT">
                                   <block type="create" id="tVROR/kUT3MINh%SOcdY">
                                     <field name="NAME">08-Sonnenuntergang_Anfang</field>
                                     <statement name="STATEMENT">
                                       <block type="create" id="kCb|+j}(0FzG/abd,q1">
                                         <field name="NAME">09-Sonnenuntergang</field>
                                         <statement name="STATEMENT">
                                           <block type="create" id="4UBzNj{JG:saTpO/G">
                                             <field name="NAME">10-Abenddämmerung</field>
                                             <statement name="STATEMENT">
                                               <block type="create" id="%kf8::E|Nt2icPYM.aB">
                                                 <field name="NAME">11-Nacht</field>
                                                 <statement name="STATEMENT">
                                                   <block type="create" id="m8=S(!$%YPfP56~qYN-V">
                                                     <field name="NAME">12-Nadir</field>
                                                   </block>
                                                 </statement>
                                               </block>
                                             </statement>
                                           </block>
                                         </statement>
                                       </block>
                                     </statement>
                                   </block>
                                 </statement>
                               </block>
                             </statement>
                           </block>
                         </statement>
                       </block>
                     </statement>
                   </block>
                 </statement>
               </block>
             </statement>
           </block>
         </statement>
         <next>
           <block type="on_ext" id="CJC}fNA0]pCZXm3|IQhw">
             <mutation items="1"></mutation>
             <field name="CONDITION">any</field>
             <field name="ACK_CONDITION"></field>
             <value name="OID0">
               <shadow type="field_oid" id="~WnQKdX*p;3`gh]~Gv|}">
                 <field name="oid">default</field>
               </shadow>
               <block type="field_oid" id="sLj^7q(fyKCJ@uKYgne@">
                 <field name="oid">javascript.0.Datenpunkte_own.Alarm.Alarm_AUS</field>
               </block>
             </value>
             <statement name="STATEMENT">
               <block type="debug" id="^Q)xU7M#5MVip9{Y2$hP">
                 <field name="Severity">log</field>
                 <value name="TEXT">
                   <shadow type="text" id="%kcngJ7d=5*$asYlS~T|">
                     <field name="TEXT">03_Astro test start</field>
                   </shadow>
                 </value>
                 <next>
                   <block type="update" id="QIMsUa0@3?Vo;jj}r-U">
                     <mutation delay_input="false"></mutation>
                     <field name="OID">javascript.0.01-Nachtende</field>
                     <field name="WITH_DELAY">FALSE</field>
                     <value name="VALUE">
                       <block type="convert_from_date" id="^E3;~IY|ubg5}Cw9eYrO">
                         <mutation format="false" language="false"></mutation>
                         <field name="OPTION">hh:mm:ss</field>
                         <value name="VALUE">
                           <block type="time_astro" id="J0d,%PB7t8lb@8mXXXZ(">
                             <field name="TYPE">nightEnd</field>
                             <field name="OFFSET">0</field>
                           </block>
                         </value>
                       </block>
                     </value>
                     <next>
                       <block type="update" id="HB^8MQ(4ds+W5/u^OW4m">
                         <mutation delay_input="false"></mutation>
                         <field name="OID">javascript.0.02-Morgendämmerung</field>
                         <field name="WITH_DELAY">FALSE</field>
                         <value name="VALUE">
                           <block type="convert_from_date" id="oN=Uv}fYcHBCDPHtpXiw">
                             <mutation format="false" language="false"></mutation>
                             <field name="OPTION">hh:mm:ss</field>
                             <value name="VALUE">
                               <block type="time_astro" id=":/y;e5awTDC:Cev;TUCS">
                                 <field name="TYPE">dawn</field>
                                 <field name="OFFSET">0</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <next>
                           <block type="update" id="+A7|YpLw]g_!(9]PC@UH">
                             <mutation delay_input="false"></mutation>
                             <field name="OID">javascript.0.03-Sonnenaufgang</field>
                             <field name="WITH_DELAY">FALSE</field>
                             <value name="VALUE">
                               <block type="convert_from_date" id="AMyc:3Tp9XP+4kq(nv-">
                                 <mutation format="false" language="false"></mutation>
                                 <field name="OPTION">hh:mm:ss</field>
                                 <value name="VALUE">
                                   <block type="time_astro" id=",4bKmH_J8szFEb.4u{OB">
                                     <field name="TYPE">sunrise</field>
                                     <field name="OFFSET">0</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="update" id="DwtR_scz+f42pEJ/sKn?">
                                 <mutation delay_input="false"></mutation>
                                 <field name="OID">javascript.0.04-Sonneneaufgang_Ende</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="convert_from_date" id="a~M9OAt|LRQe5:d]~}H?">
                                     <mutation format="false" language="false"></mutation>
                                     <field name="OPTION">hh:mm:ss</field>
                                     <value name="VALUE">
                                       <block type="time_astro" id="7/scA1O-iX|.x-iB_~X3">
                                         <field name="TYPE">sunriseEnd</field>
                                         <field name="OFFSET">0</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="update" id="F.Y:ABQw?pppVIMuzXC4">
                                     <mutation delay_input="false"></mutation>
                                     <field name="OID">javascript.0.05-Golden_Houer_Ende</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="convert_from_date" id="jgDe(t)05^f2gQyGIaI6">
                                         <mutation format="false" language="false"></mutation>
                                         <field name="OPTION">hh:mm:ss</field>
                                         <value name="VALUE">
                                           <block type="time_astro" id="]qS[Z+Pab*WUXun969T">
                                             <field name="TYPE">goldenHourEnd</field>
                                             <field name="OFFSET">0</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="update" id="FjU7x+vB-{|nz?Ntgi]B">
                                         <mutation delay_input="false"></mutation>
                                         <field name="OID">javascript.0.06-Mittag</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="convert_from_date" id="Ewd,fX4o;ftqhEAKr)^">
                                             <mutation format="false" language="false"></mutation>
                                             <field name="OPTION">hh:mm:ss</field>
                                             <value name="VALUE">
                                               <block type="time_astro" id="}2iN_uE[d~xeJMc]9~%p">
                                                 <field name="TYPE">solarNoon</field>
                                                 <field name="OFFSET">0</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="update" id="(slH?vH:Tx73fJ(J2HY]">
                                             <mutation delay_input="false"></mutation>
                                             <field name="OID">javascript.0.07-Golden_Houer</field>
                                             <field name="WITH_DELAY">FALSE</field>
                                             <value name="VALUE">
                                               <block type="convert_from_date" id="kh1//%:x4My;~kFU,E^">
                                                 <mutation format="false" language="false"></mutation>
                                                 <field name="OPTION">hh:mm:ss</field>
                                                 <value name="VALUE">
                                                   <block type="time_astro" id="~MgPI%%B44O6EzrHu._C">
                                                     <field name="TYPE">goldenHour</field>
                                                     <field name="OFFSET">0</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <next>
                                               <block type="update" id="g|Q7g?g_fO6AjzFr(le">
                                                 <mutation delay_input="false"></mutation>
                                                 <field name="OID">javascript.0.08-Sonnenuntergang_Anfang</field>
                                                 <field name="WITH_DELAY">FALSE</field>
                                                 <value name="VALUE">
                                                   <block type="convert_from_date" id="r6N{VKoWDb6,=S=QyNF">
                                                     <mutation format="false" language="false"></mutation>
                                                     <field name="OPTION">hh:mm:ss</field>
                                                     <value name="VALUE">
                                                       <block type="time_astro" id="!nNaC0sNkzDc_CZkch6">
                                                         <field name="TYPE">sunsetStart</field>
                                                         <field name="OFFSET">0</field>
                                                       </block>
                                                     </value>
                                                   </block>
                                                 </value>
                                                 <next>
                                                   <block type="update" id="5k::E!c_Nzjkf_4MU}_U">
                                                     <mutation delay_input="false"></mutation>
                                                     <field name="OID">javascript.0.09-Sonnenuntergang</field>
                                                     <field name="WITH_DELAY">FALSE</field>
                                                     <value name="VALUE">
                                                       <block type="convert_from_date" id=",z]tcWXKDj7^syvxRkU[">
                                                         <mutation format="false" language="false"></mutation>
                                                         <field name="OPTION">hh:mm:ss</field>
                                                         <value name="VALUE">
                                                           <block type="time_astro" id="e.#C/a~nk+lc9h!VRKIG">
                                                             <field name="TYPE">sunset</field>
                                                             <field name="OFFSET">0</field>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <next>
                                                       <block type="update" id="okk0X1l~(0(nUW+Re46b">
                                                         <mutation delay_input="false"></mutation>
                                                         <field name="OID">javascript.0.10-Abenddämmerung</field>
                                                         <field name="WITH_DELAY">FALSE</field>
                                                         <value name="VALUE">
                                                           <block type="convert_from_date" id="jT6:rKIF[@`bgdN2Ei+R">
                                                             <mutation format="false" language="false"></mutation>
                                                             <field name="OPTION">hh:mm:ss</field>
                                                             <value name="VALUE">
                                                               <block type="time_astro" id="CeiV[rNfs^|Wwo/^8]}L">
                                                                 <field name="TYPE">dusk</field>
                                                                 <field name="OFFSET">0</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                         <next>
                                                           <block type="update" id="y3QMbYJ8biR5l7@~Vd92">
                                                             <mutation delay_input="false"></mutation>
                                                             <field name="OID">javascript.0.11-Nacht</field>
                                                             <field name="WITH_DELAY">FALSE</field>
                                                             <value name="VALUE">
                                                               <block type="convert_from_date" id="5z?E1xsLp;YRIJ6YIaB!">
                                                                 <mutation format="false" language="false"></mutation>
                                                                 <field name="OPTION">hh:mm:ss</field>
                                                                 <value name="VALUE">
                                                                   <block type="time_astro" id="Y[SLp]Z~a7!a0aht:]j?">
                                                                     <field name="TYPE">night</field>
                                                                     <field name="OFFSET">0</field>
                                                                   </block>
                                                                 </value>
                                                               </block>
                                                             </value>
                                                             <next>
                                                               <block type="update" id="r4Pp!x8AYRH2ByxfJ-uj">
                                                                 <mutation delay_input="false"></mutation>
                                                                 <field name="OID">javascript.0.12-Nadir</field>
                                                                 <field name="WITH_DELAY">FALSE</field>
                                                                 <value name="VALUE">
                                                                   <block type="convert_from_date" id="70t2I`G4:U{os`6!_.!i">
                                                                     <mutation format="false" language="false"></mutation>
                                                                     <field name="OPTION">hh:mm:ss</field>
                                                                     <value name="VALUE">
                                                                       <block type="time_astro" id="s:0TbVo8LNISj)?5m=fr">
                                                                         <field name="TYPE">nadir</field>
                                                                         <field name="OFFSET">0</field>
                                                                       </block>
                                                                     </value>
                                                                   </block>
                                                                 </value>
                                                               </block>
                                                             </next>
                                                           </block>
                                                         </next>
                                                       </block>
                                                     </next>
                                                   </block>
                                                 </next>
                                               </block>
                                             </next>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
         </next>
       </block>
      </xml>
      

      got this:
      07542b6a-e1dd-4209-baf7-78d907b44770-image.png

      javascript was set to:
      80c4ed6b-a23a-4229-bdd1-6d817b2c3237-image.png

      A 3 Replies Last reply Reply Quote 1
      • A
        ap2017 @iomountain last edited by

        @iomountain Thanks! I will try again on new X64 computer with freshly loaded software.

        1 Reply Last reply Reply Quote 0
        • A
          ap2017 @iomountain last edited by

          @iomountain This script works fine when started, it creates objects, but I want to use ASTRO to turn ON my lights repeatably, that what I have trouble with.

          1 Reply Last reply Reply Quote 0
          • A
            ap2017 @iomountain last edited by

            @iomountain After all latest updates ASTRO seems to work fine. Don't exactly know what happened, but it works. Thank you for your help

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

              schön das es jetzt läuft, hab noch viel Spass mit iobroker.
              Vielleicht kannst du noch Deine Version posten und den Tread auf gelöst setzen.
              Viele Grüße
              Ralph

              1 Reply Last reply Reply Quote 1
              • A
                ap2017 last edited by ap2017

                Have this issue with ASTRO again after adding few different lights to control by ASTRO. Same problem as before, function ASTRO is ignored by the system - nothing in debug log.

                Here is my script:

                schedule({astro: "goldenHour", shift: 0}, function () {
                console.log('astro_on_golden_hour');
                // Florida Room
                setState("zwave.0.NODE7.SWITCH_MULTILEVEL.Level_1"/Level/, 99);
                // Living
                setState("zwave.0.NODE2.SWITCH_BINARY.Switch_1"/Switch/, true);
                // TV Room
                setState("zigbee.0.000b57fffebcfc39.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, true);
                // Office
                setState("zigbee.0.90fd9ffffe2bad6b.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, true);
                });
                schedule({astro: "dusk", shift: 0}, function () {
                console.log('astro_on_sunset');
                // Outside
                setState("zwave.0.NODE11.SWITCH_BINARY.Switch_1"/Switch/, true);
                // Front Door
                setState("zigbee.0.d0cf5efffe7d475c.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, true);
                });
                schedule("30 23 * * *", function () {
                console.log('schedule_off');
                // Florida Room
                setState("zwave.0.NODE7.SWITCH_MULTILEVEL.Level_1"/Level/, 0);
                // Living
                setState("zwave.0.NODE2.SWITCH_BINARY.Switch_1"/Switch/, false);
                // Outside
                setState("zwave.0.NODE11.SWITCH_BINARY.Switch_1"/Switch/, false);
                // TV Room
                setState("zigbee.0.000b57fffebcfc39.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, false);
                // Office
                setState("zigbee.0.90fd9ffffe2bad6b.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, false);
                // Front Door
                setState("zigbee.0.d0cf5efffe7d475c.state"/TRADFRI bulb E26 W opal 1000lm Switch state/, false);
                });
                // Basement Light
                on({id: "mysensors.0.9.3_DOOR.V_TRIPPED"/9.3_DOOR.V_TRIPPED/, val: true}, function (obj) {
                var value = obj.state.val;
                var oldValue = obj.oldState.val;
                setState("zwave.0.NODE15.SWITCH_BINARY.Switch_1"/Switch/, true);
                setState("zwave.0.NODE16.SWITCH_BINARY.Switch_1"/Switch/, true);
                });
                on({id: "mysensors.0.9.3_DOOR.V_TRIPPED"/9.3_DOOR.V_TRIPPED/, val: false}, function (obj) {
                var value = obj.state.val;
                var oldValue = obj.oldState.val;
                setState("zwave.0.NODE15.SWITCH_BINARY.Switch_1"/Switch/, false);
                setState("zwave.0.NODE16.SWITCH_BINARY.Switch_1"/Switch/, false);
                });

                1 Reply Last reply Reply Quote 0
                • C
                  cbr last edited by cbr

                  Hello everybody,

                  first of all I'm new to ioBroker (I installed it on a Raspberry Pi 4 just recently).
                  However I'm having a similar problem.

                  I have two scripts:

                  Switch by ping

                  var bool_NightTime;

                  function HS100_switch() {
                  if (bool_NightTime == true && getState("ping.0.raspberrypi.IP").val == true) {
                  setState("hs100.0.IP.state"/HS100_Arbeitszimmer/, true);
                  } else {
                  setState("hs100.0.IP.state"/HS100_Arbeitszimmer/, false);
                  }
                  }

                  bool_NightTime = compareTime(getAstroDate("sunrise", undefined, 0), getAstroDate("sunset", undefined, -20), "not between", null);
                  console.log(('NightTime: ' + String(('' + bool_NightTime))));

                  schedule({astro: "sunset", shift: -20}, function () {
                  console.log('Sonne untergegangen -20 Min');
                  bool_NightTime = true;
                  HS100_switch();
                  });

                  schedule({astro: "sunrise", shift: 0}, function () {
                  bool_NightTime = false;
                  HS100_switch();
                  });

                  on({id: "ping.0.raspberrypi.IP"/Rechnername/, change: "ne"}, function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                  HS100_switch();
                  });


                  Switch by power
                  var _const_val_PowerLimit, bool_NightTime;

                  function HS100_switch() {
                  if (getState("hs100.0.IP.power").val < _const_val_PowerLimit && bool_NightTime == true && getState("fb-checkpresence.0.presence").val == true) {
                  setState("hs100.0.IP.state"/HS100/, true);
                  } else {
                  setState("hs100.0.IP.state"/HS100/, false);
                  }
                  }

                  _const_val_PowerLimit = 90;
                  bool_NightTime = compareTime(getAstroDate("sunset", undefined, -20), '23:00', "between", null) && compareTime('22:30', null, "<", getAstroDate("sunset", undefined, -20));
                  console.log(('NightTime: ' + String(('' + bool_NightTime))));

                  schedule({astro: "sunset", shift: -20}, function () {
                  console.log('Sonne untergegangen -20 Min');
                  if (compareTime("22:30", "null", "<")) {
                  bool_NightTime = true;
                  }
                  HS100_switch();
                  });

                  schedule("0 23 * * *", function () {
                  bool_NightTime = false;
                  HS100_switch();
                  });

                  on({id: "hs100.0.IP.power"/HS110/, change: "ne"}, function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                  HS100_switch();
                  });

                  on({id: "fb-checkpresence.0.presence"/presence/, change: "ne"}, function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                  HS100_switch();
                  });

                  In both of them I use:

                  schedule({astro: "sunset", shift: -20}, function () {
                    console.log('Sonne untergegangen -20 Min');
                    /* additional code */
                  });
                  

                  However the astro function today only triggered for the "Switch by ping" script- see logfile:

                  2020-04-01 19:35:27.992  - ^[[32minfo^[[39m: javascript.0 (665) script.js.common.Switch_by_ping: Sonne untergegangen -20 Min
                  

                  Yesterday it was working for both scripts. (Also the days before it was already inconsistent - however I only had the "Switch by power" script at that time.)
                  I'm restarting my raspberry every night and only added the console.log by today so I cannot tell about the recent days.

                  Any idea what could cause this issue?

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    ap2017 @cbr last edited by

                    @cbr Any luck with astro? I was not using it for a while, got back to it - same issue, works intermittent. Some days it works, some does not. Where are you located? I was thinking this is related to iobroker incorrectly interpreting my astro location settings. I am in US, most other users in Europe and they are not complaning about it.

                    Thomas Braun 1 Reply Last reply Reply Quote 0
                    • Thomas Braun
                      Thomas Braun Most Active @ap2017 last edited by Thomas Braun

                      @ap2017 You have multiple triggers in you blockly. That is not possible.

                      A AlCalzone 2 Replies Last reply Reply Quote 0
                      • A
                        ap2017 @Thomas Braun last edited by

                        @Thomas-Braun What do you mean? Why?

                        Thomas Braun 1 Reply Last reply Reply Quote 0
                        • Thomas Braun
                          Thomas Braun Most Active @ap2017 last edited by

                          @ap2017 Do you still have two purple blocks on the left side of your blockly? Please upload a screenshot of the current version.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            ap2017 @Thomas Braun last edited by

                            @Thomas-Braun here we go, in two parts. Script works stable except for astro triggers.
                            d7fc246b-cab0-46ee-bba4-ab191b7546ca-image.png
                            f051097f-aec2-492e-adb8-05c300c5ed46-image.png

                            Thomas Braun 1 Reply Last reply Reply Quote 0
                            • Thomas Braun
                              Thomas Braun Most Active @ap2017 last edited by Thomas Braun

                              @ap2017
                              You should have only one trigger element per action.
                              Separate it into independent blocks.

                              1 Reply Last reply Reply Quote 1
                              • AlCalzone
                                AlCalzone Developer @Thomas Braun last edited by

                                @Thomas-Braun sagte in ASTRO function. Does not work again:

                                You have multiple triggers in you blockly. That is not possible.

                                That is not true. You can have as many as you like, but you should NEVER nest them.

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                964
                                Online

                                31.7k
                                Users

                                79.6k
                                Topics

                                1.3m
                                Posts

                                blockly
                                6
                                58
                                4946
                                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