Jump to content

Polisy programming clarifications


Go to solution Solved by Geddy,

Recommended Posts

Posted

Hi to all,

I just received my Polisy (running v5.4.3) and Insteon PLM 2413S.
So I'm on a learning curve and this is my first post.
I managed to build my own RJ45 to DB9 interface with an ethernet cable and an inexpensive DB9 to RJ45 Modular Adapter like this.
I also managed to add my 25 devices using the "remove links" option.
So, I think I'm all set to start programming.
I searched for a programming primer, but couldn't find one to answer my questions.

My questions regarding programs are:

  1. Do programs run 24/7 like a service or they only run when the condition is true like a scheduled task?
  2. If they run 24/7 like a service, then everything under the "then" is executed at every cycle when the condition is true and everything under the "else" is executed the rest of the time when the condition is false. For example, if my program turn on a scene (then action) at 18h00 for 1 hour (if condition) and turn off the scene otherwise (else condition), does it mean that if I turn on the scene manually at 20h00 the program will automatically turn it off because it's in the else condition?
  3. If they run like a scheduled task, why is there an "else" option since the task is only executed when the condition is true which means that at other times the task would not run.

Plese help me understand,

Many thanks to the community,

FBO

  • Solution
Posted
5 minutes ago, FBoucher said:

I searched for a programming primer, but couldn't find one to answer my questions

Make sure you get the ISY Cookbook. It will have lots of programming information that should help. 
 

1)  programs are event based and “run” when the “IF” statement is true. So if you have a program that says to do something at 7pm and have it set for every day then it will “run” the “THEN” line at 7pm. 

2) yes, I think. But basically if you have a generic program to turn something off at a time it will turn off then   If that time is 1hr after the program turned it on then it will go off. Again, read the cookbook for programming education. There are also some good videos on YouTube to help you learn.

3) the else is used in the false of the IF.

basic (because I’m on a tablet rather than a computer)

if from sunset to sunrise

then turn light on

else turn light off

 

This would turn the light on at sunset and turn it off at sunset. Once you learn the programming skills this will be clear. 

Please start with simple timer programs then work up to more advanced and elaborate programs so you understand what you’re doing.  
 

Welcome to the forums and have fun learning ISY/Polisy. 

 

 

Posted

Thanks Geddy for the reply.

This ISY cookbook is really good. That's what I was looking for. I didn't venture in the ISY994 wiki thinking that it no longer applied to Polisy.

From the cookbook on page 145, section 9.2.4, reproduced here:

  • IF – has the condition that must be met to for the program to run. This condition is the trigger for the program to take action.
  • THEN – is the primary action when the condition is met. The program here stays running as long as the condition is met or True.
  • ELSE – is the secondary action when the condition is no longer met or False and only after the primary action was taken.

So, as you stated, the program gets triggered when the IF condition is met. Other times the program is not running.
Once met, the actions under THEN are executed while the condition is TRUE.
When the condition goes from TRUE to FALSE, the ELSE actions are executed once.

If the condition is a period (like sunset to sunrise) does "The program here stays running" mean that the actions under THEN are repeatedly executed?

Or the THEN actions are executed only once when the IF condition is met and keeping the program running serves as some sort of timer to get the ELSE actions executed at the end of the period? 

  • Like 1
Posted

Hi again, I should have read the cookbook further before posting ... sorry.

The answer is a bit more complicated. From the cookbook page 183 section 9.5.4, I understand that the IF condition is re-evaluated when there is a WAIT or REPEAT action in the THEN (or ELSE) section. So, if I understand correctly, for a simple program like the one you posted:

if from sunset to sunrise

then turn light on

else turn light off

the THEN and ELSE actions will only be executed once because the IF condition will only be evaluated twice, at sunset and at sunrise.

I'll keep reading before posting ... ;-)

Many thanks,

FBO

  • Like 1
Posted
1 hour ago, Geddy said:

Make sure you get the ISY Cookbook. It will have lots of programming information that should help. 
 

1)  programs are event based and “run” when the “IF” statement is true. So if you have a program that says to do something at 7pm and have it set for every day then it will “run” the “THEN” line at 7pm. 

2) yes, I think. But basically if you have a generic program to turn something off at a time it will turn off then   If that time is 1hr after the program turned it on then it will go off. Again, read the cookbook for programming education. There are also some good videos on YouTube to help you learn.

3) the else is used in the false of the IF.

basic (because I’m on a tablet rather than a computer)

if from sunset to sunrise

