Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

adding subroutine programming construct

Featured Replies

Posted

Have you guys given any consideration to adding a programming construct for a subroutine call to the ISY? This would be a very powerful addition which would allow us to create more modular code.

  • Author

you said "call", I suspect you meant "run" as that's the only option I see.

 

But the distinction is that if I "run" the other program from a program, it DOES NOT return to the calling program.

 

It originally took me hours to figure out why my code wasn't working until I understood that the execution does not return from a "run" (that was a year or so ago).

  • Author

pseudo code example:

 

Program1

do thing x

do thing y

run program2

do thing z <-- this never runs

 

Program2

do thing a

do thing b

xd40,

 

Just to be sure, I created a test program which calls 3 different programs each one of which send an email to a different recipient:

 

If
       Status  'adf / blah blah' is On

Then
       Run Program 'email 1' (Then Path)
       Run Program 'email 2' (Then Path)
       Run Program 'email 3' (Then Path)

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

 

 

This works as expected. As I mentioned, unless the condition causes the program to stop, all programs should be called in sequence. i.e if the status of the lamp adf/blah blah becomes off during the execution then everything stops.

 

With kind regards,

Michel

 

pseudo code example:

 

Program1

do thing x

do thing y

run program2

do thing z

 

Program2

do thing a

do thing b

  • Author

Interesting, that has not been my experience. Maybe there was a bug in one of the beta versions I was recently using. I guess the next time I'm tweaking my programs I'll try this again.

  • Author

The execution ends as soon as the condition of the calling program becomes false.

 

That's interesting. Nothing like making the outcome of a "function call" non-deterministic based on some external event that you've already tested against. I guess that makes sense in somebody's world--just not mine.

 

I have a computer science degree over 25 years programming experience and I have to say that the home automation world has a very odd concept of what a programming language should look like. I should know by now that when your "programming" is constrained by a menu driven "program builder" that there are going to be significant limitations of that "language". i.e.:

 

- abnormal program flow

- no case statements

- no arrays

- no type conversion

- no function calls

- no math functions

 

- oh, and no variables...???

 

Why don't you guys consider embedding a LUA interpreter so we can write some of the functionality we need for ourselves? I still have a 10 year old X10 controller running all of my lawn sprinkler programs because the programs are too complex to implement on the ISY...

The execution ends as soon as the condition of the calling program becomes false.

 

The execution of the calling program quits but any called program will continue unless it is explicitly Stopped. This can be done using the Else actions.

 

Rand

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.