{"id":1367,"date":"2019-03-04T20:04:55","date_gmt":"2019-03-04T11:04:55","guid":{"rendered":"https:\/\/yuis-programming.com\/?p=1367"},"modified":"2021-10-16T17:36:26","modified_gmt":"2021-10-16T08:36:26","slug":"%e3%82%b9%e3%83%9e%e3%83%bc%e3%83%88led-lifx%e3%81%aeapi%e3%81%a7%e9%81%8a%e3%81%b6","status":"publish","type":"post","link":"https:\/\/yuis-programming.com\/?p=1367","title":{"rendered":"\u30b9\u30de\u30fc\u30c8LED\u96fb\u7403\u300cLIFX\u300d\u306eAPI\u306e\u4f7f\u3044\u65b9\u3068\u521d\u671f\u8a2d\u5b9a"},"content":{"rendered":"<p>\u30b9\u30de\u30fc\u30c8LED\u96fb\u7403(\u30b9\u30de\u30fc\u30c8\u30e9\u30a4\u30c8, \u30b9\u30de\u30fc\u30c8\u30e9\u30f3\u30d7)\u300cLIFX\u300d\u306eAPI\u306e\u4f7f\u3044\u65b9\u3068\u521d\u671f\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u89e3\u8aac\u3001\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\nLIFX\u30b9\u30de\u30fc\u30c8\u30e9\u30a4\u30c8\u306f\u4fa1\u683c\u3082\u5b89\u304f\u304a\u624b\u9803\u3067\u3001\u30b9\u30de\u30db\u30a2\u30d7\u30ea\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306f\u3082\u3061\u308d\u3093\u3001API\u3067\u3082\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3082\u81ea\u7531\u5ea6\u306e\u9ad8\u3044\u6700\u9ad8\u306a\u30aa\u30b9\u30b9\u30e1\u306e\u30b9\u30de\u30fc\u30c8LED\u96fb\u7403\u30e1\u30fc\u30ab\u30fc\u3067\u3059\u3002<\/p>\n<p>lifx\u306e\u521d\u671f\u8a2d\u5b9a<br \/>\n<a href=\"https:\/\/www.lifx.com\/pages\/user-manual\">User Manual &#8211; English \u2013 LIFX.com<\/a><br \/>\n\u57fa\u672c\u7684\u306b\u306fandroid\u306e\u30a2\u30d7\u30ea\u3092\u843d\u3068\u3057\u3066\u30ec\u30b8\u30b9\u30c8\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u3066wifi\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u30e9\u30f3\u30d7\u306e\u500b\u5225\u306ewifi\u8a2d\u5b9a\u3068\u8a2d\u5b9a\u3092\u3057\u3066\u5b8c\u4e86\u3002<br \/>\n\u50d5\u306e\u5834\u5408\u306f\u30e9\u30f3\u30d7\u306e\u767b\u9332\u306e\u9014\u4e2d\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u30015\u56de\u96fb\u6e90\u306e\u30aa\u30f3\u30aa\u30d5\u3092\u7e70\u308a\u8fd4\u3057\u3066\u304f\u3060\u3055\u3044\u307f\u305f\u3044\u306b\u66f8\u3044\u3066\u3042\u3063\u305f\u306e\u3067\u305d\u308c\u3092\u3057\u3066\u518d\u5ea6\u8a66\u3059\u3068\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>lifx\u3068\u3044\u3046\u30b9\u30de\u30fc\u30c8\u30e9\u30f3\u30d7\u3092\u8cb7\u3063\u305f\u306e\u3067API\u304b\u3089\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u6982\u8981: <a href=\"https:\/\/api.developer.lifx.com\/docs\/introduction\">Introduction \u00b7 LIFX HTTP Remote Control API<\/a><\/p>\n<p>\u306f\u3058\u3081\u306b: <a href=\"https:\/\/api.developer.lifx.com\/docs\/how-to-use-the-following-examples\">How to use the following examples \u00b7 LIFX HTTP Remote Control API<\/a><br \/>\nAPI\u4f5c\u6210 <a href=\"https:\/\/cloud.lifx.com\/\">LIFX Cloud<\/a><\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u4f7f\u7528\u53ef\u80fd\u306a\u30e9\u30f3\u30d7\u3092\u4e00\u89a7\u3059\u308b<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_1\">2<\/span> \u660e\u304b\u308a\u3092\u3064\u3051\u305f\u308a\u6d88\u3057\u305f\u308a\u3001\u660e\u308b\u3055\u3092\u5909\u3048\u305f\u308a<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_1\">3<\/span> \u4f7f\u7528\u4f8b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u4f7f\u7528\u53ef\u80fd\u306a\u30e9\u30f3\u30d7\u3092\u4e00\u89a7\u3059\u308b<\/span><\/h2>\n<pre><code>curl \"https:\/\/api.lifx.com\/v1\/lights\/:selector\" \\\n     -H \"Authorization: Bearer YOUR_APP_TOKEN\"\n<\/code><\/pre>\n<p><code>:selector<\/code>\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9: <a href=\"https:\/\/api.developer.lifx.com\/v1\/docs\/selectors\">Selectors \u00b7 LIFX HTTP Remote Control API<\/a><\/p>\n<p><code>:selector<\/code>\u306f<code>all<\/code>\u3092\u57fa\u672c\u7f6e\u3044\u3066\u304a\u3051\u3070\u3044\u3044\u3067\u3059\u304c\u3001\u500b\u5225\u306e\u96fb\u7403\u3092\u64cd\u4f5c\u3057\u305f\u3044\u5834\u5408\u306f<code>label<\/code>\u3092\u6307\u5b9a\u3057\u305f\u308a\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u53c2\u8003\u3002<\/p>\n<p>\u86c7\u8db3\u3067\u3059\u304c\u3001android\u3067\u96fb\u7403\u306e\u540d\u524d\u3092\u6c7a\u3081\u308b\u3068\u304d\u306b\u3001\u6700\u5f8c\u306b\u30b9\u30da\u30fc\u30b9\u304c\u5165\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u666e\u901a\u524d\u5f8c\u306e\u30b9\u30da\u30fc\u30b9\u306f\u308f\u304b\u308a\u306b\u304f\u3055\u6545\u306bstrip\u3055\u308c\u308b\u3093\u3067\u3059\u3051\u3069\u3055\u308c\u306a\u3044\u306e\u3067\u3001label\u3068\u304b\u6307\u5b9a\u3057\u3066\u308b\u306e\u306b\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u3089\u4e00\u65e6all\u3057\u3066\u500b\u5225\u306elabel\u3092\u518d\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u3044\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre><code>curl \"https:\/\/api.lifx.com\/v1\/lights\/label:Lamp\" \\\n     -H \"Authorization: Bearer c12\u20265717\"\n<\/code><\/pre>\n<p><a href=\"https:\/\/api.developer.lifx.com\/docs\/list-lights\">List Lights \u00b7 LIFX HTTP Remote Control API<\/a><\/p>\n<h2><span id=\"i-2\">\u660e\u304b\u308a\u3092\u3064\u3051\u305f\u308a\u6d88\u3057\u305f\u308a\u3001\u660e\u308b\u3055\u3092\u5909\u3048\u305f\u308a<\/span><\/h2>\n<p><a href=\"https:\/\/api.developer.lifx.com\/docs\/set-state\">Set State \u00b7 LIFX HTTP Remote Control API<\/a><br \/>\n<a href=\"https:\/\/api.developer.lifx.com\/v1\/docs\/colors\">Colors \u00b7 LIFX HTTP Remote Control API<\/a><\/p>\n<p>\u30e9\u30f3\u30d7\u306e\u72b6\u614b\u3092\u5909\u3048\u307e\u3059\u3002\u57fa\u672c\u7684\u306b\u3053\u308c\u3067\u307b\u3068\u3093\u3069\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u306d\u3002<br \/>\nList Lights\u306ejson\u306ecolor\u306e\u9805\u76ee\u3092\u53c2\u8003\u306b\u3057\u3066\u3001\u305d\u308c\u3092\u6574\u5f62\u3057\u3066\u3084\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre><code>curl -X PUT \"https:\/\/api.lifx.com\/v1\/lights\/all\/state\" \\\n     -H \"Authorization: Bearer c12\u20265717\" \\\n     -d \"power=on&amp;color=hue:0 saturation:0 kelvin:4500 brightness:1.0\"\n<\/code><\/pre>\n<h2><span id=\"i-3\">\u4f7f\u7528\u4f8b<\/span><\/h2>\n<p>\u53d6\u308a\u6025\u304e.bashrc\u306b\u8ffd\u52a0\u3057\u305f\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u3068\u304d\u307e\u3059\u3002<\/p>\n<pre><code>\nlifx-default(){\n    curl -X PUT \"https:\/\/api.lifx.com\/v1\/lights\/all\/state\" \\\n         -H \"Authorization: Bearer ${LIFX_API_KEY}\" \\\n         -d \"power=on&amp;color=hue:0 saturation:0 kelvin:4500 brightness:1.0\"\n}\n\nalias lifx-on=\"lifx-default\"\nalias lifx=\"lifx-default\"\n\nlifx-presleep(){\n    curl -X PUT \"https:\/\/api.lifx.com\/v1\/lights\/all\/state\" \\\n         -H \"Authorization: Bearer ${LIFX_API_KEY}\" \\\n         -d \"power=on&amp;color=hue:0 saturation:0 kelvin:2500 brightness:0.5\"\n}\n\nlifx-sleep(){\n    curl -X PUT \"https:\/\/api.lifx.com\/v1\/lights\/all\/state\" \\\n         -H \"Authorization: Bearer ${LIFX_API_KEY}\" \\\n         -d \"power=on&amp;color=hue:0 saturation:0 kelvin:2500 brightness:0.01\"\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30de\u30fc\u30c8LED\u96fb\u7403(\u30b9\u30de\u30fc\u30c8\u30e9\u30a4\u30c8, \u30b9\u30de\u30fc\u30c8\u30e9\u30f3\u30d7)\u300cLIFX\u300d\u306eAPI\u306e\u4f7f\u3044\u65b9\u3068\u521d\u671f\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u89e3\u8aac\u3001\u7d39\u4ecb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"acf":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8Rxwo-m3","_links":{"self":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1367"}],"collection":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1367"}],"version-history":[{"count":4,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions"}],"predecessor-version":[{"id":2981,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions\/2981"}],"wp:attachment":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}