maddox / harmony-api

🗼 A simple server allowing you to query/control multiple local Harmony Home Hubs over HTTP or MQTT
MIT License
393 stars 115 forks source link

Possible to replace POST requirements with GET in source? #88

Closed HVR88 closed 6 years ago

HVR88 commented 6 years ago

It looks somewhat easy to change the POST functions to GET, just wondering if anyone else has made this type of change for their own private use and if it's as trivial as it looks (cursory glance through the source)

maddox commented 6 years ago

All of the POST methods effect change in state and are POST for a reason. They should not be GET as that method is just for reading state.

Is there a reason you need them to be GET methods instead?

HVR88 commented 6 years ago

Yes, I have a particular proprietary product (wifi remote control, MX-5000 from URC) that can hit an IP/PORT with a relatively simple string, but that I can't alter to do anything more. So for instance, the easiest way to make one of these devices trigger this API to provide IP/PORT and the rest of a (simple) URL as payload.

Most devices that are IP controlled and supported by this remote use relatively simple listening ports, and accept ascii or hex data over something as basic as telnet. In such a case you specify IP, port and a simple string, like "MVUP" for Volume Up on a Marantz AVP/AVR. Following the same limitations it's possible to specify the port of an http listener, but then you're limited still to some string, so in essence a URL as a browser would pass a site.

Anything more complex would likely require a 2-way module tailored for the device the MX-5000 is trying to control - and that's not something anyone outside URC can develop.

I'm not saying it's recommended or needed for anyone else, but to work with what I have, it looks like a necessity.

HVR88 commented 6 years ago

This would conceivably also work as PUT. Cross-referencing a number of devices that can apparently be controlled with this remote, many Yamaha (for example) seem to require PUT, which means that the remote must work as its setup software includes a suite of IP commands for those products.

maddox commented 6 years ago

¯(°_o)/¯ you could just fork it and change them to all GETs and it would work for you.

HVR88 commented 6 years ago

That's all I needed to hear. :) No desire for you to incorporate this in the master whatsoever, I just need something "that works" basically to bridge the HH to my URC remote.