Jump to content

ISY Programs not running properly (Might be fixed)


Recommended Posts

ISY994i, MultiSensor6, Interior light an Exterior lights interactive programming.

I am having some difficulties with some of my programs not running correctly. Sorry, in advance... I have made this all a little complicated trying to combine devices. (Update: I might actually have this fixed, but am going to run it for a few days to see if it is all ok now. But I thought I post this anyways, as if its fixed it might help out someone else with some ideas for coding, or I may need to re-visit this looking for more help if its not fixed and did not want to re-type it all.

I have an ISY994i with the Zwave card installed. Running 5.0.13D Firmware and UI. I had to re-program the variables and a few other things to make things work under the 5.0.13D, cause I upgraded from 4.6.2.  Wow, big difference took a bit of work, but I really like the upgrade.

 

My issues are with lighting programs for an exterior light and an interior light. As well as a Mutlisensor6 motion detector outside. (I am using variables for cross over reasons that you will see below.)

Here is the exterior lighting hours control program. If between certain hours set the 'Lights_Outside_Hours__' variable to ON, otherwise OFF. 

2073893503_exteriorlightcontrol.jpg.7e187d107d619032c577212b3e462902.jpg

Then further to that, I add in Luminance as per below...   If the MultiSensor6 identifies a Luminance of less than 100, and if the allowed 'light-on' hours is correct (from above) the variable 'Light_Outside_Front__'  is turned ON to '1'. Then I run the 'LightOutside - Variable Control' program to control the actual light.

612812242_exteriorlightcontrol.jpg.8e576481ccb2b1ded0e375d73a4a7221.jpg

The program below evaluates 2 different conditions; the variable 'Light_Outside_Front__' and if motion is detected by the 'Moition_which_lights__' variable to turn on the lights.....

1984815803_lightoutsidecontrol2.jpg.8ded5c88e13e05a606bf9d72d3bffda5.jpg

so, if the 'Light_Outside_Front__' variable says ON, or if the MultiSensor6's motion detector detects motion, actual light is turned ON in this program. Or, OFF as required.

1155262953_Motiondetected.jpg.e037c8df335f66a707b26a3d4dcc0ef4.jpg

So, if motion is detected, this program sets the variable 'Motion_which_lights__' as to which lights are come on, to either value 1 or 2.  Value 1 turns on the outside lights when the 'Light Outside - Variable Control' program is run. The ISY notifies me of detected motion via email. Waits 8 seconds, then sets the 'Motion_which_lights' variable to 2, that turns on the interior light when the 'Light inside - Variable Control' program is run.

When the motion detector senses motion, it turns to ON for 4 minutes, which runs the 'THEN' command. After 4 minutes, the motion detector turns to OFF, and then the 'ELSE' command is run and it changes the variables to '0' and shuts off both interior and exterior lights (from a motion point of view) when I run both the variable control programs. 

So my exterior lights are only turned on by allowed hours, low luminance or by the detection of motion. 

As for the interior table lamp light 'Light_inside_living__' , I have it turn on 8 seconds later, to give the impression of an exterior light going on under motion detection, then secondly someone coming into the interior room and turning a light ON slightly later (8 second) to see what is up. Just something I thought I would try as a deterrent to make it look like someone was in the house. 

Along with the above control for the interior light, I have my interior light hourly control program running, as seen below. 

739437787_interiorlighttimed.jpg.0b153027104daca6353cac23bd6a2e8d.jpg

This is pretty simple, and it simply turns the 'light_inside_Living__' viable to ON or OFF based on time, then runs the 'Light Inside - Variable Control' program as seen below.

1163767362_lightinsidecontrol.jpg.0a7bf00abb81544b3bb007da7076931c.jpg

So if the 'Light_inside_Living__'  variable is 2, or if the motions detector is ON and sets the 'Light_inside_Living__' variable to 2, the interior light is switched on.

 

Now I keep staring at these programs, cause I cannot see anything wrong.... It seems to make sense to me. I have set up the different variable switches and run them separately, as opposed to different programs controlling the same variable,  then have the control programs evaluate the different variables for control of a specific light. I have been calling the variable control programs to run within my programs to ensure they run, because I have been having errors of stuff not running properly.

So after all of that, it's not working properly...  (UPDATE.... I might have fixed this while typing this all out, as I found an error)

But, I come home at 6:45pm and the interior light has not come on, when it should be on. When I look at my variable values through MobilincPro I can see that my 'Light_inside_living__' variable is set to '1' so the light should be on, but it's not. If I run ONLY the 'Light Inside variable control' program, that re-evaluates the variable, the light inside turns on.

OR, going to bed and at 11:30pm the exterior light is still on. When I look at my variable 'Light_Outside_Front__' value through MobilincPro, I can see that my exterior light is set to '1' when the value should actually be zero and the light should be off, but the light is on.

 

Sorry, this post is a bit long... just frustrated with this. I thought maybe it's my PCM, but my Insteon Thermostat changes heat on schedule as per my  ISY programming, so I don't think it's the ISY. As well other notifications seem to work properly.

 

Any thoughts....

 

UPDATE: even before I have finished this post,  through the process of writing all of this out, I notice that at 6:45pm my variable 'Lights_inside_living--_ was set to 1. However, that should only ever be set to 2 or 0. So, looking back through programming I noted that in the program 'Light Outside - Variable Control' that in the THEN statement I had 'Light_inside_living--" being set to 1, as opposed to 'Light_outside_Front__' being set to zero, then similar in the ELSE statement, so I changed that in both locations (as seen above) to show that corrected change. That change will prevent the 'Light_Inside_Living __' from being set at 1, and will turn off the"Light_Outside_Front__' variable to 0 and turn that light OFF as required. So, I hope that fixes all my issues. I am going to let this all run for a few days now and see if my problem is fixed.

Funny how one line of code can mess me right up.

 

 

I will post back if this is actually fixed, maybe this program will help someone else with cross linking devices.

Then again, maybe I have made this more complicated than it needed to be..... LOL

 

 

 

 

 

 

 

 

 

 

exterior light control.jpg

lightoutside control.jpg

Motion detected.jpg

interior light timed.jpg

light outisde hours.jpg

exterior light control.jpg

lightoutside control.jpg

Link to comment

Nice.

A few suggestions from "mystyle" bag of tricks.

  • Identify your state variables to avoid confusion for others as well as yourself months from now. They work differently. Some use $s.xxxxxx  as a prefix. I use $sxxxxxx. For Integer variables I use nothing. Many use $i.xxxxxxxxx
  • Your first three programs could be combined into one logic using OR and ANDs. (I haven't proven this)
  • You shouldn't need to call the subroutine programs from other programs. If the State trigger variable changes, or the Lux device,  the program runs automatically. You may be hitting the program twice cancelling some action (if program is enabled) that has already started.
Link to comment

I am thinking along similar lines as larryllix.  This seems to me like a lot of programs and variables.  In my mind, this makes it harder to troubleshoot.  But, you may have your reasons for taking this approach.

Why, for example, have one program change a variable then call another program, only to have that program check the same variable.  Since the second program was called by the first (which simultaneously changed the variable) would it only be called if the variable condition were already satisfied?

Are any of your programs disabled?  It seems to me that this approach with variables and subroutines runs the risk that programs are near-simultaneously called and self-initiated unless the programs being called are disabled.

13 hours ago, kswison said:

I thought maybe it's my PCM, but my Insteon Thermostat changes heat on schedule as per my  ISY programming, so I don't think it's the ISY.

First, I would consider the possibility that the ISY is not executing programs properly as pretty low on the list of likely problems. More likely is a program error, but one also must unfortunately consider the possibility that communications to and from the ISY/PLM are not 100% reliable.  Also unfortunately, your thermostat working does not guarantee that all insteon devices are communicating.

One thing that I wonder about is how your condition: Motion_which_lights__>2 could ever be true?  It seems to me that this variable will be either 0, 1, or 2, but never greater than 2.  

Otherwise, I can think of little to do besides staring at these programs and checking at key moments that programs have run and variables are set as you expect.

Link to comment

Thanks for the Reply Larryllix

 

  • Identify your state variables to avoid confusion for others as well as yourself months from now. They work differently. Some use $s.xxxxxx  as a prefix. I use $sxxxxxx. For Integer variables I use nothing. Many use $i.xxxxxxxxx That is an interesting idea. Then when you sort them they all sort together. I had some issue at one time and started doing that, but as $z-xxxxx then they all dropped to the very end of the list of variables. I am going to find some time to do that.
  • Your first three programs could be combined into one logic using OR and ANDs. (I haven't proven this)  I had some issues, and maybe it had more to do with the other code error that I had, but the issues for me were with AND and OR. It seemed to me that combining these created some confusion as if you codes IF 'A' AND 'B' OR 'C', do you get "A B" or "C".... or do you get "AB"  or "AC" as the response is different. I wanted "AB"  or "AC" as a final evaluation. I was never sure (just had errors) and did not think of testing it on a simple program. It just made sense to be the separate the code to decide on 'B' OR 'C' first, then go to 'A' AND the result of 'B' or 'C'.  It just simplified/clarified at the exactly how the AND and OR statements were to work together. I might test that some day to see how that works. but for not this fixed my issue for me.
  • You shouldn't need to call the subroutine programs from other programs. If the State trigger variable changes, or the Lux device,  the program runs automatically. You may be hitting the program twice cancelling some action (if program is enabled) that has already started. Yeah,  I figured that, but things were not working right. Which is see was an error in my code. I just though some programs were not running for some reason, so I just set up the call to access them. I intend to remove those now.

Thanks for the input.

 

 

Thanks for the post Oberkc,  my comments follow...

I am thinking along similar lines as larryllix.  This seems to me like a lot of programs and variables.  In my mind, this makes it harder to troubleshoot.  But, you may have your reasons for taking this approach. I found that using the variables allows me to very quickly understand exactly what the state of my system is (what it's thinking, so to speak). I can grab my iPhone and turn on my MobilincPro app and then go look at the variables page and I can see exactly what the programs think they are supposed to be doing. 1 ON... 2. OFF, etc and if the light is not on or off as it is suppose to then something is wrong. This did backfire on me with resolving my lights issue as it kept telling me the light was 1. ON, but the light would not turn on. Later I realized it was suppose to be set to 2.ON of the light and that all works now. 

Also the most of my programming experience in in LISP, so  there may be some habits coming from there.... LOL

Why, for example, have one program change a variable then call another program, only to have that program check the same variable.  Since the second program was called by the first (which simultaneously changed the variable) would it only be called if the variable condition were already satisfied? I did this mostly to resolve the AND and OR combination issues that I was having. 

Are any of your programs disabled?  It seems to me that this approach with variables and subroutines runs the risk that programs are near-simultaneously called and self-initiated

First, I would consider the possibility that the ISY is not executing programs properly as pretty low on the list of likely problems. I agree  More likely is a program error, (Yup found a couple)  but one also must unfortunately consider the possibility that communications to and from the ISY/PLM are not 100% reliable.  This has been a consideration, I am going to re-wire some of this and put in a couple extra wall plugs. Been planning that for a while. Also unfortunately, your thermostat working does not guarantee that all insteon devices are communicating.

One thing that I wonder about is how your condition: Motion_which_lights__>2 could ever be true?  It seems to me that this variable will be either 0, 1, or 2, but never greater than 2.  Yeah,  something weird there. I made a last minute change in that program the morning that I posted my first post of this thread. Now the motion lights are not coming on at night. So I have an error there to fix. but my interior and exterior lights are working properly on the timer now. So baby steps.

 

Otherwise, I can think of little to do besides staring at these programs and checking at key moments that programs have run and variables are set as you expect.

unless the programs being called are disabled. I am going to remove all the CALLS from the programming, now that I have this fixed.

 

Thanks for the input guys. I have a little work to do now.

 

 

 

 

 

 


 

Link to comment

Well... made some changes this morning now. Will run it for another couple days to see if its all fixed now. Once I have it all sorted out I will post the final programs.

Oberkc, you were right on the motion detector. It should have been '>0' not '> 2', think that will fix that, cause that was the only change that I made to the motion side and then it would not work. I had actually changed it from '0' to '2' for some reason... 

So hoping its all good now.

Link to comment

Ok, everything seemed to run good last night and this morning so I think its fixed. I found another error that was hanging things up.

Made a few other mods; (as recommended herein)

- renamed variable to $i_xxxx for information, $v_xxxxx for variable status data, and $z_for some misc items. Now when I sort by name it separates everything out better. 

- removed all the  'program calls' now that it's working.

Here are the final programs, 

1233545738_MotionDetectedatFront.jpg.fabe1090f3524c7c923db2fcb7df0b1a.jpg

453146231_Exteriorlightinghours.jpg.bd8f611b66658c5b8d6878282ee316ba.jpg

416095508_Exteriorlightsprogram.jpg.e96a231af6e43da9355b52f3a302ecec.jpg

1613292584_InteriorLivingRmLight.jpg.efbf54cf9655e009681ffd527b76e6f8.jpg

515770671_Lightinside-variablecontrol.jpg.80d3004362f10005ca0d9a38d9597e99.jpg

1942610520_lightoutside-variablecontrol.jpg.63bee110d04707f396d90c428923a958.jpg

I stayed away from combining programs more than this, keeps it simpler for me, as I have programs with AND and OR and OR, and I simply am not sure what I get when I combine them. Which is another topic in itself, as does ......

If 'A' AND 'B' OR 'C' give you 'A B' or 'A C' or 'C'

or

If 'A' or'B' or 'C' AND 'D' give you 'A D' or 'B D' or 'C D"  or 'A' or 'B'     ?

So, I did not have to time or bother to try and sort that all out, so it just seemed simpler to resolve variables in steps simplifying the AND/OR/OR and OR/OR/AND combinations. Maybe someday I will go figure that out, but not today. Thanks for the comments/help.

Link to comment

I am not sure why the variables are being used here but......

Did you know there is a sunrise/sunset function in ISY?

Eg:
If
    From Sunset + 5 minutes
    To 10:50 PM (same day)

Then
----------------------------------------------------------------

Also
Did you know you can r.click on a program, select copy to clipboard, and then paste your clipboard into the forum?
---------------------------------------------------------------------
I fell in love with Boolean algebra when my dad introduced me to a book by Brice Ward back in the 80s, so I couldn't resist this one. :)
Boolean arithmetic has a order of operations like regular algebra (BEDMAS = Brackets, Exponents, Division, Multiplication, Addition, Subtraction)
A and B or C. Since 'and' has a higher priority than 'or', makes this an assumed (A and B ) or C = AB or C = reduced  as it can get.

If 'A' or'B' or 'C' AND 'D'  =  A or B  or (C and D)  =  reduced as it can get

Hint: Don't read the Wikipedia article unless you want to be completely confused.

Have a good one!

Link to comment

Thanks.

I am going to look into the Sunset + 5 minutes. That would be nice to set up and I could drop the luminance <100 setting.

Sunrise sunset would be much improved.

The Boolean AND / OR helps to know AND has higher priority, but under that condition, it does not work for how I am trying to evaluate. So will leave it as is.

Could probably be done by re-structuring the evaluation. Might l;ok at that another day.

 

I will try the r.click next time (thanks), that would be much easier.

 

Thanks

Kev

Link to comment

Archived

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


×
×
  • Create New...