3 ms·
To be pedantic: you should use PUT. ;)
by Drdrdrq 11y ago
To be pedantic: you should use PUT. ;)
- javajosh 11y agoActually, after thinking about it, I'd use a GET and I'd structure it something like http://smartplug?state=on http://smartplug?state=off Then to get the state of the plug: http://smartplug?state In jQuery this would be a easy call $.ajax('http://smartplug?state=on') Of course you'd have to code the plug server to add the appropriate CORS headers but that's true no matter how you structure the API. You could either replace 'smartplug' with the local ip of the device or alias it in `/etc/hosts`. All pretty standard stuff these days. If you wanted to expose it to the outside world (which actually should be hard to do) you would use DHCP reservation based on it's MAC address and a DynDNS service. The part that stymies me (and which no-one seems interested in addressing!) is what hardware to get.
- rexfm 11y agoas far as hardware for the actual lamp itself, it looks like melting some colored candles and some water in a glass jar over an incandescent bulb should suffice for starters. more advanced "ooze" formula including anti-freeze found here: http://oozinggoo.com/ll-form5.html http://oozinggoo.com/ll-form5.html
- javajosh 11y agoYeah, that's not really the point. I meant something more like this: https://hackaday.io/project/6799-smartee-the-smart-plug I find it pretty incredible something like this doesn't already exist from a major manufacturer! I mean, I understand why Belkin/GE/etc want to lock you into their ecosystem, but it seems not that hard to build an open alternative - and eat their collective lunches.
- vsync 11y ago> Actually, after thinking about it, I'd use a GET Why? Using it to change state seems precisely wrong. PUT seems more appropriate.