Posts: 752
Threads: 156
Joined: Aug 2006
I've gotten far enough to have GeoFancy installed. Also installed HTTP Trigger driver and have it trained to catch
http://<server>:45821/<Random15DigitNumber>HomeAwayStatus/SetStatus?User=Sendero&Value=Away
Now, how specifically do I parse out the User and Value fields so that I can set a Global Variable value to either true or false and then trigger events based on that?
Posts: 40,483
Threads: 491
Joined: Aug 2002
The two values will be passed to the action, and will show up as the 2nd parameter. The first parameter is the name of the action invoked. The 2nd parameter will be "Sendero Away", i.e. the two values, space separated.
You can use the System::GetNthToken command to pull out the two separate values to variables.
The parameters are available via the usual sort of tokens, which you can get to via the insert popup menu in the action editor.
Dean Roddey
Explorans limites defectum
Posts: 40,483
Threads: 491
Joined: Aug 2002
Did you get this figured out?
Dean Roddey
Explorans limites defectum
Posts: 752
Threads: 156
Joined: Aug 2006
yes, was just coming back to post a thank you!
At first I was getting TokenExpansion errors in the logs when calling GetNthToken. But then I first wrote the action parameter value to a local variable before using GetNthToken against the local variable.
Now I have it working as I want. Thanks again for the help!
LocalVars::SetVariable
P1=LVar

arams
P2=%(LVar:CQCActParm_2)
System::GetNthToken
P1=%(LVar

arams)
P2=
P3=1
P4=LVar:User
System::GetNthToken
P1=%(LVar

arams)
P2=
P3=2
P4=LVar:IsHome
Devices::FieldWrite
P1=VariableDriver.HomeStatus_%(LVar:User)
P2=%(LVar:IsHome)
P3=True
Posts: 719
Threads: 64
Joined: Jan 2013
Hijacking thread...
Any idea what I'm doing wrong? I'm not getting the variables returned in the logmsg output. I highlighted all the pieces.
https://s3.amazonaws.com/uploads.hipchat...upload.png
It seems %(LVar:CQCActParm_1) gets populated but %(LVar:CQCActParm_2) does not.
in the screencap the last line in the action is cut off. It has a message field of : act 1%(LVar:CQCActParm_1) 2%(LVar:CQCActParm_2)
--Kill all the serial ports--
Posts: 40,483
Threads: 491
Joined: Aug 2002
Just looking at it by eye, it looks correct to me. What version of CQC are you on? I know that, there was an issue there for a while during the betas when the HTTP stuff was being redone to support encrypted connections. But that was fixed, presumably, in the 904 beta, so if you are on anything beyond that then that error shouldn't be an issue.
Dean Roddey
Explorans limites defectum
Posts: 719
Threads: 64
Joined: Jan 2013
Using 4.6.912
--Kill all the serial ports--
Posts: 40,483
Threads: 491
Joined: Aug 2002
I just tried it and it's working fine for me. So, I'm guessing it's just some side effect of the many changes to the HTTP stuff, other than the obvious one I fixed in 904. I can't guarantee that, but it's likely enough (given the enormous changes made to the HTTP stuff and the fact that some remaining issues were just taken care of in the last couple betas) that it's worth moving up to the latest version to be sure.
Dean Roddey
Explorans limites defectum
Posts: 719
Threads: 64
Joined: Jan 2013
I updated to 920 and the same results. I tried re-training it a few different ways (with and without the params).
Any idea what else might be wrong?
--Kill all the serial ports--
Posts: 40,483
Threads: 491
Joined: Aug 2002
Hmm.... Let's simplify here. Train another one, and set it up to just do nothing but log the values of the first two action parameters, just to be sure there's not something obvious we are missing in the other stuff.
Dean Roddey
Explorans limites defectum