11-26-2015, 09:34 AM
Users browsing this thread: 1 Guest(s)
Calling animations through REST
11-26-2015, 09:34 AM
05-29-2016, 03:44 AM
(11-25-2015, 05:38 PM)Adam Wrote: @Buhlinky - Thanks! Glad you like it.
I tried executing the above command (including "/api" at end), but I get Error 500. This is my command:
"all_softwhite" is indeed an animation that works fine from the web interface. This is the response that I obtain:
I need this for controlling my LEDs using external equipment that is connected to my wifi.
05-29-2016, 08:23 AM
a) is the data you are sending exactly what gets sent by PixelWeb itself? Set ___printAPIOutput=true in the JS console to see what it sends.
b) If it throws this error to curl, it should show an error in the console. What does that say?
05-29-2016, 10:21 PM
(05-29-2016, 08:23 AM)Adam Wrote: Two questions:
a) Yes, I tried that and the data that I am sending is copied from console.
b) I do not get any errors in the console when using PixelWeb.
05-29-2016, 10:56 PM
Ahh.. solved it. It's your quotes. you put double quotes around the data and the data contains double quotes. Use single quotes (', not ") to wrap the data portion. I also wrapped the URL in single instead of double for good measure and then it worked fine.
05-30-2016, 03:04 AM
(05-29-2016, 10:56 PM)Adam Wrote: Ahh.. solved it. It's your quotes. you put double quotes around the data and the data contains double quotes. Use single quotes (', not ") to wrap the data portion. I also wrapped the URL in single instead of double for good measure and then it worked fine.
Just tried that, but cURL for windows has issues with single quotes (and this unfortunately needs to be done on windows).
But this worked:
Thanks for your hint about quotes. I was able to dig around and found the solution.
05-30-2016, 07:25 AM
Ah.... yeah windows cURL is kind of a pain. Didn't realize. I saw cURL and just assumed linux of some sort. Tested it on Fedora.
Glad you have a working solution now. What's actually calling all of this in the first place?
07-30-2016, 04:03 PM
Greetings -- I have been using BiblioPixel in a Raspberry-Pi-based lighting project that allow for a Lutron RadioRA2 system to control preset LED lighting scenes.
Recently I discovered PixelWeb and have been studying its operation and code in an effort to see how I can upgrade my project with many of its awesome features.
I really like the animation configuration features and the ability to save presets, and all in a rather nice web-GUI -- it's exactly the kind of stuff I'm looking for.
I was happy to run across this thread, as it shows I'm not the only one looking for to integrate this stuff into a larger (lighting) control system.
From what I've gleaned so far, there are some of features I'd like to see in PixelWeb that would make it perfect for my application.
The biggest is the ability to start an animation by referencing the QS List / QS Item name (REST/API approach) instead of the current JSON object with all the parameters.
This would allow a novice operator to configure, test, and save their different scenes and my Lutron RadioRA2 integration app to launch them based just a simple naming convention.
At this point, it's not clear to me how to add such a features. I've been studying the code for a about a week, but much of different technologies are new to me so it's a slow process.
I figure by talking about what I'm looking for, there might be some help or pointers in this effort. In any case, I'll keep plugging away at it because I like learning new stuff.
Any and all help is appreciated -- Cheers!
07-30-2016, 04:46 PM
ToddW - Thanks for your interest!
So, that's definitely the direction I've always wanted to move with PixelWeb... especially the ability to call out an animation by name.
There's a couple reasons I haven't yet...
1) I'm not sure all that many people actually USE PixelWeb. Honestly I only say this because there's actually a decently annoying bug in the current version that I cannot figure out so far and no one has reported it I would have if I was a user that found it.
2) You're not the only one that finds the code a little confusing Me too... here's the thing. That was my first web app, ever. So, the code isn't the greatest, and at this point I'm seriously considering a rewrite as opposed to adding new features on the current code base. That may sound drastic, by there's just too many problems I have with the currently chosen technologies that have made me feel like the best option would be to make better choices
If I were to do a "call my animation name", it's entirely possible. Since the data that gets sent to the web client is in the server side config, it's there you would need to start. look in actions.py: getQS() and you can see were it loads a quick select and sends it over. You would then just have to iterrate over the animations in that to find the matching name, then call startAnim() (server-side) with the full config to load the animation.
07-30-2016, 06:02 PM
Cool - Thanks for the pointers. I'll take a stab at this to see if I can't get something going here in the near-term.
I admit that I'm finding web-apps I bit of a challenge atm. Which is why I wanted to leverage PixelWeb as much as possible.
I am learning a lot by reading your code (even if it isn't the best example -- according to you). It would take me months to get to its current level (if ever).
Looking forward to some future version with "better choices".
Would also be interesting in what you think those better choices are -- might influence the direction I go in learning more about developing Web-Apps.