Jump to content

This seems wrong


donwe123

Recommended Posts

Posted

Newbie here trying to turn a device on and off within a period of time randomly so I did this:

 

--------------------------------------------------------------------------------

To turn on Lamp_Hall

 

schedule 1:

 

If

From Sunset

To 11:00PM

 

Then

Repeat 16 times (Random)

Set 'Lamp_Hall' On

 

Else

-No Action-

 

--------------------------------------------------------------------------------

To turn off Lamp_Hall

 

schedule 2:

 

If

From Sunset

To 11:00PM

 

Then

Repeat 8 times (Random)

Set 'Lamp_Hall' Off

 

Else

-No Action-

 

--------------------------------------------------------------------------------

 

It seems to turn on and off but it under status it shows idle:false

 

Been playing with this for a while but unfornately not good at any programming languages. I'd appreciate any help anyone offers. Thanks in advance.

Posted

These programs are both fine, although if the time is between sunset and 11:00PM it should show 'Idle: True'.

 

Do the time and/or sunset/sunrise times appear correct?

 

The sunset/rise times are off by one hour due to DST changeover, and thus make sure to go to configuration 'Synch the clock with computers time'. (This is a bug and is fixed for the next drop).

Posted

Thank you Chris for the super fast reply. That's why people are saying you guys are the best in the indusdry.

 

In response to the time and/or sunset/sunrise, they are correct and I have no problems. So it seems that if I check the Random box, status will show idle:true if current time falls in/between time set, and status will show idle:false if current time falls outside of time set. Is that correct?

Posted

You should see 'Idle: True' if the current time is in between time range, and 'Idle: False' if the current time falls outside the time range, regardless of the 'Random Box' or any other actions you may have.

 

Only the conditions in the 'If' control whether a program is True or False, the actions have no bearing on this.

Posted

Thank you. How about this to make Appliance_1 on and off randomly within a given time:

 

------------------------------------------------------

To turn on:

 

If

From Sunset

For 2 hours and 2 minutes

 

Then

Wait 20 minutes (Random)

Repeat 16 times (Random)

Set 'Appliance_1' On

 

Else

- No Actions - (To add one, press 'Action')

 

------------------------------------------------------

To turn off:

 

If

From Sunset

For 2 hours and 8 minutes

 

Then

Wait 35 minutes (Random)

Repeat 9 times (Random)

Set 'Appliance_1' Off

 

Else

- No Actions - (To add one, press 'Action')

 

------------------------------------------------------

 

Thanks again.

Posted

I think you are looking for something like this. This turns the light on at some time 20 minutes to an hour after Sunset, and turns it off 2 hours to 2 hours and 40 minutes later.

 

If
       Time is Sunset  + 20 minutes

Then
       Wait  40 minutes  (Random)
       Set 'Appliance_1' On
       Wait  2 hours 
       Wait  40 minutes  (Random)
       Set 'Appliance_1' Off

Else
  - No Actions - (To add one, press 'Action')

Posted

Your example shows that Appliance_1 is turned on and off once randomly within a given time. Can you show me an example to turned on and off Appliance_1 multiple times randomly within a given time?

Posted

donwe123,

 

Can you show me an example to turned on and off Appliance_1 multiple times randomly within a given time?

 

This example turns 'Appliance_1' on and off multiple times randomly between sunset + 20 minutes to 11:30 PM every day.

 

You can adjust the wait times if you want it to turn on/off more frequently.

The 'Else' guarantees that the 'Appliance_1' will be turned off at 11:30PM

 

If
       From    Sunset  + 20 minutes
       To      11:30:00PM (same day)

Then
       Repeat Every  0 seconds
          Wait  10 minutes  (Random)
          Set 'Appliance_1' On
          Wait  20 minutes
          Wait  10 minutes  (Random)
          Set 'Appliance_1' Off

Else
       Set 'Appliance_1' Off

Posted

Thank you Chris and Mark. This has to be one of the friendliest forum anywhere.

 

Chris, your example above is beautiful. In regards to adjusting the wait times if I want it to turn on/off more frequently, I would really like to but I am really not good at programming languages. Can you please tell me what 'Repeat Every 0 seconds' does? And how do I adjust the wait times to turn on/off more frequently?

Posted

Chris, I think I got it! When you said I can adjust the wait times if I want it to turn on/off more frequently, I think it means that I can shorten the wait time even more so that device will turn on/off more frequently within that given time. Did I get it :lol: ?

Posted

The 'Repeat' action repeats all actions following it, up to the end of the list or the next 'Repeat' action.

 

Repeat Every X minutes repeats all actions following it every X minutes. If more than X minutes have elapsed when the list of actions is finished, then it repeats right away, otherwise it waits however much time is remaining and the repeats it.

 

To adjust the wait time, adjust the number of minutes (or seconds) in the 'Wait' actions.

 

