Re: [122] Philips Hue support
Posted: Wednesday 30 July 2014 17:16
You could use Curl
http://hkionline.net/blog/using-phillip ... mmand-line
http://hkionline.net/blog/using-phillip ... mmand-line
Code: Select all
#!/bin/sh
curl -H "Accept: application/json" -X POST --data '{"devicetype":"test user","username":"newdeveloper"}' http://<bridge ip address>/api
Code: Select all
mkdir /home/pi/domoticz/scripts/bash
cd /home/pi/domoticz/scripts/bash
nano bashscript
Code: Select all
sudo chmod +x bashscript
I'm sure I can not [hahahahaha]gizmocuz wrote:would be nice if someone could implement this natively(c++ i mean)
Joske,joske522 wrote: But how do I use this:
#!/bin/bash
curl -s -H "Accept: application/json" -X PUT --data '{"on":true}' http://your-bridge-IP-Address/api/newde ... ts/1/state
Any way you could help me out guys?![]()
Thanks in advance!
Hmm, that would be a very ugly solutiongizmocuz wrote:does the hue keeps it last state when you unplug/plug in the power chord? if yes, a quick alternative is to install some kaku switches
Hi Edgar! Thanks for the info! My god I have a lot to learnEdgar wrote:Joske,joske522 wrote: But how do I use this:
#!/bin/bash
curl -s -H "Accept: application/json" -X PUT --data '{"on":true}' http://your-bridge-IP-Address/api/newde ... ts/1/state
Any way you could help me out guys?![]()
Thanks in advance!
You'll have to put the
#!/bin/bash
curl -s -H "Accept: application/json" -X PUT --data '{"on":true}' http://your-bridge-IP-Address/api/newde ... ts/1/state
part in a textfile. What you end up with is an executable shell script.
I use unix' vi command to edit and make scripts, but vi is not for the faint hearted. So use an unix editor of your choice and put the two lines in a file called something like huelights_1_on.sh. Make a directory inside domoticz/scripts called bash and put this file inside. Give it execute rights (chmod ug+x huelights_1_on.sh) and you're good to go. In terminal, when you type ./huelights_1_on.sh and finish with enter, your light should switch on. After that, you only have to make a couple of more scripts (to switch light off, other lights) and you're done. Just couple these scripts to the on and off action of a virtual switch. Done!
You could use TextWrangler to write the lines. I'm on Mac as well and use it for all my programming. When working with unix/linux files you always have to make sure your textencoding is right with proper control codes for line endings. Something like Mac's TextEditor, Word, Pages isn't the proper tool.joske522 wrote:Hi Edgar! Thanks for the info! My god I have a lot to learnSo I just take those scripting lines, paste them in a text editor and save that as a .txt?
Is it possible to upload the created file from my Mac to the Rpi without having to take out the SD card?