Jump to content

Very basic programming question


Recommended Posts

Hi there,

I've been reading this old post: 

 and using it to start setting up some random programs.

I want to make sure I'm interpreting this correctly in a program I wrote below. So basically, if it's 10pm at nite, any time within 37 minutes of that, turn on "Plug in Unit". Is that how the wait 37 minutes (Random) works? What is the random interval - is it minutes? 5 minutes, etc? Once I get this nailed down, Can I then expand it to say when it turns off the living room overhead, wait a random time (2 to 4 minutes) to turn on the bedroom light?

Thanks!

image.png.2497fe33e307fabcf03b53757a9e54a0.png

Link to comment

Wait 37 minutes (Random)

Waits from 0 to 37 minutes at random each time.

Many times, two are used in pairs to set a minimum time.

Wait 5 minutes
Wait 10 Minutes (random)

Waits a random time from 5 minutes to 15 minutes.

 

 

I use a long sequence of getting out of bed, leaving lights on for my pseudo travels, looking outside,  then travelling to the basement and back turning off the lights behind me until I get back into bed.

Warning!!!  I did this years ago with an X10 system and neighbours that knew I was away that week, called the police and had a discussion whether to kick my door in or not.

Link to comment

So if I set this to run at 9pm and say wait 20 minutes (random) it could be 9:01. But you put that first Wait 5 minutes so it can't happen before 9:05? Why not just set it to run at 9:05? Maybe I'm not understanding the double wait.

I did just figure out how to have it email me confirmation that things ran with a custom content in the subject and all. I'd like to have it say what the state of X device is in the body too but I'm still working through that. This stuff is cool!!

Link to comment
1 hour ago, MWareman said:

I’ll add that if the max time will cause your condition to go past midnight, then the ‘then’ will not execute if the randomly chosen time to exceed midnight...

Thanks for that heads up. I need to review my bedtime routine one to be sure with the pauses it won't kick it over.

Link to comment

Is there a variable or whatever that will give the status of a light? I feel like there must be but I can't figure it out. I want to include it in my email that I send at certain steps of certain programs.

Right now I just say

