Your Universal Remote Control Center
RemoteCentral.com
RS-232 & IP Control Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Control Sony STR-ZA3100ES via Web Remote request.cgi Codes - Curl & Apple Shortcuts
This thread has no replies.
Post 1 made on Friday May 17, 2024 at 18:15
RandyInLA
Lurking Member
Joined:
Posts:
November 2011
1
Been searching here & the Internet for a few days and have found zero posts/info about controlling a sony product (STR-ZA3100ES for me) via POST webhook calls to request.cgi that the web browser remote uses.

Sony STR-ZA3100ES web browser remote control

When I click the MUTING button on the web remote and inspect the POST to request.cgi in the Network tab of the browser, I see a json packet of:

{"type": "http_set", "packet": [{"id": 1, "feature": "GUI.muting", "value": "main"}]}

The bolded text appears to be the only values that need to be changed for different commands. The actual id number is different for every click on the web remote but I found that, for simplicity, I can always use 1 when creating my own POST call via Curl or even the iPhone Shortcuts app.

You can open the Network tab on your browser and inspect the request.cgi call for every button to get the codes. eg.GUI.muting w/value 'main', main.power w/value 'on' or 'off' (discreet on/off power codes). I haven't found discreet mute on/off codes, but you can force an unmute state by following a GUI.muting call with a call to GUI.volumeup.

CURL:
Here's my Curl command (using macOS terminal) for MUTING (must escape internal quotes. I think I couldn't make it work with single outer quotes & double inner... will have to test that again):
     curl -X POST "http://ip-address-of-amplifier/request.cgi" -H "Content-Type: application/json" -d "{\"type\": \"http_set\", \"packet\": [{\"id\": 1, \"feature\": \"GUI.muting\", \"value\": \"main\"}]}"

I originally set the Curl commands in individual macOS Automater scripts and then assigned them to keyboard shortcuts on my mac so I had instant control of vol/muting in any app on my computer without having to pick up a remote or even say anything to Siri.

APPLE SHORTCUT (SIRI):
I couldn't figure out how to insert the proper array/dictionary JSON data in the Get contents of URL action since Shortcuts doesn't show you a preview of what it actually sends. So I figured out I could construct the JSON in a Text action and then set Get contents of URL Request Body to, "File" and point it to the Text output.
  1. Insert Text action: {"type":"http_set", "packet":[{"id":1, "feature":"GUI.muting", "value":"main"}]}
  2. Insert URL action: http ://ip-address-of-amplifier/request.cgi (no spaces)
  3. Insert Get contents of URL action: 
  • set URL to URL action above
  • click the > button to reveal header/body section
  • Set Method to POST
  • Click Add new header and set key: Content-Type, Text: application/json
  • Set Request Body to File
  • Set Choose Variable to the Text action listed so it uses the hand-written JSON in the first Text action above
If you're not familiar with Shortcuts, you can speak the title of each Shortcut to Siri for hands free voice control. So since I named the Shortcut this way, I can say, "Siri, TV Audio" to toggle muting.

If anyone knows of a Sony protocol document for this (and other) request.cgi calls, please add it to the thread.

The web control has a page to configure the 4 Custom Presets but doesn't provide a way to call up the presets using the remote, so I don't have a way of changing them at present. If I figure the code out, I'll come back and update this post.

CODES I USE SO FAR:
  • "button: feature / value"
  • MUTING: GUI.muting / main
  • Power On: main.power / on
  • Power Off: main.power / off
  • Vol UP: GUI.volumeup / main
  • Vol Down: GUI.volumedown / main
  • Home: GUI.home / pulse
  • UP: GUI.up / pulse
  • Down: GUI.down / pulse
  • Left: GUI.left / pulse
  • Right: GUI.right / pulse
  • Enter: GUI.enter / pulse
  • Return: GUI.return / pulse
  • Option: GUI.optionmenu / pulse
These are just the codes I wanted to use that actually had buttons on the web remote. All of the codes for the web remote can be found in the remote.js file (look under the Sources tab of your web browser, top > main (remote.htm) > (ip address of your amp) > settings > remote.js (click on it to view it or right click to view in tab or save locally)

I don't know why my image of the web remote isn't appearing above. I'll try to figure that out and fix later. If I can get the image issue resolved, I'll take/add screenshots of each Shortcut action.

Hope this is of some use to someone trying to control their Sony STR-ZA####ES product or possibly other Sony products with similar web control.

Last edited by RandyInLA on May 18, 2024 12:59.

Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse