Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
My Gekko mit Philips Hue
#18
Hallo,

Falls noch interessant. War auch bis gerade am verzweifeln und habe dann die Lösung gefunden

https://developers.meethue.com/develop/get-started-2/

Turning a light on and off
Okay now that we have a username with permission to use the system lets start having some fun.
Each light has its own URL. You can see what lights you have with the following command:
Address
Code:
https://<bridge ip address>/api/1028d66426293e821ecfd9ef1a0731df/lights
[size=undefined]
Method[/size]

Code:
GET

You should get a JSON response with all the lights in your system and their names.
Now let’s get information about a specific light. The light with id 1.
Address
Code:
https://<bridge ip address>/api/1028d66426293e821ecfd9ef1a0731df/lights/1
[size=undefined]
Method[/size]

Code:
GET

In this response you can see all of the resources this light has. The most interesting ones are inside the state object as these are the ones we’ll have to interact with to control the light.
Lets’ start with the “on” attribute. This is a very simple attribute that can have 2 values: true and false. So let’s try turning the light off.
Address
Code:
https://<bridge ip address>/api/1028d66426293e821ecfd9ef1a0731df/lights/1/state
[size=undefined]
Body[/size]

Code:
{"on":false}
[size=undefined]
Method[/size]

Code:
PUT

Looking at the command you are sending we’re addressing the “state” object of light one and telling it to modify the “on” value inside it to false (or off). When you press the 
Code:
PUT
[size=undefined]
 button the light should turn off. Change the value in the body to true and the light will turn on again.[/size]

Now let’s do something a bit more fun and start changing some colors. Enter the command below.
Address
Code:
https://<bridge ip address>/api/1028d66426293e821ecfd9ef1a0731df/lights/1/state
[size=undefined]
Body[/size]

Code:
{"on":true, "sat":254, "bri":254,"hue":10000}
[size=undefined]
Method[/size]

Code:
PUT

We’re interacting with the same “state” attributes here but now we’re modifying a couple more attributes. We’re making sure the light is on by setting the “on” resource to true. We’re also making sure the saturation (intensity) of the colors and the brightness is at its maximum by setting the “sat” and “bri” resources to 254. Finally we’re telling the system to set the “hue” (a measure of color) to 10000 points (hue runs from 0 to 65535). Try changing the hue value and keep pressing the 
Code:
PUT
[size=undefined]
 button and see the colour of your light changing running through different colors.[/size]

Now you understand the basics of the commands you can send to hue through this tool – but we can also send the commands as part of an app.  Intrigued now?  Read more at Core Concepts (developer account required).


Nachrichten in diesem Thema
My Gekko mit Philips Hue - von MichaelZ - 27.10.2021, 09:56
RE: My Gekko mit Philips Hue - von Strabbit - 27.10.2021, 12:29
RE: My Gekko mit Philips Hue - von MichaelZ - 27.10.2021, 14:46
RE: My Gekko mit Philips Hue - von Sickone4 - 27.10.2021, 18:20
RE: My Gekko mit Philips Hue - von MichaelZ - 28.10.2021, 08:53
RE: My Gekko mit Philips Hue - von Sickone4 - 29.10.2021, 10:39
RE: My Gekko mit Philips Hue - von MichaelZ - 02.11.2021, 16:38
RE: My Gekko mit Philips Hue - von Sickone4 - 02.11.2021, 17:21
RE: My Gekko mit Philips Hue - von MichaelZ - 02.11.2021, 17:58
RE: My Gekko mit Philips Hue - von Alex_Di - 13.10.2022, 15:53
RE: My Gekko mit Philips Hue - von Sickone4 - 21.11.2021, 11:11
RE: My Gekko mit Philips Hue - von santos - 13.10.2022, 21:45
RE: My Gekko mit Philips Hue - von Alex_Di - 14.10.2022, 08:54
RE: My Gekko mit Philips Hue - von Strabbit - 14.10.2022, 06:40
RE: My Gekko mit Philips Hue - von Alex_Di - 17.11.2022, 15:33
RE: My Gekko mit Philips Hue - von MichaelZ - 05.12.2022, 10:39
RE: My Gekko mit Philips Hue - von santos - 05.12.2022, 13:50
RE: My Gekko mit Philips Hue - von Rocks - 16.03.2024, 02:34

Gehe zu:


Benutzer, die gerade dieses Thema anschauen:
4 Gast/Gäste