evq / lutron-spy

Control REST interfaces with Lutron Pico remotes and a rooted Wink hub
MIT License
15 stars 5 forks source link

Data in remote-config.json not posting #7

Open jaredloman opened 9 years ago

jaredloman commented 9 years ago

I'm not sure if this is an issue with the script or perhaps an issue with the "scripter" (me) ... but no data seems to be posted from remote-config.json on pico button press.

When SSH'd into the hub I press a button on the pico remote and can see it output the Serial Number, Button Number, Nickname & Data (whether json or plain text) and then it just hangs there until I press "Return" or "Ctrl+C".

The API that I'm posting to is functioning correctly as I also built a web interface to control devices and I can also use curl or just a standard GET request in browser to trigger lights but for some reason, it does not work on button press.

For testing, I wrote a quick php script that would write out a file to the hub with all the data in the $_REQUEST variable but although the file gets written (showing me that something is working) no data is ever available in the post.... UNLESS I add it directly to the URL (i.e. http://127.0.0.1/test.php?id=1)

I've tried simplifying the data to plain text and just sending a simple string "test" and I've tried sending json as well.

So, my question... Should I actually able to send the data I've put in the remote-config.json file or do I need to include any data in the actual URL?

Edit: I should also note that although GET works in browser... it doesn't work on pico button press (except in the case of my test script which simply writes the parameters to a txt file). I'm baffled...

Edit #2: I can successfully send attributes to my API through the URL as GET params (i.e. ?&id=1&test=abc) as long as the method is set to "POST". Weird eh?

P.S. - A little bug on the main page example of remote-config.json - It's missing the opening "{" :)