Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Am I misusing System Equals?
#1
I am trying to create an event that will turn an HVAC booster fan on.  I want it to run when the furnace is calling for heating or cooling.  

I initially set it up as two separate triggered events, one for on & one for off.  I used the "Fld Value equals" trigger & it seemed to work.  However, it wasn't as reliable as I'd like, so I decided to try a "Is Field Change For" trigger & do some event processing.  Now, it will turn the fan on...but not off.  My logic is failing at the "If" test & I think I must be missing something pretty basic.

The fields Thermostats_V2.Main_HeatStage1Stat & Thermostats_V2.Main_CoolStage1Stat are both MEng.Boolean fields.  When they are both "False," the If statement below still evaluates as "False: and executes the "Else" option & sends a command to keep the fan running.

Any thoughts would be appreciated.

---------------------------------------


// Trying to make a generic control for the Booster Fan vs having to have separate commands
//
// Get Current Status of Furnace into Local Vars (Call for heat or Cooling)
// There is no direct read of Fan Status from RCS Driver (it is controlled by furnace board)
//
LocalVars::CreateVarFromField
    P1=LVar:MainHeating
    P2=Thermostats_V2.Main_HeatStage1Stat

LocalVars::CreateVarFromField
    P1=LVar:MainCooling
    P2=Thermostats_V2.Main_CoolStage1Stat

//
// The only case that comparison should be False is if the Fan needs to be on
// There cannot be a True/True...Unless there is a malfunction
// False/False - Fan should be off
// True/False or False/True - Normal call for heating or cooling
//
If
System::Equals
    P1=LVar:MainHeating
    P2=LVar:MainCooling
    P3=No Case

//
// Evaluates as True...This means it is False/False (No heat or Cool) or True/True (Malfunction)
// Either Way, we want the fan off
Devices::FieldWrite
    P1=Insteon-ISY.LGHT#Sw_HVACBoosterFan
    P2=False
    P3=True

//
Else

// Turn the fan On
Devices::FieldWrite
    P1=Insteon-ISY.LGHT#Sw_HVACBoosterFan
    P2=True
    P3=True

End


-------------------

Thanks
Reply
#2
I don't know if I can quite speak to the logic being correct or not in your event but some things to check and/or try. Also not sure your comfort level with the interfaces and tools so if anything doesn't make sense below just ask and I'll try and clarify further.

Have you set up an actual trigger on the field that will kick of that logic to run? Make sure it's set to send a trigger on any value change. That will run the above logic whenever the you set field changes. (Sounds like it is triggering one way only) - could be the trigger is off.

I use "is field change for" on most of my events for stuff like you are doing. Seems like the right way and the IF statement looks to be used right from what I can tell of your example. You could also just use two if's and trap just two of the scenarios you want vs the Else which will run on anything other than the first if logic.

Two other things to try to narrow down the issue:
1. Set the log invocations check box on in the event setup screen (where you set "is field change for" etc.)- then start the monitor log server app and watch to see if your trigger is working or not. Every time it runs it should print to the log. Make sure it is running on the events you expect. If not check your trigger logic.

2. If it's the action itself that is not quite right you and verify that too. Copy and past your Action logic into a regular button in an template and just try running it from there. Enable the Action Trace screen (View --> Action trace on). That will show you a window that will show each step and if anything is failing or giving unexpected results.
-Mike G
Reply
#3
Thanks for the help.   I rechecked everything as you suggested & it all appears good.  However, I didn't try creating a button on a template yet...I will (hopefully) get to that today.

I will report back what I find....even if it is nothing.
Reply
#4
Thanks for the suggestions, it really helped in troubleshooting.

Problem resolved...but I still have a question.


I created the very simple template & both variables were False, yet the "Equals" function evaluated the comparison as "False," and executed the "Else" commands.  Earlier, I thought I had a token problem & tried to use the $(Lvar: MainHeating), etc in the system:Equals parameters..but I kept getting an error.  Therefore, I thought I didn't need it.

I finally got rid of the Local variables and just ran a direct comparison:
If
System::Equals
    P1=$(Thermostats_V2.Main_HeatStage1Stat)
    P2=$(Thermostats_V2.Main_CoolStage1Stat)
    P3=No Case

This gave me the expected behavior!!

My question is why this didn't work when I tried to use the $ in front of the local variables.
Reply
#5
(01-28-2022, 08:35 AM)Spot Wrote: Thanks for the suggestions, it really helped in troubleshooting.

Problem resolved...but I still have a question.


I created the very simple template & both variables were False, yet the "Equals" function evaluated the comparison as "False," and executed the "Else" commands.  Earlier, I thought I had a token problem & tried to use the $(Lvar: MainHeating), etc in the system:Equals parameters..but I kept getting an error.  Therefore, I thought I didn't need it.

I finally got rid of the Local variables and just ran a direct comparison:
If
System::Equals
    P1=$(Thermostats_V2.Main_HeatStage1Stat)
    P2=$(Thermostats_V2.Main_CoolStage1Stat)
    P3=No Case

This gave me the expected behavior!!

My question is why this didn't work when I tried to use the $ in front of the local variables.

% is used in front of local and global variables, and $ is used on device fields.  I am sure there is a reason, but not sure why.  That mistake has probably been done by every CQC user multiple times.
Reply
#6
The reason is that $ is what says it's a device field and % is what says it's a variable. Anyone could create a device named LocalVars, at which point $(LocalVars.x) and %(LocalVars.x) would be what distinguishes which of those things you mean.
Dean Roddey
Explorans limites defectum
Reply
#7
Dean,

Thanks for explaining the "why" it really helps.  It also underscores the thought that went into the design of the language.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unhandled system exception in the GUI Thread gReatAutomation 9 2,287 03-23-2020, 01:03 PM
Last Post: Dean Roddey
  Unhandled system exception in GUI Thread Shaky 75 20,875 06-21-2019, 08:10 PM
Last Post: kblagron
  DIY Security System Integration cavalier240 10 4,967 01-10-2019, 09:05 PM
Last Post: Dean Roddey
  Does the auto-gen template system support Roku? ghurty 3 2,350 12-31-2018, 06:14 PM
Last Post: Dean Roddey
  Aeotec not starting fast enough on system reboot IVB 3 1,957 12-15-2018, 04:57 PM
Last Post: Dean Roddey
  GetCurMillis immune to system time change? rbroders 6 2,579 12-09-2018, 02:58 PM
Last Post: rbroders
  System.Runtime.FileSystem documentation missing? rbroders 1 1,566 11-25-2018, 07:44 PM
Last Post: Dean Roddey
  System Config tom 13 4,789 11-04-2018, 06:45 PM
Last Post: Dean Roddey
  If starting fresh, what is the best garage door system to go with to work with CQC? ghurty 1 1,735 08-30-2018, 03:23 PM
Last Post: znelbok
  What CQC compatible sound system can support 14 rooms? ghurty 14 7,324 08-05-2018, 07:18 AM
Last Post: zra

Forum Jump:


Users browsing this thread: 1 Guest(s)