then turn light on

else turn light off

 

This would turn the light on at sunset and turn it off at sunset. Once you learn the programming skills this will be clear. 

Please start with simple timer programs then work up to more advanced and elaborate programs so you understand what you’re doing.  
 

Welcome to the forums and have fun learning ISY/Polisy. 

 

 

Where do you find these videos.  I have not had much success finding videos on YouTube. 

Posted
2 hours ago, FBoucher said:

Hi to all,

I just received my Polisy (running v5.4.3) and Insteon PLM 2413S.
So I'm on a learning curve and this is my first post.
I managed to build my own RJ45 to DB9 interface with an ethernet cable and an inexpensive DB9 to RJ45 Modular Adapter like this.
I also managed to add my 25 devices using the "remove links" option.
So, I think I'm all set to start programming.
I searched for a programming primer, but couldn't find one to answer my questions.

My questions regarding programs are:

  1. Do programs run 24/7 like a service or they only run when the condition is true like a scheduled task?
  2. If they run 24/7 like a service, then everything under the "then" is executed at every cycle when the condition is true and everything under the "else" is executed the rest of the time when the condition is false. For example, if my program turn on a scene (then action) at 18h00 for 1 hour (if condition) and turn off the scene otherwise (else condition), does it mean that if I turn on the scene manually at 20h00 the program will automatically turn it off because it's in the else condition?
  3. If they run like a scheduled task, why is there an "else" option since the task is only executed when the condition is true which means that at other times the task would not run.

Plese help me understand,

Many thanks to the community,

FBO

Keep in mind, clear links is not the same as a factory reset. You can end up with undesirable things happening if you do not factory reset when coming from another controller. 

  • Like 2
Posted
27 minutes ago, FBoucher said:

Thanks for the tip lilyoyo1,

If not mistaken, factory reset requires a physical access to the set button on the device, right?

Yes. That is correct

Posted (edited)
12 hours ago, FBoucher said:
  • Do programs run 24/7 like a service or they only run when the condition is true like a scheduled task?
  • If they run 24/7 like a service, then everything under the "then" is executed at every cycle when the condition is true and everything under the "else" is executed the rest of the time when the condition is false. For example, if my program turn on a scene (then action) at 18h00 for 1 hour (if condition) and turn off the scene otherwise (else condition), does it mean that if I turn on the scene manually at 20h00 the program will automatically turn it off because it's in the else condition?
  • If they run like a scheduled task, why is there an "else" option since the task is only executed when the condition is true which means that at other times the task would not run.

Programs are always running.  The IF statement will CONSTANTLY be evaluated to either True of False.  The instant an IF statement becomes True it will begin to run the THEN statement, conversely the instant the IF statement becomes False it will begin to run the Else statement.  Will and IF or then get interrupted while it's running?  If it has a wait then yes it's possible the if statement will never complete.  Consider this hypothetical program

If

   Motion detector status is on

Then

   Turn on light

    Wait 10 minutes

   Turn off light

Else

    Nothing

If the status of the motion detector becomes Off during the 10 minutes wait, the light never turns off, because the wait was interrupted.

------

If

   Motion detector status is on

Then

   Turn on light

    Wait 10 minutes

   Turn off light

Else

    Turn off light

in this case we added turn off light to the else.  If the motion detector turns off during the 10 minutes wait the iff will become false and the light will immediately turn off because of the else, or it will turn off after 10 minutes if motion is still on.

--

The above is a bad example, because most of the motion sensors we use don't work exactly like that, and we'd use a different trigger called "Control" rather than "status" in a real motion sensor program.  Control is a trigger, and senses the on or off state but doesn't reverse it's state.

--

Programs such as schedules, are true during the scheduled period and false outside the scheduled period.

If

    From Sunset

    to Sunrise (next day)

then

    turn on porch light

else

    turn off porch light

---

There's also methods to ensure the program always completes even if the status of  the if changes.  Re-using the first example:

Program ONE

If

   Motion detector status is on

Then

   Run Program TWO (then)

 Else

   (nothing)

--

Program TWO

if

   (blank)

then

    disable Program ONE

   Turn on light

    Wait 10 minutes

   Turn off light

    enable Program ONE

Else

    Nothing

Using a method such as this allows the program to complete even if the status changes.

 

So in summary, yes programs are always running and the IF is always being evaluated.  If the program is paused by a wait statement, it's possible the program never completes.

 

 

 

Edited by MrBill
  • Like 2
Posted
19 hours ago, FBoucher said:

