mmb Posted November 8, 2019 Author Posted November 8, 2019 35 minutes ago, larryllix said: I never do my calculations in a State variables. You could trigger a dependant downstream program multiple times with nonsense intermediate values. Do the calculation in non-triggering variables and then copy it to the trigger State variable, last. I assume the waits are for testing. They can other programs to inject other values into variables. You are sending the latest updated variable value and receiving the correct response.. See my first sentence above. Sorry I should have mentioned variables were declared as Numbers with precision 1. By non-triggering variables you mean numbers? Maybe I'm missing something?? Thanks!
apostolakisl Posted November 8, 2019 Posted November 8, 2019 13 minutes ago, mmb said: Sorry I should have mentioned variables were declared as Numbers with precision 1. By non-triggering variables you mean numbers? Maybe I'm missing something?? Thanks! He means what ISY calls "integer" variables. There are 2 tabs on the variables page. Whenever a state variable changes value, any program containing that variable in the "if" clause will trigger. Integer on the other hand or only tested inside an "if" clause when the "if" clause is executed for some other reason.
mmb Posted November 8, 2019 Author Posted November 8, 2019 (edited) On 11/7/2019 at 7:56 PM, apostolakisl said: He means what ISY calls "integer" variables. There are 2 tabs on the variables page. Whenever a state variable changes value, any program containing that variable in the "if" clause will trigger. Integer on the other hand or only tested inside an "if" clause when the "if" clause is executed for some other reason. Thanks, I have roughly 30 state variables some that are set by apps like Blue Iris, Alarm system, etc and others that trigger various things like google asst and alexa through the portal. I have 1 integer variable (for this test) that is assigned but not working properly as I described above. I deleted and recreated the program but still not working. Edited November 10, 2019 by mmb
larryllix Posted November 8, 2019 Posted November 8, 2019 1 hour ago, mmb said: Sorry I should have mentioned variables were declared as Numbers with precision 1. By non-triggering variables you mean numbers? Maybe I'm missing something?? Thanks! All ISY variable hold numbers. By non-triggering variables, I mean State variables that are not used in programs If sections, that are enabled, or Integer variables used anywhere. When you use a state variable in an If condition, it can cause triggering of the program. Your program would trigger and before it can get finished, the program could get triggered again, restarting the program, or before the notification gets sent the variable would be changed in value. That is what you are seeing.
mmb Posted November 8, 2019 Author Posted November 8, 2019 11 minutes ago, larryllix said: All ISY variable hold numbers. By non-triggering variables, I mean State variables that are not used in programs If sections, that are enabled, or Integer variables used anywhere. When you use a state variable in an If condition, it can cause triggering of the program. Your program would trigger and before it can get finished, the program could get triggered again, restarting the program, or before the notification gets sent the variable would be changed in value. That is what you are seeing. I think I see what you mean but this simple program has 1 variable that is declared as an integer. The reference to the Polyglot device that holds the temperature data is likely causing the problem because manually insert the temperature works fine. Maybe can you point out in the test program above that could cause the problematic behavior?
larryllix Posted November 8, 2019 Posted November 8, 2019 (edited) 49 minutes ago, mmb said: I think I see what you mean but this simple program has 1 variable that is declared as an integer. The reference to the Polyglot device that holds the temperature data is likely causing the problem because manually insert the temperature works fine. Maybe can you point out in the test program above that could cause the problematic behavior? The problematic behaviour is caused by your If statement setting the value you are sending in the notification. Your program can change values all you want but you are sending the State Variable that is being changed. Your output demonstrates it. BTW: Integer Variable does not mean the variable doe not have a fractional part. That is determined by the precision setting, regardless of the type. Bad naming but Integer means non-triggering and State means it can trigger a program. Edited November 8, 2019 by larryllix
mmb Posted November 8, 2019 Author Posted November 8, 2019 (edited) 13 minutes ago, larryllix said: The problematic behaviour is caused by your If statement setting the value you are sending in the notification. Your program can change values all you want but you are sending the State Variable that is being changed. Your output demonstrates it. BTW: Integer Variable dose not mean the variable doe not have a fractional part. That is determined by the precision setting, regardless of the type. Bad naming but Integer means non-triggering and State means it can trigger a program. This is the output of the calculation using the Polyglot/ISY device, which is the same as the input. Let me know if I've done this incorrectly. And if I manually assign it, this is the result which is correct I used to be a programmer, but there sure is something strange about this behaviour Anyway thanks! Edited November 8, 2019 by mmb
larryllix Posted November 8, 2019 Posted November 8, 2019 (edited) 33 minutes ago, mmb said: This is the output of the calculation using the Polyglot/ISY device, which is the same as the input. Let me know if I've done this incorrectly. And if I manually assign it, this is the result which is correct I used to be a programmer, but there sure is something strange about this behaviour Anyway thanks! Inspect your notification values. You were sending a state variable before that was being updated dynamically with the current value, not your calculation result. Do you understand that ISY is not a linear programing language but rather an event based triggerred calculation engine? Edited November 8, 2019 by larryllix
mmb Posted November 8, 2019 Author Posted November 8, 2019 (edited) On 11/7/2019 at 9:52 PM, larryllix said: Inspect your notification values. You were sending a state variable before that was being updated dynamically with the current value, not your calculation result. Thanks I posted the Notification values further up in this post and they correspond to the values in the Variables/Integer table. If there was a state variable it was a mistake as all of the variables were supposed to be numbers and should be in that table. Edited November 10, 2019 by mmb
larryllix Posted November 8, 2019 Posted November 8, 2019 Maybe if you just "copy to clipboard" your actual programs, and posted them here, somebody could take a look at what you are doing. You haven't shown your If sections or what is triggering your program to run.
mmb Posted November 8, 2019 Author Posted November 8, 2019 3 minutes ago, larryllix said: Maybe if you just "copy to clipboard" your actual programs, and posted them here, somebody could take a look at what you are doing. You haven't shown your If sections or what is triggering your program to run. For testing this is entire program, can't be any simpler. No triggers, just a right click and Run Then. The first line is the Polyglot/ISY device that holds the outdoor temperature. The actual program is disabled for now until I get the F -> C working again. So if TempC is assigned to the value of the Polyglot/ISY value the calculations are ignored. If I manually assign TempC it works perfectly. It's weird : )
larryllix Posted November 8, 2019 Posted November 8, 2019 (edited) 22 minutes ago, mmb said: For testing this is entire program, can't be any simpler. No triggers, just a right click and Run Then. The first line is the Polyglot/ISY device that holds the outdoor temperature. The actual program is disabled for now until I get the F -> C working again. So if TempC is assigned to the value of the Polyglot/ISY value the calculations are ignored. If I manually assign TempC it works perfectly. It's weird : ) Yes but you weren't using a factor of 0.555 in a v4 program. Did you power cycle your ISY yet? Have you saved the program yet? Show us the actual code by copying and pasting. Edited November 8, 2019 by larryllix
mmb Posted November 8, 2019 Author Posted November 8, 2019 3 minutes ago, larryllix said: Yes but you weren't using a factor of 0.555 in a v4 program. Did you power cycle your ISY yet? Have you saved the program yet? Show us the actual code by copying and pasting. Yup I migrated everything to v5 in the spring as is and the -32 and *0.5555 went with it. The program was in a disabled state because no need for a Humidifier during the summer. I decided this week to get it going but it was spewing wacky results. So I made a small test program for this post. Reboot - I worked in IT for 20 years so reboot and power cycle were the first things I did. Changed and saved many many many times. Copy and Paste this code references the Polyglot/ISY Weather Service Device <?xml version="1.0" ?><triggers><d2d><trigger><id>33</id><name>Temp Calc</name><parent>1</parent><if></if><then><var id="1" type="1"><op>EQ</op><status id="CLITEMP" node="n002_wu" uom="17"/></var><wait><seconds>1</seconds></wait><var id="1" type="1"><op>SUB=</op><val prec="0">32</val></var><wait><seconds>1</seconds></wait><var id="1" type="1"><op>MUL=</op><val prec="4">5555</val></var><wait><seconds>1</seconds></wait><notify content="21">1</notify></then><else></else><comment></comment></trigger></d2d></triggers> Thanks again1
larryllix Posted November 8, 2019 Posted November 8, 2019 Use the "Copy to clipboard" function and paste the real program.
mmb Posted November 8, 2019 Author Posted November 8, 2019 7 hours ago, larryllix said: Use the "Copy to clipboard" function and paste the real program. Oops, here it is Temp Calc - [ID 0021][Parent 0001] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then $TempC = 'MQTT Controller / wu' Temperature °F Wait 1 second $TempC -= 32 Wait 1 second $TempC *= 0.5555 Wait 1 second Send Notification to 'Default' content 'Temp Notify' Else - No Actions - (To add one, press 'Action')
apostolakisl Posted November 8, 2019 Posted November 8, 2019 31 minutes ago, mmb said: Oops, here it is Temp Calc - [ID 0021][Parent 0001] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then $TempC = 'MQTT Controller / wu' Temperature °F Wait 1 second $TempC -= 32 Wait 1 second $TempC *= 0.5555 Wait 1 second Send Notification to 'Default' content 'Temp Notify' Else - No Actions - (To add one, press 'Action') 1) Try putting a wait 5 seconds as the first line of "then" (before everything else) 2) Increase other waits to 2 seconds 3) Add a testing variable at each step and just have it count 1, 2, 3 ie $test = 1 after the wait 5 seconds, then $test = 2 after the second wait, etc. 3) Right click on program in tree and hit "run then" 4) Go to variables page in less than 5 seconds, watch the variable change values and see where it goes astray. The only thing I can think of is that you have another program modifying the value midstream or stopping this program. The 1, 2, 3 will assure you that it kept moving through each step, and then the values of TempC will show you what math is happening.
MWareman Posted November 8, 2019 Posted November 8, 2019 Are you absolutely sure your initial variable assignment does not contain the ‘F’?If it does, it likely won’t work.With network and email substitutions this is common and UDI now allow to append .RAW (to get the number without any extra characters). Not sure how to do this inline though - but you could create a network rule to set the variable.
mmb Posted November 8, 2019 Author Posted November 8, 2019 (edited) On 11/8/2019 at 3:11 PM, MWareman said: Are you absolutely sure your initial variable assignment does not contain the ‘F’? If it does, it likely won’t work. With network and email substitutions this is common and UDI now allow to append .RAW (to get the number without any extra characters). Not sure how to do this inline though - but you could create a network rule to set the variable. At this point no I'm not sure. I actually had a similar thought, maybe a text string or something. I submitted a ticket so I'll see what they say... Edited November 10, 2019 by mmb 1
mmb Posted November 8, 2019 Author Posted November 8, 2019 41 minutes ago, apostolakisl said: 1) Try putting a wait 5 seconds as the first line of "then" (before everything else) 2) Increase other waits to 2 seconds 3) Add a testing variable at each step and just have it count 1, 2, 3 ie $test = 1 after the wait 5 seconds, then $test = 2 after the second wait, etc. 3) Right click on program in tree and hit "run then" 4) Go to variables page in less than 5 seconds, watch the variable change values and see where it goes astray. The only thing I can think of is that you have another program modifying the value midstream or stopping this program. The 1, 2, 3 will assure you that it kept moving through each step, and then the values of TempC will show you what math is happening. A forum member suggested the same so I tried a 5 sec wait at each calc step, but no change.
apostolakisl Posted November 8, 2019 Posted November 8, 2019 23 minutes ago, mmb said: A forum member suggested the same so I tried a 5 sec wait at each calc step, but no change. But did you watch the variables change on the variable page? This will tell you if the program is passing through all the steps and what values it is giving you at each step. The 1, 2, 3 lets you know the full program ran. If the temp number never changes, then there is a good chance the "number" contains non-numeric info. 1
mmb Posted November 8, 2019 Author Posted November 8, 2019 (edited) 26 minutes ago, apostolakisl said: But did you watch the variables change on the variable page? This will tell you if the program is passing through all the steps and what values it is giving you at each step. The 1, 2, 3 lets you know the full program ran. If the temp number never changes, then there is a good chance the "number" contains non-numeric info. Oh good idea! I see what it's doing, it's taking the Polyglot input of 15.5 F which the ISY thinks is C and converts it to 59 F on the fly, then of course my calculations set it right back to 15.5 C . So now I'll have to see where to adjust it or do the calculation twice which seems dumb. Not sure why the ISY is setup this way. Progress! Edited November 8, 2019 by mmb 1
larryllix Posted November 9, 2019 Posted November 9, 2019 (edited) 1 hour ago, mmb said: Oh good idea! I see what it's doing, it's taking the Polyglot input of 15.5 F which the ISY thinks is C and converts it to 59 F on the fly, then of course my calculations set it right back to 15.5 C . So now I'll have to see where to adjust it or do the calculation twice which seems dumb. Not sure why the ISY is setup this way. Progress! ISY will be fine. Very few have ever had bugs that are not user problems. You have a lot of programming experience, but the event based programming throws many seasoned linear programmers for a loop, at first. The injected Waits for variable manipulation is a good debugging tool. I have used it a few times for complex arithmetic where intermediate results would normally be hidden. You will learn to fly with ISY. It's a fabulous toy and a powerful tool. Edited November 9, 2019 by larryllix
mmb Posted November 9, 2019 Author Posted November 9, 2019 3 hours ago, larryllix said: ISY will be fine. Very few have ever had bugs that are not user problems. Well this is basically how my Program temperatures work. Weather Service in F -> Polyglot/ISY multi sensor in C -> ISY Program Reprocessing from F to C -> ISY Program Rules Processing in C -> Results in C It may be a user problem but below wasn't entirely intuitive that the ISY had to switch to Programming in F. I have a ticket to see if I can get more details, like why can't the ISY multi sensor be in F.
larryllix Posted November 9, 2019 Posted November 9, 2019 (edited) 5 minutes ago, mmb said: Well this is basically how my Program temperatures work. Weather Service in F -> Polyglot/ISY multi sensor in C -> ISY Program Reprocessing from F to C -> ISY Program Rules Processing in C -> Results in C It may be a user problem but below wasn't entirely intuitive that the ISY had to switch to Programming in F. I have a ticket to see if I can get more details, like why can't the ISY multi sensor be in F. There is a switch for metric on the ISY administration page IIRC. You may have to reboot ISY after. I have banks of synchronisation programs where any input that requires the values tailored is automatically stuffed into a state variable to trigger other processes. I have one that takes three outdoor temperature sources, applies individual scaling factors, and averages them, tossing out any sensor that has drifted more than 2 degrees C from the average, and then recalculating the average using the remaining two. I use this variable resultant to trigger all my other programs requiring a reliable outside temperature. Every sensor gets sun at some point in the day. Living on a small mountain the sun travels almost 240 degrees around us each day in the summer. Edited November 9, 2019 by larryllix
mmb Posted November 9, 2019 Author Posted November 9, 2019 14 hours ago, larryllix said: There is a switch for metric on the ISY administration page IIRC. You may have to reboot ISY after. This applies to the climate module - correct? I don't have that one...
Recommended Posts