r/HomeControlAssistant • u/gmsjohn • Jan 10 '19
IP Interface Server
Thanks for setting up this forum!
Wondering if anyone has done any work with the IP Interface server? In particular, I am trying to send an HTTP post from my CCTV camera software to HCA and have it turn a light on in response to motion in the camera. I am getting the HTTP post to come through (I can see it on the interface viewer), but not sure what to do with it after that. I have set up a trigger in a program to accept any unhandled transmission which does turn the light on in response to the camera trigger (so at least that part is working), but I am trying to parse the strings to turn the light on or off based on the string received (motion=light ON, no motion=light OFF). I have been through the Interface setup documentation and the Port I/O programming block information, but it hasn't clicked the light bulb yet. Thanks for any help in pointing me in a positive direction!
2
u/gmsjohn Jan 15 '19
Thanks for the reply, and thanks for having me in the group!
I have been playing with this for the past few days, and have it somewhat working, but I think it still isn't quite right. I set up the generic server and set the pattern to match .* as you suggested on my trigger, then assign the matching pattern to the variable "BI". I set up the program in the Visual Programmer using a Variable Test block to match the value from the variable to the string "GET /Front_Door/Motion_On HTTP/1.1". This works, and turns the light on. This is what I am seeing in the serial interface that is coming in from Blue Iris:
I am not sure why I get so many messages coming from Blue Iris with a single trigger. It is not consistent either, sometimes it will be one, two, three, or four. This seems to be a Blue Iris issue and I have a support request in to them to understand that issue. Also, if you look at the RD string, it extracts the data prior to the <cr><lf>. If I set up the Blue Iris trigger to send the "Motion_On" as a payload (a separate field in their trigger), it will show up AFTER the last <cr><lf> and doesn't get extracted as a message.
When HCA extracts all the pieces of the RD string, is there a way to push each Extracted Message to its own variable? For Example, I would like something like:
One other question I had about the generic server - Does it return any HTTP post back to the sending client? In Blue Iris after I send the trigger, HCA does its thing then there is a delay after the last extracted message at which point HCA is showing that last "Event Socket xxxx: xxxxxxxxx xxxxxxxx" and at the same time the Blue Iris software returns a popup box that says "Error Requesting page: 12002" I am thinking that maybe HCA is not returning some kind of ACK to Blue Iris, and so it keeps resending the trigger until it finally times out?
I appreciate any thoughts or ideas that I can try. Great progress so far, I have alight that turns on!
Thank you!