-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overview of http commands available? #417
Comments
Good idea, I will do something later. The commands are basically the same as the function names in the model or control file I think.Paddy
|
I used the directory command here: https://www.thedigitalpictureframe.com/expand-your-digital-picture-frame-use-cases-with-pi3d-integrated-usb-media-stick-support/ Tried to figure out the full list with your HTTP frontend and Google Console but that only worked for a few commands. Things like next/back I couldn't figure out, pause or display on/off was easy. |
Hi Wolfgang, Paddy's the expert here but until he chimes in you can always open Chrome dev tools, go to the network tab, and see what the existing HTML web page sends with each command. For example, here are a few for reference. Just provide the IP address and port of your frame along with the command. So, something like this:
|
Thanks Jeff, that's a really useful way of hacking all kinds of web accessible gadgets such as solar inverters etc etc. Chrome (or firefox) can basically give you the recipe for what you need to feed from your DIY app. The HTTP interface gets a list of methods from the picframe/src/picframe/interface_http.py Line 120 in 6540065
You can then send the method name = method argument as GET arguments to the HTTP server. i.e. like Jeff says
PS I'm doing this from the file listing as I'm away from an actual picframe to test on. I will double check the actual syntax when I'm home!!! |
Thanks, @paddywwoof and @jgodfrey ! The trick was to use the Chrome dev tools, right click on the value and say "copy as cURL". That gives the full command. It's great to see that so many parameters can be remote controlled! I wasn't aware of that. Blog article coming up... :-) |
Hi @sapnho, it does look a little strange that you have to escape the curly brackets. How are you sending the instructions to the http server? It may be different when entering on the address bar of a browser. My list is what I would expect for python along the lines of: from urllib import request
URL = "http://localhost:9000"
...
request.urlopen(f"{URL}?display_is_on=OFF")
request.urlopen(f"{URL}?brightness=0.0")
request.urlopen(f"{URL}?next={{}}")
request.urlopen(f"{URL}?set_show_text={{\"txt_key\":\"title\",\"val\":true}}") I've escaped the quote marks in the last command but it should also work with NB including variables in strings like this means that the This is the HTML/js code for the simple web interface https://github.com/helgeerbe/picframe/blob/main/src/picframe/html/index.html Also I might be wrong with some of this, I will check the details when I get home. So maybe hold off actually publishing your blog for a day or so!! Paddy |
Hi, I've checked this out now I'm in contact with a picframe. Most of the commands work as I expected but if entering the string using |
@paddywwoof How would I send an HTTP command to show both date and location? I only manage to do one thing at a time. |
Hi, Although the parts of the text to show are controlled by a cunning bit-field system, the method that changes each bit only works one bit at a time... with the exception of turning them ALL off, which can be done by calling request.urlopen(f"{URL}?set_show_text={{}}") In order to turn on both date and location you would then need to send two requests: request.urlopen(f"{URL}?set_show_text={{\"txt_key\":\"date\",\"val\":true}}")
request.urlopen(f"{URL}?set_show_text={{\"txt_key\":\"location\",\"val\":true}}") |
Do we have a primer on HTTP commands for PictureFrame like Helge did for MQTT?
I am just playing around with a few ideas where I need to send HTTP commands to PictureFrame but somewhat my syntax isn't quite right yet.
The text was updated successfully, but these errors were encountered: