Posts: 4,225
Threads: 365
Joined: May 2005
I am playing with FauxMo and there is an option to get the status of the field to keep it in sync.
How can I send a HTTP request to CQC to reply with the fields current value?
Mykel Koblenz
Illawarra Smart Home
Posts: 40,483
Threads: 491
Joined: Aug 2002
You could to do it by just embedding a field reference in a page. If you create an html file like this:
<html><body>$Device.Field</body></html>
And hit it from a browser, it will come back with the value of that field. If you aren't actually talking to a browser, then you can return whatever you want, so you could embed that value in a JSON object or some such and that text will be returned.
Dean Roddey
Explorans limites defectum
Posts: 4,225
Threads: 365
Joined: May 2005
its not with a browser, its using FauxMo, so as i understand it there are two ways to do it.
One is to have the reply body to the command have the new state in the body (currently i thin we get "Done" and the other is to poll by sending a GET url and the reply will have the current state in the body.
I think I need to for the first option is have an action command that can send the current state and for the second its probably the same unless I can point it the the CQC web server and get it to respond somehow with the requested field - I dont thing creating a html file for every field is going to be a good solution.
Mykel Koblenz
Illawarra Smart Home
Posts: 40,483
Threads: 491
Joined: Aug 2002
If you control the URL that will be sent, do a CGI-Bin type CML macro and just send it the field you want. It can just get the value and format the response.
Dean Roddey
Explorans limites defectum