I didn't venture in the ISY994 wiki thinking that it no longer applied to Polisy.

The cookbook relates mostly to ISY (as a software/service). It just so happened that at the time only the ISY994 was the device it was designed for.

ISY994 = Hardware

Polisy = Hardware

ISY on Polisy = Service/Software (IoP)

(simple way of looking at it)

The underlying information found in the cookbook still applies to the IoP setup and function. Until there is a major shift in the UI or logic.

The wiki is the same way as the cookbook. While even some of the wiki still references the OLD ISY99 and ISY26 the general idea applies to ISY no matter if running ISY994 or ISY on Polisy.

Here's some helpful programming tips you should read through that would answer questions you might still have...

https://wiki.universal-devices.com/index.php?title=ISY-99i/ISY-26_INSTEON:How-To_Guide#Programs

 

Posted

Thank you very much Geddy and MrBill for taking the time to answer my questions.
I just need to learn this programming language.

I followed lilyoyo1 suggestion to factory reset all my Insteon devices. It took me a little while because some of these devices are not easy to reach. I also factory reset My Polisy and PLM.

Now I've added all the Insteon devices back, created basic scenes and basic programs. I'll play with them to get a better sense of the interactions while referring to the wiki and cookbook.

However, in the process of resetting everything, I no longer have the "Portal" tab in the "Configuration" tab. Before the reset, I succeeded in linking to UD Mobile and ISY Portal. Now ISY Portal list the Polisy, but says it's offline. What should I do to get it back?

Thanks

Posted
2 hours ago, FBoucher said:

What should I do to get it back?

Oops! Shouldn't have "factory reset" the Polisy! Just the devices would have been fine. 

I am not 100% sure, but I'd just go through the activation process again. Do you have a red "x" to the left of the UUID for the Polisy on the ISY Portal? You say it's showing offline (so there is probably a red dot to the right of the UUID - this would be green if it were online).

I'd click the "x" to remove it from your account then add it back. That should initiate the signal to the ISY on Polisy to approve from Admin Console (again).

If that doesn't fix it then open a ticket with support and they'll get you setup just right.

 

Posted

Hello again,

Also, I selected 24h format in configuration, but the Schedule in Programs still shows hours in the AM/PM format. Is it possible to have 24h time format in Programs?

Posted
14 hours ago, FBoucher said:

I'll wait for support to reply.

I'm sure they'll get you taken care of. Although @Javi posted a process that might help you out...Give it a try. Make sure to pay attention to the last paragraph in the post...if it doesn't work let them know in your ticket so they can do some troubleshooting from their side and possibly change the process some.

 

 

  • Like 1
Posted

Thanks Geddy, support already replied asking me to click again on Manage Modules and the Portal Module Install started. Now everything seems to be back to normal. I guess some parameter needed to be reset on UD side to allow the module to become available, as if I was a new user again.

Other matter, 24h time format. I selected 24h format in configuration, but the Schedule in Programs still shows hours in the AM/PM format. Is it possible to have 24h time format in Programs?

  • Thanks 1
Posted
3 minutes ago, FBoucher said:

Is it possible to have 24h time format in Programs?

Doesn't appear to be. Since AM/PM is an option then it appears to just be written in 12hr format. I did the same as you to change the clock setting and restarted AC, but programs still had AM/PM option so figure that's just hard coded that way. 

5 minutes ago, FBoucher said:

support already replied

Glad they already got you sorted out. UD has fantastic support!

Posted
On 5/13/2022 at 10:38 PM, lilyoyo1 said:

Keep in mind, clear links is not the same as a factory reset. You can end up with undesirable things happening if you do not factory reset when coming from another controller. 

Interesting. I factory reset my switches but most plug in modules are not easy to get to so I used the clear links… it seems pretty thorough like even mini remotes removed that somehow seemed like they were permanently linked prior.
 

what does a reset do besides clearing the device link db?

Posted
39 minutes ago, kenrok1 said:

Interesting. I factory reset my switches but most plug in modules are not easy to get to so I used the clear links… it seems pretty thorough like even mini remotes removed that somehow seemed like they were permanently linked prior.
 

what does a reset do besides clearing the device link db?

A factory reset takes a device back to factory state. No links or anything in a device while clearing links will only bring the device in that you're adding. While it's a defacto reset, you can still end up with half links that can affect your system.

Guest
This topic is now closed to further replies.

  • Recently Browsing

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

    • There are no registered users currently online
  • Forum Statistics

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