[122] Philips Hue support Topic is solved
Moderators: leecollings, remb0
Re: [122] Philips Hue support
You could use Curl
http://hkionline.net/blog/using-phillip ... mmand-line
http://hkionline.net/blog/using-phillip ... mmand-line
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: [122] Philips Hue support
Life seems so simple ....
Only.......
Can I simply:
curl -H "Accept: application/json" -X POST --data '{"devicetype":"test user","username":"newdeveloper"}' http://<bridge ip address>/api
Turn into the http option? Whether I talk now completely poo?
Or else asked ..
How can I use curl
Only.......
Can I simply:
curl -H "Accept: application/json" -X POST --data '{"devicetype":"test user","username":"newdeveloper"}' http://<bridge ip address>/api
Turn into the http option? Whether I talk now completely poo?
Or else asked ..
How can I use curl
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: [122] Philips Hue support
Probably rather than create a Lua script if all you want to do is execute an operating system command then create some simple Bash scripts and then call them from the On and the Off actions of a button.
So create a directly /home/pi/domoticz/scripts/bash to put your scripts in.
Create a file called something, say bashscript, which contains:
So on the command line on your Raspberry Pi:
Type in the bashscript contents above modifying the curl statement with your ip addresses etc, then CTRL-O to save the file and CTRL-X to exit nano. Finally, make the file executable:
Then add script://home/pi/domoticz/scripts/bash/bashscript in the On action box and save the switch.
So create a directly /home/pi/domoticz/scripts/bash to put your scripts in.
Create a file called something, say bashscript, which contains:
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
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: [122] Philips Hue support
Thank you very much ....
It works ... ['m as happy as a bear with 100 ....]
Tomorrow i will make the management happy with a switch that Hue turn on and off.
Better yet: the Hue above the seating area with mood light on.
The Hue over the dining table, fiercely.
Weird ...
I've made a bash for each circuit, is this correct?
And is it true that I cannot make a slave / master from a switch with a script? [ a one that is working correct ... ]
My next step is to see if a hue.
Now there is a difference between switching the app on the tablet, and the status of domoticz.
Is to live with, but if anyone has a script to check a switch ..
When I have time I will start a Wiki ...
It works ... ['m as happy as a bear with 100 ....]
Tomorrow i will make the management happy with a switch that Hue turn on and off.
Better yet: the Hue above the seating area with mood light on.
The Hue over the dining table, fiercely.
Weird ...
I've made a bash for each circuit, is this correct?
And is it true that I cannot make a slave / master from a switch with a script? [ a one that is working correct ... ]
My next step is to see if a hue.
Now there is a difference between switching the app on the tablet, and the status of domoticz.
Is to live with, but if anyone has a script to check a switch ..
When I have time I will start a Wiki ...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: [122] Philips Hue support
Great, sounds good, looking forward to seeing the Wiki page.
Without seeing your bash scripts difficult to see whether inidividual scripts are best or whether a few scripts with parameters would make more sense.
Without seeing your bash scripts difficult to see whether inidividual scripts are best or whether a few scripts with parameters would make more sense.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: [122] Philips Hue support
Just on, with the last settings of the Hue it selfs:
curl -H "Accept: application/json" -X PUT --data '{"on":true}' http://192.168.5.36/api/newdeveloper/lights/2/state
On with a color:
curl -H "Accept: application/json" -X PUT --data '{"on": true,"bri": 254,"hue": 15331,"sat": 121,"xy": [0.4448,0.4066],"ct": 343,"alert": "none","effect": "none","colormode": "xy","reachable": true}' http://192.168.5.36/api/newdeveloper/lights/2/state
The color data i read from the Api tool:
I just set the color i want with the app on my phone, then wait a minut, and read the data:
curl -H "Accept: application/json" -X PUT --data '{"on":true}' http://192.168.5.36/api/newdeveloper/lights/2/state
On with a color:
curl -H "Accept: application/json" -X PUT --data '{"on": true,"bri": 254,"hue": 15331,"sat": 121,"xy": [0.4448,0.4066],"ct": 343,"alert": "none","effect": "none","colormode": "xy","reachable": true}' http://192.168.5.36/api/newdeveloper/lights/2/state
The color data i read from the Api tool:
I just set the color i want with the app on my phone, then wait a minut, and read the data:
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: [122] Philips Hue support
would be nice if someone could implement this natively (c++ i mean)
Quality outlives Quantity!
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: [122] Philips Hue support
I'm sure I can not [hahahahaha]gizmocuz wrote:would be nice if someone could implement this natively (c++ i mean)
But I got it working, and I am very proud of it ..... [ like a bear with multiple ....... ]
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- beamzer
- Posts: 19
- Joined: Sunday 17 August 2014 20:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Contact:
Re: [122] Philips Hue support
I wrote a step by step blog post on how i integrated the Philips Hue lighting with my Domoticz
http://www.oiepoie.nl/2014/08/23/philips-hue-domoticz/
of course, native integration would be better, but this works in the meantime,
and it's easy to adapt to your wishes.
have fun.
Ewald....
http://www.oiepoie.nl/2014/08/23/philips-hue-domoticz/
of course, native integration would be better, but this works in the meantime,
and it's easy to adapt to your wishes.
have fun.
Ewald....
Domoticz stable on a Raspberry Pi 3
RFXtrx433E - RFLink - Smartmeter (through RasPi-Zero-W) - Hue - BMP180 - DHT22 - Wemos D1 Mini's with PIR
RFXtrx433E - RFLink - Smartmeter (through RasPi-Zero-W) - Hue - BMP180 - DHT22 - Wemos D1 Mini's with PIR
-
- Posts: 18
- Joined: Friday 19 September 2014 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [122] Philips Hue support
Hi guys,
I have a few Hue lights myself (4) and just got started with Rpi and Domoticz, so I am a NOOB beyond NOOBY
How do I create the script to make the lights work? I tried following the guide from http://www.oiepoie.nl/2014/08/23/philips-hue-domoticz/
but this does not work for me... I got the user created in the Philips api and when I ssh into my RPI I can use the following to turn on my 4 lights:
curl -H "Accept: application/json" -X PUT --data '{"on":true}' http://mybridgeip/api/newdeveloper/lights/4/state
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
if I copy this into the terminal and hit enter, nothing happens, I just get another prompt. When I copy this afterwards:
cat > hue_light_1_on.sh #!/bin/bash curl -s -H "Accept: application/json" -X PUT --data '{"on":true}' http://mybridgeip/api/newdeveloper/lights/1/state CTRL-D
I get an error: -bash: !/bin/bash curl: event not found
Any way you could help me out guys?
Thanks in advance!
I have a few Hue lights myself (4) and just got started with Rpi and Domoticz, so I am a NOOB beyond NOOBY
How do I create the script to make the lights work? I tried following the guide from http://www.oiepoie.nl/2014/08/23/philips-hue-domoticz/
but this does not work for me... I got the user created in the Philips api and when I ssh into my RPI I can use the following to turn on my 4 lights:
curl -H "Accept: application/json" -X PUT --data '{"on":true}' http://mybridgeip/api/newdeveloper/lights/4/state
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
if I copy this into the terminal and hit enter, nothing happens, I just get another prompt. When I copy this afterwards:
cat > hue_light_1_on.sh #!/bin/bash curl -s -H "Accept: application/json" -X PUT --data '{"on":true}' http://mybridgeip/api/newdeveloper/lights/1/state CTRL-D
I get an error: -bash: !/bin/bash curl: event not found
Any way you could help me out guys?
Thanks in advance!
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: [122] Philips Hue support
A real noob and a starter....
Take the simpel way in Domoticz and use the Logitech option in Domoticz
Take the simpel way in Domoticz and use the Logitech option in Domoticz
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: [122] Philips Hue support
I'm sure read the API from the hue, as this is open now.
Please write a hardware class for this, as i don't have these lights, so it is impossible to implement them
Or you could loan us the hardware so we can have a look, or someone else has to implement this.
i am very happy with the applamp/fibaro RGBW and am not going to buy another set of (expensive) rgb(w) lights
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
Please write a hardware class for this, as i don't have these lights, so it is impossible to implement them
Or you could loan us the hardware so we can have a look, or someone else has to implement this.
i am very happy with the applamp/fibaro RGBW and am not going to buy another set of (expensive) rgb(w) lights
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
Quality outlives Quantity!
-
- Posts: 18
- Joined: Friday 19 September 2014 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [122] Philips Hue support
Thanks for the reply guys. As for the Logitech option... what do you exactly mean? I have the Harmony hub configured in the beta release of Domoticz and it has the commands like "watch tv" integrated in the Domoticz system. I know it can handle my Hue lights and the bridge is coupled, but how can you make the hue lights turn on when you click the "watch tv" option on certain times only (when it's dark off course)?
The Applamps, are they fully supported in Domoticz? I mean, can you change the color in the interface and select which lamps/ scenes you activate when you push a certain swith at a certain time etc? Because that would really solve my problem
Thanks!
The Applamps, are they fully supported in Domoticz? I mean, can you change the color in the interface and select which lamps/ scenes you activate when you push a certain swith at a certain time etc? Because that would really solve my problem
Thanks!
-
- Posts: 24
- Joined: Saturday 13 September 2014 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands, -6 NAP
- Contact:
Re: [122] Philips Hue support
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!
Only Robinson Crusoe had everything done by Friday
-
- Posts: 24
- Joined: Saturday 13 September 2014 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands, -6 NAP
- Contact:
Re: [122] Philips Hue support
to all,
Last three weeks I've been toying with my RPI and Hue hardware. I'm currently trying to setup a framework of scripts and a database to do the following:
- establish coupling with hue bridge(s)
- interrogate bridge for connected lights, put these in database
- make virtual switches for each light
- periodic updates to switch info to reflect proper state of lights
With these parts, basic light switching is possible.
After this, I want to add some simple color / scene capturing. For instance, when you programm your lamps to certain settings (3 of 5 on, 2 color 'A' and 1 color 'B', with different brightness settings) I want to capture those settings and store them as a scene in the database. Then, instead of switching individual lights, switch scenes.
I think this would cover most needs for now.
I don't know when I'm ready to put anything into the public. This is one of the things I work on when I have spare time in the evening.
Edgar
Last three weeks I've been toying with my RPI and Hue hardware. I'm currently trying to setup a framework of scripts and a database to do the following:
- establish coupling with hue bridge(s)
- interrogate bridge for connected lights, put these in database
- make virtual switches for each light
- periodic updates to switch info to reflect proper state of lights
With these parts, basic light switching is possible.
After this, I want to add some simple color / scene capturing. For instance, when you programm your lamps to certain settings (3 of 5 on, 2 color 'A' and 1 color 'B', with different brightness settings) I want to capture those settings and store them as a scene in the database. Then, instead of switching individual lights, switch scenes.
I think this would cover most needs for now.
I don't know when I'm ready to put anything into the public. This is one of the things I work on when I have spare time in the evening.
Edgar
Only Robinson Crusoe had everything done by Friday
-
- Posts: 24
- Joined: Saturday 13 September 2014 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands, -6 NAP
- Contact:
Re: [122] Philips Hue support
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
Huelamps don't keep their last state when they are unplugged. When power returns, they start bright white. Mr. Philips wants you to be able to switch the lights manually.
Only Robinson Crusoe had everything done by Friday
-
- Posts: 18
- Joined: Friday 19 September 2014 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [122] Philips Hue support
Hi Edgar! Thanks for the info! My god I have a lot to learn So I just take those scripting lines, paste them in a text editor and save that as a .txt?Edgar 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!
Is it possible to upload the created file from my Mac to the Rpi without having to take out the SD card?
I just want to say thank you for helping a fellow Domoticz member even when I'm clearly not used to working in code.
-
- Posts: 24
- Joined: Saturday 13 September 2014 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands, -6 NAP
- Contact:
Re: [122] Philips Hue support
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 learn So 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?
The proper way is to gain access to the command line on the RPI via ssh. SSH is a secure network terminal protocol. If you know the ip address of your RPI you could fire up Terminal (in the /Applications/Utillities folder in OS X) and do the following:
ssh pi@<ip.ad.dr.ess>
The first time you'll have to answer the question whether you want to add thsi to the list off know hosts. Answer Yes.
Then you'll have to provide the password of the pi user account. I believe it's raspberry when you use the domo_rpi image (http://www.domoticz.com/wiki/Domoticz_R ... i_SD_Image)
after that, you're connected to the shell of the rpi as user pi.
if you type the command 'exit' (eihtout hte quotes), the ssh connection is terminated and you're back in OS X.
Ok, connect again (ssh pi@<ip.ad.dr.ess>)
change into the domoticz directory:
cd domoticz
change into the scripts directory:
cd scripts
(or do it in one sweep: cd domoticz/scripts)
make a new folder bash for the bash scripts:
mkdir bash
change into this new directory:
cd bash
type: vi huelights_1_on.sh
The screen will change and on the bottom it will say something like: "huelights_1_on.sh" [New File]
Press <esc> once, followed by 'i'. Now you are in insert mode.
To make things easy: write the lines mentioned in my first post in TextWrangler, select them and put them on the clipboard. Switch back to your terminal window and paste them. Now they're in the textbuffer of vi.
To write back to disk, press <esc> again, followed by ':'. The bottom line will change to ":". Type wq and press enter. You're back on the commandline (wq is write quit in vi).
If you type ls<enter>, you'll see a file with huelights_1_on.sh as name. To make it executable:
chmod ug+x huelights_1_on.sh
And you're done. If you would now type ./huelights_1_on.sh (don't forget the leading dot) it will try to execute huelights_1_on.sh in the current directory.
Only Robinson Crusoe had everything done by Friday
-
- Posts: 24
- Joined: Saturday 13 September 2014 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands, -6 NAP
- Contact:
Re: [122] Philips Hue support
This was the hard part.
You can use Textwrangler to edit your files directly on the rpi.
Open TextWrangler (download first), go to File menu, select Open from FTP/SFTP server.
Fill in server ip address, loginname (pi) and password (raspberry), and don't forget to select SFTP. (SFTP uses the SSH protocol (..) to transfer data.)
Now you can go to the bash directory and you'll find your previously created file. From here you can edit it (to switch off) and save it under a new name.
You'll still have to use Terminal and ssh connection to make the files executable, but editing is lot easier now.
You can use Textwrangler to edit your files directly on the rpi.
Open TextWrangler (download first), go to File menu, select Open from FTP/SFTP server.
Fill in server ip address, loginname (pi) and password (raspberry), and don't forget to select SFTP. (SFTP uses the SSH protocol (..) to transfer data.)
Now you can go to the bash directory and you'll find your previously created file. From here you can edit it (to switch off) and save it under a new name.
You'll still have to use Terminal and ssh connection to make the files executable, but editing is lot easier now.
Only Robinson Crusoe had everything done by Friday
Who is online
Users browsing this forum: No registered users and 0 guests