Ankündigung

Einklappen
Keine Ankündigung bisher.

- √ - Use of sh.sunrise and sh.sunset in logics?

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    - √ - Use of sh.sunrise and sh.sunset in logics?

    Hello.
    I'm planning to make a litte logic script for the outside light - based on the sunrise / sunset function.

    But as i can read it, the sh.sunset abd sh.sunrise is only available through crontab?

    Wouldn't be possible to use inside a logic?
    I think it should work something like:
    On at 06:00 and off again at sunrise - then on again on sunset until 24:00 - if i make that in crontab, i need to have multiple logics?

    The sunrise/sunset is only run one time? So i can't set my logics for cycle = 5 and hope it "graps" the sunset command?

    if i do like in the sample
    Code:
    crontab = 17:00<sunset  # sunset, but not bevor 17:00 (locale time)
    crontab = sunset<20:00  # sunset, but not after 20:00 (locale time)
    crontab = 17:00<sunset<20:00  # sunset, beetween 17:00 and 20:00
    will it then only execute the logics sunset<20.00 if sunset comes before 20.00 and then not run after that? meaning it wouldn't turn off again?

    #2
    You can use crontab on items as well, maybe that is better for your use case than using it with a logic.

    Zitat von Rasmus7700 Beitrag anzeigen
    will it then only execute the logics sunset<20.00 if sunset comes before 20.00 and then not run after that? meaning it wouldn't turn off again?
    this means at 20 o'clock or at sunset, whatever comes first

    EDIT: you can even use the item value in the crontab, for example (untested):

    crontab = 0 6 * * = 1 | sunrise = 0 | sunset = 1 | 0 0 * * = 0
    Mit freundlichen Grüßen
    Niko Will

    Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
    - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

    Kommentar


      #3
      Okay, so if I set crontab=06=sh.outside.light=1 |sh.sunrise = sh.outside.light=0 and so on? Or how?

      Kommentar


        #4
        you use it directly at the item configuration

        Code:
        [outside]
            [[light]]
                type = bool
                knx_dpt = 1
                knx_send = 1/2/3
                crontab = 0 6 * * = 1 | sunrise = 0 | sunset = 1 | 0 0 * * = 0
        But attention, this one switches the light on at 6 o'clock... if the sunrise was before that, it will not switch it off until the evening.
        Mit freundlichen Grüßen
        Niko Will

        Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
        - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

        Kommentar


          #5
          Oki, that sounds great... What if i want weekdays in it also? like in the weekend the light should stay on longer?

          Isn't possible to use the crontab inside the logics?

          Code:
          [outside]
          	[[light]]
          		[[[spots_on_off]]]
          		type=bool
          		visu_acl=rw
          		crontab = sunset+00:30=1 | 00** = 0
          		knx_dpt=1
          		knx_listen=2/1/0
          		knx_send=2/1/0
          		knx_init=2/1/0
          Shouldn't the upper case work? I can't see any trigger in my sh.py deamon... I wanted to add 30 minutes to the sunset....

          Kommentar


            #6
            All of this is in the documentation: Configuration ? SmartHome.py 1.0 documentation

            an offset in minutes specified by a ‘m’ e.g. crontab = sunset-10m
            The values for crontab for specific times has to be separated by a whitespace.

            Wrong:

            Code:
            crontab = 00** = 0
            Right:

            Code:
            crontab = 0 0 * * = 0
            from the docu, too:

            crontab = minute hour day wday

            minute: single value from 0 to 59, or comma separated list, or * (every minute)
            hour: single value from 0 to 23, or comma separated list, or * (every hour)
            day: single value from 0 to 28, or comma separated list, or * (every day) Please note: dont use days greater than 28 in the moment.
            wday: weekday, single value from 0 to 6 (0 = Monday), or comma separated list, or * (every day)
            if you want a different time on weekdays and the weekend you need to specify the last parameter of crontab

            Code:
            crontab = 0 22 * 0,1,2,3,4 = 0 | 0 23 * 5,6 = 0
            switches the light off at 22 o'clock on weekdays and at 23 o'clock on weekends.
            Mit freundlichen Grüßen
            Niko Will

            Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
            - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

            Kommentar


              #7
              Arhh... thanks a lot

              So the crontab can be used for allmost everything, and is evalved everytime the system changes time?

              Kommentar


                #8
                No, it is calculated at the init of each item/logic when it should change the value for the next time. For this point in time an entry is added to the scheduler. After the scheduler actually changed the specific item, the next change is calculated and again added to the scheduler.
                Mit freundlichen Grüßen
                Niko Will

                Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
                - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

                Kommentar


                  #9
                  Okay, this means if i make the crontab time changeable with an item, then it will cause a delay, since it will run the scheduled time, then next time it will calculate the time based on the new values?
                  Or if i Stop the HS,and start again - it will see the new times?

                  Kommentar


                    #10
                    Good question... I think Marcus has to answer it because I don't know and I have no time to look at the source, sorry.
                    Mit freundlichen Grüßen
                    Niko Will

                    Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
                    - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

                    Kommentar


                      #11
                      You can't change the crontab value for an item.
                      Furthermore non-value changes to an item wouldn't survive a restart.

                      Kommentar


                        #12
                        Thanks a lot - that solved my question

                        Kommentar

                        Lädt...
                        X