Menu

linknx 1.27 - Sunrise and sunset comparison

Help
Ben
2010-02-14
2012-12-14
  • Ben

    Ben - 2010-02-14

    Hi,

    I want to create a rule like this, but I don't known how :

    open shutters :
    - either at sunrise if sunrise > 8.00
    - nor at 8.00

    Thanks for your help.

    Ben

     
  • hd88

    hd88 - 2010-02-14

    Hello,
    I use:

      <services>
    <location lon="9.357208" lat="52.104018"/>
      </services>

      <rules>
         <rule id="rule_tag">
      <condition type="timer" trigger="true">
      <at type='sunrise' wdays='1234567' offset="0"/>
      <until type='sunset' wdays='1234567' offset="0"/>
      </condition>
      <actionlist>
      <action type="set-value" id="tag" value="on" />
      </actionlist>
      <actionlist type="on-false">
      <action type="set-value" id="tag" value="off" />
          </actionlist>
         </rule>
         <rule id="rule_nacht">
      <condition type="timer" trigger="true">
      <at type='sunset' wdays='1234567' offset="0"/>
      <until type='sunrise' wdays='1234567' offset="0"/>
      </condition>
      <actionlist>
      <action type="set-value" id="nacht" value="on" />
      </actionlist>
      <actionlist type="on-false">
      <action type="set-value" id="nacht" value="off" />
          </actionlist>
          </rule>
          <rule id="tag_on">
              <condition type="or">
              <condition type="object" id="tag" value="on" trigger="true" />
              </condition>
              <actionlist>
      <action type="set-value" id="daylight" value="on" />
              </actionlist>
          </rule>
          <rule id="nacht_on">
              <condition type="or">
              <condition type="object" id="nacht" value="on" trigger="true" />
              </condition>
              <actionlist>
      <action type="set-value" id="daylight" value="off" />
              </actionlist>
          </rule>
      </rules>

    Hans

     
  • Ben

    Ben - 2010-02-15

    Hello Hans,

    Thanks for your example, but it's not exactly what I'm looking for..
    I think my question was not clear enough, I try again:
    I would like my shutters to open at sunrise, but never before 8.00 o'clock.
    But I don't know how to compare "sunrise" and "8.00" inside a linknx rule…

    An idea ?

    Regards,

    Ben

     
  • chris_14

    chris_14 - 2010-02-15

    Hello Ben,

    I would guess, that the following will work as you asked:

            <rule id="rollo_hoch">
                <condition type="and">
                    <condition type="timer" trigger="true">
                        <at hour="8" min="0" />
                        <until hour="12" min="0" />
                    </condition>
                    <condition type="timer" trigger="true">
                        <at type="sunrise" offset="0"/> 
                        <until hour="12" min="0" />
                    </condition>
                </condition>
                <actionlist>
                    <action type="set-value" id="zentralsteuerung_rollos" value="1" />
                </actionlist>
            </rule>
    

    But the stuctured way from Hans is maybe a better way if you use more than one rules with sunrise an sunset functions.

    Best regards,
    Chris

     
  • Ben

    Ben - 2010-02-15

    Hi Chris,

    Thanks for your example.
    But in your case, if sunrise is before 8.00, shutters do not open, do they ?

    I'm going to try these rules:

    <rule id="aftereight_on">
          <condition type="timer" trigger="true">
            <at hour="8" min="0" exception="no" />
            <until hour="23" min="59" exception="no" />
          </condition>
          <actionlist type="if-true">
            <action type="set-value" id="aftereight_flag" value="on" />
          </actionlist>
        </rule>
        <rule id="aftereight_off">
          <condition type="timer" trigger="true">
            <at hour="0" min="0" exception="no" />
            <until hour="7" min="59" exception="no" />
          </condition>
          <actionlist type="if-true">
            <action type="set-value" id="aftereight_flag" value="off" />
          </actionlist>
        </rule>
        <rule id="daylight_on">
          <condition type="timer" trigger="true">
            <at type="sunrise" offset="-30m" />
            <until type="sunset" offset="30m" />
          </condition>
          <actionlist type="if-true">
            <action type="set-value" id="daylight_flag" value="on" />
          </actionlist>
        </rule>
        <rule id="daylight_off">
          <condition type="timer" trigger="true">
            <at type="sunset" offset="30m" />
            <until type="sunrise" offset="-30m" />
          </condition>
          <actionlist type="if-true">
            <action type="set-value" id="daylight_flag" value="off" />
          </actionlist>
        </rule>
        <rule id="ouverture_volets">
          <condition type="or">
            <condition type="timer" trigger="true">
              <at hour="10" min="0" wdays="67" exception="no" />
            </condition>
            <condition type="or">
              <condition type="and">
                <condition type="timer" trigger="true">
                  <at hour="8" min="0" wdays="12345" exception="no" />
                </condition>
                <condition type="object" id="daylight_flag" value="on" />
              </condition>
              <condition type="and">
                <condition type="timer" trigger="true">
                  <at type="sunrise" offset="-30m" wdays="12345" exception="no" />
                </condition>
                <condition type="object" id="aftereight_flag" value="on" />
              </condition>
            </condition>
          </condition>
          <actionlist>
            <action type="set-value" id="volets_move" value="off" />
          </actionlist>
        </rule>

    I'll give you my feedback.

    Bye.

    Ben

     
  • chris_14

    chris_14 - 2010-02-15

    Hi Ben,

    Thanks for your example.
    But in your case, if sunrise is before 8.00, shutters do not open, do they ?

    the actionlist will executed if both timer conditions become true. If the sunrise is before 8:00, the second condition (Timer 8 to 12) will become true at 8 o'clock and then both conditions are true and the actionlist will be executed.
    I haven't tested it but I think that it will function.

    Best regards
    Chris

     
  • Ben

    Ben - 2010-02-15

    Thanks Chris, you're right!
    I'll test your solution.

    Ben

     
  • Ben

    Ben - 2010-02-17

    Hi,

    @Chris,

    My first test succeeded!
    Thanks again.

    @Hans,

    How to use sunset and sunrise variables inside à LUA script?
    Do you think it's possible?

    KR,

    Ben

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.