Macro which queries the clock

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • marcuslee
    Automated Home Ninja
    • Dec 2009
    • 279

    Macro which queries the clock

    Hi All,

    Anyone know of a way to create a macro, when that when triggered, checks the time (and does something based on it)?

    In this case, I want to connect it to an outside light level sensor, such that when it goes dark in the evening, if it's within a particular time range, to turn on some driveway lights.

    Cheers,

    Marcus
  • chris_j_hunter
    Automated Home Legend
    • Dec 2007
    • 1713

    #2
    we'd use General Logic for this, with a TimeWindow gate in the logic …

    Tools … General Logic … … Add … Time Window … Add … AND …
    Last edited by chris_j_hunter; 13 March 2014, 10:45 AM.
    Our self-build - going further with HA...

    Comment

    • marcuslee
      Automated Home Ninja
      • Dec 2009
      • 279

      #3
      Originally posted by chris_j_hunter View Post
      we'd use General Logic for this, with a TimeWindow gate in the logic …

      Tools … General Logic … … Add … Time Window … Add … AND …

      Ohh interesting (not come across this Time Window GL before). Thanks Chris!

      Comment

      • Karam
        Automated Home Legend
        • Mar 2005
        • 863

        #4
        There is an existing behaviour for the light object (At lighting up time and dark to turn on, lighting off time to turn off). Or would this not cover the full requirement?

        Comment

        • mcockerell
          Automated Home Sr Member
          • Jan 2009
          • 74

          #5
          I use that mode of operation for the lamppost in the driveway, but this only gives one operating period (this is every evening for us).
          I then have a virtual light object set to switch only on light level that is enabled and disabled by events - these are set for appropriate times on weekday mornings.
          The virtual light object is connected to the follow state input of the lamppost light object, so triggers it on for dark mornings - thanks to Karam for explaining how to do this.
          The advantage of this approach is that I have also been able to set a separate event which turns the lamppost on earlier on the morning that my wife has a very early start.

          Hope this helps.

          Comment

          • marcuslee
            Automated Home Ninja
            • Dec 2009
            • 279

            #6
            Originally posted by m****erell View Post
            I use that mode of operation for the lamppost in the driveway, but this only gives one operating period (this is every evening for us).
            I then have a virtual light object set to switch only on light level that is enabled and disabled by events - these are set for appropriate times on weekday mornings.
            The virtual light object is connected to the follow state input of the lamppost light object, so triggers it on for dark mornings - thanks to Karam for explaining how to do this.
            The advantage of this approach is that I have also been able to set a separate event which turns the lamppost on earlier on the morning that my wife has a very early start.

            Hope this helps.
            Hmm thanks for replies, will look into it / see if I can get this to work.

            Comment

            • marcuslee
              Automated Home Ninja
              • Dec 2009
              • 279

              #7
              Originally posted by m****erell View Post
              I use that mode of operation for the lamppost in the driveway, but this only gives one operating period (this is every evening for us).
              I then have a virtual light object set to switch only on light level that is enabled and disabled by events - these are set for appropriate times on weekday mornings.
              The virtual light object is connected to the follow state input of the lamppost light object, so triggers it on for dark mornings - thanks to Karam for explaining how to do this.
              The advantage of this approach is that I have also been able to set a separate event which turns the lamppost on earlier on the morning that my wife has a very early start.

              Hope this helps.
              Hmm I think this might be the best bet for what I'm trying to achieve (weekdays only, if it goes dark between 6 - 6:45pm, to turn on driveway light). However I can't seem to see a virtual light object to add?

              Thanks in advance,

              Marcus

              Comment

              • chris_j_hunter
                Automated Home Legend
                • Dec 2007
                • 1713

                #8
                virtual just means an object that's not been enabled - so, for a light, add a module of any type that has a relay, and add a Light in the usual way - the module has no physical reality, so don't enable it, and its virtual …
                Our self-build - going further with HA...

                Comment

                • Karam
                  Automated Home Legend
                  • Mar 2005
                  • 863

                  #9
                  You may find the legacy relay object is useful for creating such virtual objects

                  Comment

                  • marcuslee
                    Automated Home Ninja
                    • Dec 2009
                    • 279

                    #10
                    Originally posted by Karam View Post
                    You may find the legacy relay object is useful for creating such virtual objects
                    Thanks for everyone's assistance.

                    I'm looking into this, and I'm not sure if I can find a way to get this to work.

                    Specifically:
                    - I have an event scheduled that at 6:30pm every week day it checks if it's dark, if so, turn light on
                    - I have an event scheduled at 7:30pm every week day it turns light off

                    However I want to cover the possibility that in between 6:30 and 7:30pm, on week days, if it goes from bright to dark outside, it turns on the light.

                    Not sure how I can do this last bit?

                    Comment

                    • Viv
                      Automated Home Ninja
                      • Dec 2004
                      • 284

                      #11
                      Using a real light object i.e one that is connected to the light.
                      Set the light Operating Mode to 'Use Light level, dark to turn on, bright to turn off...'.

                      In the Scheduler create an entry to 'Enable' the light when you want it to automate (could come on if dark).
                      Similalry create and entry to 'Disable' when you do not want it to be on.

                      So you can create a period between 6:30pm and 7:30pm on week days only when if its dark it will come on and if bright not (or turn off).

                      Viv

                      Comment

                      • chris_j_hunter
                        Automated Home Legend
                        • Dec 2007
                        • 1713

                        #12
                        interesting - does that imply it's possible to have two separate Light objects connected to one light, and switch between them by enabling & disabling ?
                        Our self-build - going further with HA...

                        Comment

                        • marcuslee
                          Automated Home Ninja
                          • Dec 2009
                          • 279

                          #13
                          Originally posted by Viv View Post
                          Using a real light object i.e one that is connected to the light.
                          Set the light Operating Mode to 'Use Light level, dark to turn on, bright to turn off...'.

                          In the Scheduler create an entry to 'Enable' the light when you want it to automate (could come on if dark).
                          Similalry create and entry to 'Disable' when you do not want it to be on.

                          So you can create a period between 6:30pm and 7:30pm on week days only when if its dark it will come on and if bright not (or turn off).
                          Thanks Viv.

                          And if I've interpreted your answer correctly, if we wanted these lights to also have the ability to operate manually via a button press (as they are driveway lights and I also have a key fob to operate them when we're coming home at night), to have that button to also actually enable/disable the master control.

                          And in the case that we did want the ability to have them switch on during the day (they're LED lights, so have been considering to double up their use to also use them for indication, eg maybe such as flashing twice when the house alarm is armed, flashing once when the house alarm is turned off), how would one best incorporate that (I'm thinking macro of some description)?



                          And if

                          Comment

                          • Viv
                            Automated Home Ninja
                            • Dec 2004
                            • 284

                            #14
                            Originally posted by marcuslee View Post
                            Thanks Viv.

                            And if I've interpreted your answer correctly, if we wanted these lights to also have the ability to operate manually via a button press (as they are driveway lights and I also have a key fob to operate them when we're coming home at night), to have that button to also actually enable/disable the master control.

                            And in the case that we did want the ability to have them switch on during the day (they're LED lights, so have been considering to double up their use to also use them for indication, eg maybe such as flashing twice when the house alarm is armed, flashing once when the house alarm is turned off), how would one best incorporate that (I'm thinking macro of some description)?

                            And if
                            In view of what you have said perhaps the following is more suitable.

                            Set the lights normal operating mode to 'Manual control only'.
                            The light may then be toggled and flashed as required by whatever means e.g Alarm.

                            Create a Macro
                            1. Send a value of 8 to the lights operating mode to switch it to 'Use Light level, dark to turn on, bright to turn off...' mode.
                            2. Wait time delay of one hour.
                            3. Send a value of 7 to the lights operating mode to switch it back to 'Manual control only'.
                            4. Trigger the Light to turn off to ensure it goes off (if it was brought on by dark state).

                            You can vist Lights connections help for details of values for Operating mode.

                            Configure the Event Scheduler to start the Macro at 6:30.

                            During the period between 6:30 and 7:30 you can still use the keyfob to force it on/off.

                            Viv

                            Comment

                            • marcuslee
                              Automated Home Ninja
                              • Dec 2009
                              • 279

                              #15
                              Originally posted by Viv View Post
                              In view of what you have said perhaps the following is more suitable.

                              Set the lights normal operating mode to 'Manual control only'.
                              The light may then be toggled and flashed as required by whatever means e.g Alarm.

                              Create a Macro
                              1. Send a value of 8 to the lights operating mode to switch it to 'Use Light level, dark to turn on, bright to turn off...' mode.
                              2. Wait time delay of one hour.
                              3. Send a value of 7 to the lights operating mode to switch it back to 'Manual control only'.
                              4. Trigger the Light to turn off to ensure it goes off (if it was brought on by dark state).

                              You can vist Lights connections help for details of values for Operating mode.

                              Configure the Event Scheduler to start the Macro at 6:30.

                              During the period between 6:30 and 7:30 you can still use the keyfob to force it on/off.
                              Hi Viv,

                              Thanks for reply. So even during the period it's set to use light level etc, objects which perform toggle action on the light, still operate, if I've read above correctly.

                              I'll give it a go!

                              Cheers,

                              Marcus

                              Comment

                              Working...
                              X