Jump to content

Programming devices using variables or loops


kirksnyc

Recommended Posts

Posted

Hello all - first post to this forum so please forgive me if this is a question or topic that has been addressed elsewhere.  I'm only now just starting to learn how programming and variables work in ISY.  I have experience with OO programming and my brain keeps moving towards strategies that I would implement there for efficiency and flexibility without having to create extraneous lines of code.

My basic question is as follows:  Is there any way to program devices (let's say for my purposes solely lighting controls switches, modules, keypads etc) using the folder a device is organized in within ISY AC?  For example I want to create a program that will adjust ramp rate then dim all lights within a room (which i have as a folder grouping) without adding a line of code for each switch?

Or asked another way in which I can achieve the same result: is there any way to have existing programs take actions on devices that are not yet part of the system?  i.e. If i add a new lamp with a lamp module a month from now, is there any way a program can access that module without me explicitly adding a line to the program?  (for example if there was pre-existing programming to the effect of: for all devices in folder XYZ loop through those devices and set ramp rate to xx%).

Thanks very much.

Posted

Not really.  Folders can be used to organize devices, or to organize (and enable/disable) programs.

The only way I can think to create programs for devices that do not yet exist is to use scenes in programs, then add new devices to scenes as you get them.

Posted (edited)

No, No.

Program lines are really cheap and easy to write and install. ISY language contains no matrix style operations, lists, dictionaries or arrays.

As per @oberkcabove folders can organise programs by any subject you choose. I organise my device tree by rooms/location and organise my programs by functions.

Folders can also be used with conditions to allow that folder group to be enabled but, although I use it sparingly, I do not recommend it for most functions. When the folder logic changes your programs can terminate unexpectedly without cleaning up, the folder conditions are very obscure, and programs in a disabled folder cannot be tested manually and the user will not be informed why.

 

When you change the ramp rate or other aspects of a device's EPROM tables it takes a few seconds so multiple device's parameter changes are not recommended without time breaks to avoid jamming up your Insteon comm channel. (use Wait 1-2 seconds between each devices write). This is not as critical for simple ON/Off/Dim operations.

Edited by larryllix
  • Like 1
Posted

Thank you @oberkc and @larryllix

Appreciate the replies.  Will just use scenes to implement my strategies.  I don't imagine I'll be adding a ton of infrastructure to the system once it's all set up so that will work.

I organize my devices the same way, floor/room/location, i just wish there was a way to say: "bring up all the lights in the dining room and living room to 30% at a 20 second ramp rate and bring down everything else to 0" in a few lines of code rather than very lengthy scenes.  Certainly doable, but not easily changeable without hundreds of mouse clicks.  Can't even copy/paste the code...

Re the ramp rate - I learned that after some trial and error.  Setting the ramp rates on 30 switches in a row, didn't get me the desired results.  A test program with a single ramp rate set and then a 2 second wait works great, but not for a large group of switches.  Now I know why...

 

Thanks again

Posted
7 hours ago, kirksnyc said:

Thank you @oberkc and @larryllix

Appreciate the replies.  Will just use scenes to implement my strategies.  I don't imagine I'll be adding a ton of infrastructure to the system once it's all set up so that will work.

I organize my devices the same way, floor/room/location, i just wish there was a way to say: "bring up all the lights in the dining room and living room to 30% at a 20 second ramp rate and bring down everything else to 0" in a few lines of code rather than very lengthy scenes.  Certainly doable, but not easily changeable without hundreds of mouse clicks.  Can't even copy/paste the code...

Re the ramp rate - I learned that after some trial and error.  Setting the ramp rates on 30 switches in a row, didn't get me the desired results.  A test program with a single ramp rate set and then a 2 second wait works great, but not for a large group of switches.  Now I know why...

 

Thanks again

Remember, when you change the EPROM inside a device you may be wearing out the EPROM. That has been a fear for years but it has never been proven either way.

The proper way is to design a scene for every setup and let your programs pick a scene that has the features you preset in it.

I avoid scene as much as possible. I prefer the control I get in ISY programming, making changes later on (you will every time you think of something else, otherwise you could have stuck with an Insteon Hub). I use scenes to operate all lights, when I want simultaneous timing for looks, KPL LEDs and MS/Lamp combinations for speed of On response only. I find them more obscure and a large source of confusion for users judging by the scores of basic questions about them in the forums. Most other protocol devices do not have "scenes".

Posted (edited)
On 4/1/2021 at 3:57 PM, kirksnyc said:

Thank you @oberkc and @larryllix

Appreciate the replies.  Will just use scenes to implement my strategies.  I don't imagine I'll be adding a ton of infrastructure to the system once it's all set up so that will work.

I organize my devices the same way, floor/room/location, i just wish there was a way to say: "bring up all the lights in the dining room and living room to 30% at a 20 second ramp rate and bring down everything else to 0" in a few lines of code rather than very lengthy scenes.  Certainly doable, but not easily changeable without hundreds of mouse clicks.  Can't even copy/paste the code...

Re the ramp rate - I learned that after some trial and error.  Setting the ramp rates on 30 switches in a row, didn't get me the desired results.  A test program with a single ramp rate set and then a 2 second wait works great, but not for a large group of switches.  Now I know why...

 

Thanks again

The ramp rate of scenes do not have to be changed. You can include ramp rates to programs in the same line as the operation. That doesn't change any scene presets. Each Insteon device can hold about 256 different scenes as well as the locally operated switch scene from the push buttons and the ISY controlled operations. No scene required or EPROM re-writing or waiting needed.

Edited by larryllix
Guest
This topic is now closed to further replies.

×
×
  • Create New...