Open sycq opened 5 years ago
https://qiita.com/undo0530/items/0d9eee70da46f906062a
同じネットワーク内のブリッジは、 https://discovery.meethue.com/ でIPが分かる。
まずはユーザーを作成する。
POST: http://ipaddr/api {"devicetype":"適当な名前。"}
エラーが返ってくるので。Linkボタンを押してもう一度すぐにPOST
[ { "success": { "username": "xRQtVO0TCT5yzA5uawrUAFGfiOdOOv4-r7rR06YY" } } ]
api/[username]/lights
{ "1": { "state": { "on": false, "bri": 0, "hue": 0, "sat": 0, "effect": "none", "xy": [ 0, 0 ], "ct": 0, "alert": "none", "colormode": "hs", "mode": "homeautomation", "reachable": false }, "swupdate": { "state": "readytoinstall", "lastinstall": null }, "type": "Extended color light", "name": "Hue lightstrip plus 1", "modelid": "LST002", "manufacturername": "Philips", "productname": "Hue lightstrip plus", "capabilities": { "certified": true, "control": { "mindimlevel": 40, "maxlumen": 1600, "colorgamuttype": "other", "colorgamut": [ [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ], "ct": { "min": 153, "max": 500 } }, "streaming": { "renderer": false, "proxy": false } }, "config": { "archetype": "huelightstrip", "function": "mixed", "direction": "omnidirectional" }, "uniqueid": "00:17:88:01:03:e2:14:33-0b", "swversion": "1.24.0_r20239", "swconfigid": "0612AD68", "productid": "Philips-LST002-1-LedStripsv3" }, "2": { "state": { "on": true, "bri": 254, "hue": 6845, "sat": 243, "effect": "none", "xy": [ 0.5446, 0.4115 ], "ct": 500, "alert": "none", "colormode": "xy", "mode": "homeautomation", "reachable": true }, "swupdate": { "state": "transferring", "lastinstall": null }, "type": "Extended color light", "name": "Hue lightstrip plus 2", "modelid": "LST002", "manufacturername": "Philips", "productname": "Hue lightstrip plus", "capabilities": { "certified": true, "control": { "mindimlevel": 40, "maxlumen": 1600, "colorgamuttype": "other", "colorgamut": [ [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ], "ct": { "min": 153, "max": 500 } }, "streaming": { "renderer": false, "proxy": false } }, "config": { "archetype": "huelightstrip", "function": "mixed", "direction": "omnidirectional" }, "uniqueid": "00:17:88:01:03:f5:d0:12-0b", "swversion": "1.24.0_r20239", "swconfigid": "0612AD68", "productid": "Philips-LST002-1-LedStripsv3" } }
今回は2らしい
PUT: /api/[username]/lights/2/state
{ "on": true, "bri": 255, "hue": 60000, "sat": 255 }
http://ktkne.st/elab/post/2013/philips-hue-api-javascript.html これ古いらしくて、現在はusernameは明示的に指定できないみたい。
色相はHUE値を46920あたりから0まで落としていけば青~赤までシームレスに変化できそうだ。 https://developers.meethue.com/documentation/core-concepts
https://qiita.com/undo0530/items/0d9eee70da46f906062a
同じネットワーク内のブリッジは、 https://discovery.meethue.com/ でIPが分かる。
まずはユーザーを作成する。
POST: http://ipaddr/api {"devicetype":"適当な名前。"}
エラーが返ってくるので。Linkボタンを押してもう一度すぐにPOST
api/[username]/lights
今回は2らしい
PUT: /api/[username]/lights/2/state