In general, to wait between a range of time you would use two 'Wait' actions. For example, to wait between 20 and 30 minutes you would use:

          Wait  20 minutes 
          Wait  10 minutes  (Random) 

 

To wait between 10 and 15 minutes you would change it to:

          Wait  10 minutes 
          Wait  5 minutes  (Random) 

  • 5 months later...
Posted

If

       From    Sunset  + 20 minutes

       To       2:00:00AM (next day)

Then

       Wait  20 minutes  (Random)

       Set 'Bathroom Vanity' On

       Repeat 15 times

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' Off

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' On

Else

       Wait  15 minutes  (Random)

       Repeat 3 times

          Set 'Bathroom Vanity' Off

          Wait  2 seconds (Random)

 

I am trying to refine this code. This is the template for my "Lived -In" away look. I have a program similar to this for each light that is part of the away look.

 

Questions:

1. Is the 2.00am (next day) the proper code for this program to go false about 6 hours after going true (in the summer anyway)?

 

2. Could I change the repeat so the code would be:

 

If

       From    Sunset  + 20 minutes

       To       2:00:00AM (next day)

Then

       Wait  20 minutes  (Random)

       Set 'Bathroom Vanity' On

       Repeat Every  0 seconds

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' Off

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' On

Else

       Wait  15 minutes  (Random)

       Repeat 3 times

          Set 'Bathroom Vanity' Off

          Wait  2 seconds (Random)

 

I feel like this will not repeat at all (the repeat 0 seconds scares me), but from Chris' example this should work, no? I like the repeat every 0 seconds as I do not have to put a large repeat in there. I know that with a 15 times repeat it will work, but again I am trying to refine my programming.

 

Chris, so 'repeat every 0 seconds' is nothing like 'repeat 0 times'? I know from reading other posts that 'repeat 0 times' effectively comments out programming lines, but are you saying that 'repeat every 0 seconds' does not?

 

The wait 2 seconds (Random) at the end is for the X-10 lights mostly as I use this as a template for all my lights that I have not yet converted over to Insteon. This way if there is a transmission collision with another command the request gets resent.

 

Oh, even more refined! Looking over my post I think I could change the code to be:

 

If

       From    Sunset 

       To       2:00:00AM (next day)

Then

       Repeat Every  0 seconds

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' On

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' Off

Else

       Wait  15 minutes  (Random)

       Repeat 3 times

          Set 'Bathroom Vanity' Off

          Wait  2 seconds (Random)

This would do exactly what the first set of code did but with much less programming, right?

Posted

Questions:

1. Is the 2.00am (next day) the proper code for this program to go false about 6 hours after going true (in the summer anyway)?

Yes

 

I feel like this will not repeat at all (the repeat 0 seconds scares me), but from Chris' example this should work, no? I like the repeat every 0 seconds as I do not have to put a large repeat in there. I know that with a 15 times repeat it will work, but again I am trying to refine my programming.

 

Chris, so 'repeat every 0 seconds' is nothing like 'repeat 0 times'? I know from reading other posts that 'repeat 0 times' effectively comments out programming lines, but are you saying that 'repeat every 0 seconds' does not?

'Repeat Every 0 seconds' loops like you would expect; it loops until the program is stopped, or the Then or Else is run again.

 

The wait 2 seconds (Random) at the end is for the X-10 lights mostly as I use this as a template for all my lights that I have not yet converted over to Insteon. This way if there is a transmission collision with another command the request gets resent.

Not sure why you are using the (Random) option here for your two seconds.

 

Oh, even more refined! Looking over my post I think I could change the code to be:

 

If

       From    Sunset 

       To       2:00:00AM (next day)

Then

       Repeat Every  0 seconds

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' On

          Wait  20 minutes 

          Wait  20 minutes  (Random)

          Set 'Bathroom Vanity' Off

Else

       Wait  15 minutes  (Random)

       Repeat 3 times

          Set 'Bathroom Vanity' Off

          Wait  2 seconds (Random)

This would do exactly what the first set of code did but with much less programming, right?

 

Yes, looks good.

Posted

The 2 second random is because I have lots of lights using this template. If two off (X-10) requests happen to coincide the ISY will try each again at a slightly different time.

 

Oh, wait! The only way two X-10 signals can collide is if they are sent from different transmitters simultaneously, and that can not happen here because the ISY uses only one transmitter. Doh... Okay that was pretty stupid. I will take the random 2 sec out when I clean up my start times and repeat 15 times.

 

Thanks for getting back to me. I did also notice that in the end I ended up with almost exactly what you had posted earlier in this topic. Sometimes the ISY is so powerful with it's command set it can be hard to think about how little needs to be coded. Reading that post the first time I guess the power of those few lines did not sink in. I had to go the hard way myself to understand. The first version of my "Away-Look" template had each on and off cycle written as a separate line. After getting my head around it I have ended up with this very simple looking code that does exactly the same thing with 90% fewer code lines.

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...