${sys.program.#.name} ran at ${sys.time} ${sys.date} 

so the email body has the program name and the time and date it ran at. I want something like ${sys.bedroomlight.status}

Link to comment
Is there a variable or whatever that will give the status of a light? I feel like there must be but I can't figure it out. I want to include it in my email that I send at certain steps of certain programs. Right now I just say

${sys.program.#.name} ran at ${sys.time} ${sys.date} 

so the email body has the program name and the time and date it ran at. I want something like ${sys.bedroomlight.status}

 

 

Yes. All substitutions are documented on the Wiki...

 

https://wiki.universal-devices.com/index.php?title=ISY-994i_Series:EMail_and_Networking_Substitution_Variables

 

Devices are referenced by their device ID....

 

${sys.node.11 22 AA 1.ST}

 

I *think* in email you can use:

 

${sys.node.#.ST}

 

This won’t work for network substitutions though as you cannot use # there...

 

 

Link to comment

I had been looking at that page but I wasn't tracking where it would show state

So if I read correctly,

 sys.node.<address>.name

Where I would put in the address would ready out something like "Kitchen Light" but is the .ST going to tell me if it's on or off? Is ST = state? It just has for a description "The formatted specified value"

So I really had no idea what that would report out. CLIFS seems to be for a fan state but.... Not sure what reports on/off.

Link to comment
I had been looking at that page but I wasn't tracking where it would show state
So if I read correctly,
 sys.node.
.name
Where I would put in the address would ready out something like "Kitchen Light" but is the .ST going to tell me if it's on or off? Is ST = state? It just has for a description "The formatted specified value"
So I really had no idea what that would report out. CLIFS seems to be for a fan state but.... Not sure what reports on/off.


There is an SDK (Software Development Kit) that describes all the details - but if not a developer it’s going to be a tough read.

.ST is the device State. Generally, it will be formatted (100%, 50% etc). .ST.RAW is the raw value (255 for 100% etc..). Other properties are formatted based on their UOM (Unit of Measure) as defined in the SDK.

Your best bet is to experiment and try it and see...
Link to comment

Didn't get to try too much tonite because bad storms/tornado warnings went through and now we have no internet. I know programs will run even without internet because they're stored on the ISY so long as we have power (we have backup generators so we always have power) things will run so that's good.

One question I had was on this:

image.png.d608226ec911706e577387507d30b18a.png

I want to simulate someone getting up in the middle of the nite to go to the bathroom or whatever.... so any time between 2:25 and 4:25am, it runs this one time at a random time, turns the lamp on, then waits 5 minutes, then waits a random 5 minutes and shuts it off.

Is the from/for/repeat part correct and will do as I expect? I didn't have time to get mail alerts set up when I was up there at house 2 and since there's no internet, they wouldn't send anyway.

thanks!

Link to comment
1 hour ago, watson524 said:

Didn't get to try too much tonite because bad storms/tornado warnings went through and now we have no internet. I know programs will run even without internet because they're stored on the ISY so long as we have power (we have backup generators so we always have power) things will run so that's good.

One question I had was on this:

image.png.d608226ec911706e577387507d30b18a.png

I want to simulate someone getting up in the middle of the nite to go to the bathroom or whatever.... so any time between 2:25 and 4:25am, it runs this one time at a random time, turns the lamp on, then waits 5 minutes, then waits a random 5 minutes and shuts it off.

Is the from/for/repeat part correct and will do as I expect? I didn't have time to get mail alerts set up when I was up there at house 2 and since there's no internet, they wouldn't send anyway.

thanks!

No. The syntax of the repeat statement is incorrect. Repeat 1 time means do it once, repeat it no times.

You do not need the time frame lines. Just use At 2:25:00AM. The ending time line will stop your Then running and process Else. This could stop a sequence in progress with a light on permanently.

Link to comment
9 hours ago, watson524 said:

But I only want to do the sequence once, I just want it to happen at a random time between 225 and 425

If I say at 225 then I would just wait 2 hours random so it would happen anytime in that two hours if I'm understanding correctly? 

Yes.

You don't appear to want to randomise the number of repeats but rather the time you operate your devices.

Link to comment

Going back to this one..... So I thought I had this nailed. Set up a test program and the content of the email looked like this in the body:

image.png.15019bb9aa68e567ffb1ba8e0851b54a.png

And during testing it produced this in the body of an email:

image.png.b9f10ef9a139a855430e42f051f35677.png

So I thought ok great.

Then when the programs ran automatically last nite calling that same content, the output of the emails was:

image.png.46fcade650728451454251433b94ef63.png

I have no idea why it suddenly changed. At first I thought it was a difference between my ISY (where I didn't do the testing but used the content in the same format) which is on 4.7.3 vs the one I did the testing on which is 5.0.13c but even that one gave this wonky output.

Any guesses what might be going on here? 

Link to comment
12 hours ago, watson524 said:

Going back to this one..... So I thought I had this nailed. Set up a test program and the content of the email looked like this in the body:

image.png.15019bb9aa68e567ffb1ba8e0851b54a.png

And during testing it produced this in the body of an email:

image.png.b9f10ef9a139a855430e42f051f35677.png

So I thought ok great.

Then when the programs ran automatically last nite calling that same content, the output of the emails was:

image.png.46fcade650728451454251433b94ef63.png

I have no idea why it suddenly changed. At first I thought it was a difference between my ISY (where I didn't do the testing but used the content in the same format) which is on 4.7.3 vs the one I did the testing on which is 5.0.13c but even that one gave this wonky output.

Any guesses what might be going on here? 

Looks like your node stalled and the values became blank so ISY didn't know what to do with them.

I don't think I ever used the # (octathorpe) symbol

Link to comment
26 minutes ago, larryllix said:

I don;t think I ever used the # (octathorpe) symbol

It seemed to work great before lol! I was doing it that way so that each program event didn't need it's on email config and I could just use this general one.

Something else I should call out is that the subject of my email is:

Program ${sys.program.#.name} ran    

And that is still reporting correctly as "Program Testing notices ran" so the # works just fine there. So it does seem to be tied to these nodes but I have no idea why it would have been fine before and isn't now on both ISYs or what they are.

I'm reading this:

https://wiki.universal-devices.com/index.php?title=ISY_Portal_Node_Server_Instructions

and it tells me nothing.

Link to comment

And I just added this to the notices to see what reports what (I added the numbers and such so I knew what line it was from)

1.) Alert Details - ${alert.details}

2.) Alert Action - ${alert.action}

3.) Alert Control - ${alert.control}

4.) ${sys.node.#.name}

5.) ${sys.node.#.addr}

and oh look, now everything reports as it should again. No ISY reboots no nothing

ISY Alerts <alerts@universal-devices.com>
To:
Oct 4 at 12:02 PM
At 12:02:13 on 2018/10/04
Kitchen Sink Light turned On
 
1.) Alert Details -      At: 2018/10/04 12:02:13 PM
Program: Testing notices
Device: Kitchen Sink Light (15 FC C2 1)
  Value: 255
 
 
2.) Alert Action - 255
 
3.) Alert Control - ST
 
4.) Node Name - Kitchen Sink Light
 
5.) Node Address - 15 FC C2 1
Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...