PUT Method in HTTP Device

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
darkyat
Posts: 11
Joined: 17 Jul 2014 22:41

PUT Method in HTTP Device

Post by darkyat » 05 Jun 2016 20:36

Dear ps,
Dear all,

I have seen several people hacking their Philips Hue Implementation with CodeDevices[1] while it could be fixed by implementing PUT into the HTTP Device.

POST and GET is unfortunately not sufficient for the Philips Hue API.

Accordingly to the Developer API we can only use "GET/POST/HEAD" and therefore I don't see any way to implement this myself: http://razberry.z-wave.me/docs/zwayDev.pdf (Page 40)

Happy to hear your feedback.

Regards,
darkyat

[1] https://forum.z-wave.me/viewtopic.php?f ... 66&p=58033

User avatar
PoltoS
Posts: 4675
Joined: 26 Jan 2011 19:36

Re: PUT Method in HTTP Device

Post by PoltoS » 31 Jul 2016 02:02

Do you mean what we need to add PUT method to our http.request() ?

klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: PUT Method in HTTP Device

Post by klaasjoerg » 11 Oct 2016 09:41

Yes, I would also support to have a "PUT"-Method, because controlling HUE-Lamps do really need GET, POST AND PUT as a method.
Right now I have to call a universal bash-script with some CURL-Parsing doing this job.
e.g. system("/usr/local/bin/hue-universal-schalter.sh on %% 25000 254 4"); for a Codedevice.
However, this basically works, but the problem will be, if you have e.g. 10 HUE-Lamps in your home, calling a system-call will definetively slow down the whole system (Rasbperry pi3 in my case) a lot! If you are going to create/recall scenes with more than one hue (unless you do all the work within the bash-script, but that's not really nice to do....)

So, would be great to have HTTP PUT Methods in some places.
Last edited by klaasjoerg on 10 Nov 2016 11:52, edited 1 time in total.

User avatar
PoltoS
Posts: 4675
Joined: 26 Jan 2011 19:36

Re: PUT Method in HTTP Device

Post by PoltoS » 15 Oct 2016 13:14

Just checked, PUT is supported by http.request() as well as DELETE and HEAD. I'll update the doc once you confirm that it works for you.

klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: PUT Method in HTTP Device

Post by klaasjoerg » 11 Nov 2016 01:02

Hi, ok, but it's not really shown then in the app.
There is only GET and POST selectable...
Attachments
ss.png
ss.png (226.33 KiB) Viewed 5539 times

User avatar
PoltoS
Posts: 4675
Joined: 26 Jan 2011 19:36

Re: PUT Method in HTTP Device

Post by PoltoS » 06 Jan 2017 19:24

HTTP Device to support only GET and POST. And this makes sence. Because usually only those are used.

But those who uses PUT require real REST API, mens getter work with GET, setter with PUT. So a dedicated module should be done for such cases.

For Hue I would suggest a special module like: http://developer.z-wave.me/?uri=public#/web/apps/317

klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: PUT Method in HTTP Device

Post by klaasjoerg » 07 Jan 2017 00:46

In my case, it was only needed for hue control, which i curently handling with bash-shell-scripts and curl.
However, the Hue-Module you just mentioned, simply doesn't work currently. An error is thrown and effective not working at all. Unfortunately.

Squar0L
Posts: 6
Joined: 12 May 2014 00:47

Re: PUT Method in HTTP Device

Post by Squar0L » 08 Jan 2017 06:34

This module shows how to use PUT. It works great.

https://github.com/ggsubs/HikvisionAlert

Post Reply