Charmed Quark Systems, Ltd. - Support Forums and Community
Querying Garade Door w/ Echo - Printable Version

+- Charmed Quark Systems, Ltd. - Support Forums and Community (https://www.charmedquark.com/vb_forums)
+-- Forum: General Discussion (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=3)
+--- Forum: CQC Support (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=9)
+--- Thread: Querying Garade Door w/ Echo (/showthread.php?tid=10134)

Pages: 1 2 3 4


Querying Garade Door w/ Echo - rbejr - 01-24-2017

I've been trying to poll the status of my garage door using the Echo but can't seem to get it to work.  The skill is set up and working properly, and I can see in the log monitor that the phrase is being picked up correctly so I believe the config file is correct.

This is the global action I have:

If System::Equals(GC100-Garage1.IRSensor1,False, No Case)
   GlobalVars::SetVariable(GVar:EchoReply, The Garage Door is Closed)
Else
   GlobalVars::SetVariable(GVar:EchoReply, The Garage Door is Open)
End

When I run this I always get the response "The Garage Door is Open," even when it's closed.  I can see from the driver that the sensor shows a False value when the door is closed and a True value when the door is open.  Is there something wrong with my action statement?


RE: Querying Garade Door w/ Echo - wuench - 01-24-2017

You have to dereference the field variable, you want to compare the value of the field to False not the field's name to False. $(GC100-Garage1.IRSensor1) not just "GC100-Garage1.IRSensor1".


RE: Querying Garade Door w/ Echo - rbejr - 01-24-2017

I thought that's what I was doing.  I also tried using a fieldread first to read the value of the field into a variable and then compare the variable to False but that didn't work either.  How can I use the action editor to compare the field value to false?


RE: Querying Garade Door w/ Echo - Dean Roddey - 01-24-2017

It would be like this:

Code:
If System::Equals($(GC100-Garage1.IRSensor1), False, No Case)

The way you are doing it, you were literally comparing "GC100-Garage1.IRSensor1" to "False". By 'dereferencing' the field name, you get the value, So $(GC100-Garage1.IRSensor1) gets replaced by the actual value of the field when the command is run.


RE: Querying Garade Door w/ Echo - rbejr - 01-25-2017

Thanks Dean, I'll try that when I get home from work tonight.


RE: Querying Garade Door w/ Echo - rbejr - 01-25-2017

Is the referencing and dereferencing of fields and variables covered in the reference material somewhere?  Also, is there a way to access the reference material from the website directly?  I'm at work and don't have access to the computer at my house where CQC is running.


RE: Querying Garade Door w/ Echo - Dean Roddey - 01-25-2017

The HTML docs are not currently on the web site. But it's in "/Help/Docs/Actions/Big Picture". That provides the overview of how actions work. The "Token Replacement" page in there provides a lot of info on how fields and variables are referenced in actions using 'tokens' that are replaced when the action is run. There are various options that allow you to format the value as well.


RE: Querying Garade Door w/ Echo - rbejr - 01-25-2017

I changed the action to read:

If System::Equals($(GC100-Garage1.IRSensor1, False, No Case)
   GlobalVars::SetVariable(GVar:EchoReply, The Garage Door is Closed)
Else
   GlobalVars::SetVariable(GVar:EchoReply, The Garage Door is Open)
End

But I still only get the response "The Garage Door is Open" even when its closed.


RE: Querying Garade Door w/ Echo - Dean Roddey - 01-25-2017

If that's literally the text, you forgot the closing parenthesis. It has to be $(GC-100-Garage1.IRSensor1). The easiest way to do it is to right click in the parameter entry field. Select Insert -> Field. Select the field, and check the By Value check box. That will insert it with the appropriate derefencing stuff.


RE: Querying Garade Door w/ Echo - rbejr - 01-26-2017

So, I got it working by fixing the syntax and properly dereferencing the variable.  Now I'm stuck on a second garage door I have that uses an Insteon I/O Linc and is controlled via an ISY994.  At first I was having problems dereferencing the variable on this one too because I couldn't figure out how to get the ) after the field. 

If System::Equals($(ISY994i.Garage2Door-Sensor_..., False, No Case)

I guess there must be a limit to how many characters a field can contain?  So, I changed the moniker to make it shorter and was able to add the ) which I thought would solve the problem.

However, the statement below still gives me the response "The West Garage Door is Closed" even when it's open.  When I view the ISY driver I can see it's working properly and generating a False when the door is closed and a True when the door is open.  Aside from referencing the ISY it's the same  action statement as the other door controlled by the GC-100 that is working.

If System::Equals($(ISY.Garage2Door-Sensor_Switch), False, No Case)
   GlobalVars::SetVariable(GVar:EchoReply, The West Garage Door is Closed)
Else
   GlobalVars::SetVariable(GVar:EchoReply, The West Garage Door is Open)
End

I don't get it.   Huh