Announcement

Collapse
No announcement yet.

Setting up a reminders event?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I don't want to hijack someone elses thread so I've started a new one here regarding my script.

    http://board.homeseer.com/showthread...=1#post1034128
    Real courage is not securing your Wi-Fi network.

    Comment


      #17
      I wanted to do the same for recycling which is every other week on Mon. There doesn't seem to be even/odd week function in HomeSeer :-( and even/odd day doesn't work since its mapping will change once month changes.


      There are some scripts in the forum on how to do this but I figured out how to use virtual device + two simple events. Hope you find this useful.


      Once virtual device is set (you set initial value based on the day you enabled it, events toggle it back-and-forth) you can build reminders based on time/day etc... To avoid race I put in delay into device toggle. So first both events are evaluated w/ conditions, only one toggle gets scheduled and executed in 3 mins. Since there is no if-then-else capability (or toggle command) in actions this achieves it in a roundabout way.



      1) Create virtual device "RECYCLE STATUS" with two states
      (YES/NO ... or your choice)

      2) Build two conditional events. My trigger at Tue 12:02AM.
      One triggers if virtual device is ON, another if OFF.
      Each events executes device command to reverse status
      (i.e. change state to OFF, ON) respectively *with* 3 minute delay.



      Now you have virtual device that will toggle its state every other week.
      Set its initial value by running appropriate event and you are done.
      Build events that trigger on virtual device state changes if you wish or just read out state when you need to know what week it is.

      SECOND SOLUTION using one virtual device and one event w/ script
      ==================================================
      I got into scripting since I needed alarm clock that shows up in default/stock HS-Touch so I learned recycle reminder can be done in fewer events.



      1) Create virtual device "RECYCLE STATUS" with two states
      (value 1/0 = status YES/NO ... or your choice). This was device A7 for my example below.

      2) Build one recurring event. My triggers at Tue 12:02AM.
      It executes below script that does toggle in one shot.
      When you name the script in event GUI make sure to use .vb extension.


      Sub Main(parm as object)

      if hs.DeviceValue("A7")=0 then hs.SetDeviceValue("A7",1) else hs.SetDeviceValue("A7",0)

      End Sub
      Last edited by Person; December 26, 2012, 10:54 PM. Reason: More info added

      Comment


        #18
        Originally posted by Person View Post
        2) Build one recurring event. My triggers at Tue 12:02AM.
        It executes below script that does toggle in one shot.
        When you name the script in event GUI make sure to use .vb extension.


        Sub Main(parm as object)

        if hs.DeviceValue("A7")=0 then hs.SetDeviceValue("A7",1) else hs.SetDeviceValue("A7",0)

        End Sub
        A quicker alternative is
        A7 = math.abs(A7-1)

        This toggles A7 between 0 and 1 because abs(-1) = 1

        Scott

        Comment

        Working...
        X