{"id":3798,"date":"2024-01-24T16:49:36","date_gmt":"2024-01-24T07:49:36","guid":{"rendered":"https:\/\/blog.smartlight.co.jp\/?p=3798"},"modified":"2024-01-26T13:39:59","modified_gmt":"2024-01-26T04:39:59","slug":"minecraft%e7%b5%b1%e5%90%88%e7%89%88be%e3%81%abcpu%e6%b8%a9%e5%ba%a6%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%80%81ambient%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e8%93%84%e7%a9%8d","status":"publish","type":"post","link":"https:\/\/blog.smartlight.co.jp\/?p=3798","title":{"rendered":"Minecraft\u7d71\u5408\u7248(BE)\u306bRaspberry Pi\u306eCPU\u6e29\u5ea6\u3092\u8868\u793a\u3055\u305b\u3001Ambient\u306b\u30c7\u30fc\u30bf\u3092\u84c4\u7a4d\u3057\u3066\u307f\u305f"},"content":{"rendered":"\n<p>\u4eca\u56de\u306fMinecraft\u306e\u753b\u9762\u3067Node-RED\u3092\u5b9f\u884c\u3057\u3066\u3044\u308bRaspberry Pi\u306eCPU\u6e29\u5ea6\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u8868\u793a\u3057\u3001\u305d\u308c\u3092\u30b0\u30e9\u30d5\u5316\u3055\u305b\u3066\u307f\u305f\u306e\u3067\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u958b\u767a\u74b0\u5883<\/h2>\n\n\n\n<p class=\"has-background\" style=\"background-color:#f9f3d5\">PC\uff1aWindows 11<br>       \u203bRaspberry Pi 4 Model B\u3000(Linux)<br>\u958b\u767a\u30c4\u30fc\u30eb\uff1aNode.js (v18.19.0)<br>\u3000\u3000\u3000\u3000\u3000\u3000Node-RED (v.3.1.3)<br>\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\uff1a\u793e\u5185\u306e\u7121\u7ddaLAN<br>Minecraft\uff1av1.20.51 (\u57f7\u7b46\u6642\u70b9)<br><br>\u203bNode-RED\u3092Raspberry Pi\u3067\u52d5\u304b\u3057\u3001Raspberry Pi\u306eCPU\u6e29\u5ea6\u3092\u8868\u793a\u3055\u305b\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ambient\u306b\u3064\u3044\u3066<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Ambient\u3068\u306f<\/h4>\n\n\n\n<p>Ambient\u306f\u3001IoT\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u30b5\u30fc\u30d3\u30b9\u3067\u3001\u30de\u30a4\u30b3\u30f3\u306a\u3069\u304b\u3089\u9001\u3089\u308c\u308b\u30bb\u30f3\u30b5\u30c7\u30fc\u30bf\u3092\u53d7\u4fe1\u3057\u3001\u84c4\u7a4d\u3057\u3001\u53ef\u8996\u5316(\u30b0\u30e9\u30d5\u5316)\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30e6\u30fc\u30b6\u767b\u9332\u3092\u3057\u3066\u3068\u308a\u3042\u3048\u305a\u89e6\u3063\u3066\u307f\u3066\u7c21\u5358\u306b\u4f7f\u3046\u3053\u3068\u306e\u3067\u304d\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Ambient\u306b\u767b\u9332\u3059\u308b<\/h4>\n\n\n\n<p><a href=\"https:\/\/ambidata.io\/\">Ambient.io<\/a>\u3092\u958b\u304d\u3001\u65b0\u898f\u767b\u9332\u3092\u62bc\u3057\u307e\u3059\u3002\u767b\u9332\u3059\u308b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3001\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u304b\u3089\u8a8d\u8a3c\u3057\u3066\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a<\/h4>\n\n\n\n<p>\u767b\u9332\u304c\u5b8c\u4e86\u3059\u308b\u3068\u3001\u3053\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u958b\u304f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"255\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41-1024x255.png\" alt=\"\" class=\"wp-image-3804\" style=\"width:566px;height:auto\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41-1024x255.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41-300x75.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41-768x191.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41.png 1037w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-41-1024x255.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u300c\u30c1\u30e3\u30cd\u30eb\u3092\u4f5c\u308b\u300d\u3092\u62bc\u4e0b\u3059\u308b\u3068\u3001\u81ea\u52d5\u3067\u30ad\u30fc\u304c\u767a\u884c\u3055\u308c\u307e\u3059\u3002<br>\u3053\u3053\u3067\u767a\u884c\u3055\u308c\u308bID\u3084\u30ad\u30fc\u306f\u3001\u4ed6\u4eba\u306b\u77e5\u3089\u308c\u3066\u3057\u307e\u3046\u3068\u4ed6\u4eba\u3082\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u614e\u91cd\u306b\u6271\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u3001\u30bf\u30d6\u304b\u3089\u300c\u30dc\u30fc\u30c9\u4e00\u89a7\u300d\u3092\u958b\u304d\u3001\u4f5c\u3089\u308c\u305f\u30dc\u30fc\u30c9\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br>\u753b\u9762\u4e0a\u90e8\u306b\u3042\u308b\u4e0b\u306e\u3088\u3046\u306a\u30a2\u30a4\u30b3\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30c1\u30e3\u30fc\u30c8\u304c\u73fe\u308c\u307e\u3059\u3002<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"41\" height=\"26\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-42.png\" alt=\"\" class=\"wp-image-3805\" style=\"width:254px;height:auto\"\/><\/figure>\n\n\n\n<p>\u30c1\u30e3\u30fc\u30c8\u8a2d\u5b9a\u3092\u958b\u304d\u3001\u4e0b\u306e\u3088\u3046\u306b\u8868\u793a\u3059\u308b\u30c7\u30fc\u30bf\u306e\u30d7\u30eb\u30dc\u30bf\u30f3\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3001<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"558\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43-1024x558.png\" alt=\"\" class=\"wp-image-3806\" style=\"width:639px;height:auto\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43-1024x558.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43-300x163.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43-768x418.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43.png 1339w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-43-1024x558.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u30c1\u30e3\u30fc\u30c8\u304c\u767b\u5834\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"254\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-44.png\" alt=\"\" class=\"wp-image-3807\"\/><\/figure>\n\n\n\n<p>\u3064\u307e\u308a\u3001\u3053\u306e d1\u3084d2 \u306b\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u3067\u3001\u30b0\u30e9\u30d5\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8b\u524d\u6e96\u5099<\/h2>\n\n\n\n<h5 class=\"wp-block-heading\">\u4e0a\u8a18\u3067\u7d39\u4ecb\u3057\u305fAmbient\u3092\u6e96\u5099\u3057\u3066\u304a\u304f<\/h5>\n\n\n\n<p>\u5148\u307b\u3069\u767a\u884c\u3057\u305f\u300c\u30c1\u30e3\u30cd\u30ebID\u300d\u3068\u300c\u30e9\u30a4\u30c8\u30ad\u30fc\u300d\u3092\u6b21\u306b\u7d39\u4ecb\u3059\u308b\u30ce\u30fc\u30c9\u3067\u4f7f\u7528\u3057\u307e\u3059\u3002<br>\u3042\u3089\u304b\u3058\u3081\u63a7\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Ambient\u30ce\u30fc\u30c9\u3092\u8ffd\u52a0\u3059\u308b<\/h5>\n\n\n\n<p>\u30d1\u30ec\u30c3\u30c8\u306e\u7ba1\u7406\u304b\u3089\u300cnode-red-contrib-ambient\u300d\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br>\u30ce\u30fc\u30c9\u306e\u7de8\u96c6\u753b\u9762\u3067\u3001\u7528\u610f\u3057\u305f\u300c\u30c1\u30e3\u30cd\u30ebID\u300d\u3068\u300c\u30e9\u30a4\u30c8\u30ad\u30fc\u300d\u3092\u3001<br>\u6307\u5b9a\u306e\u5834\u6240\u306b\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"417\" height=\"242\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-39.png\" alt=\"\" class=\"wp-image-3799\" style=\"width:443px;height:auto\"\/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Minecraft\u306b\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f<\/h5>\n\n\n\n<p>\u4eca\u56de\u306fMinecraft\u306e\u6a5f\u80fd\u306e\u4e00\u3064\u3067\u3042\u308b\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9\u3092\u5229\u7528\u3057\u3066CPU\u6e29\u5ea6\u3092\u753b\u9762\u306b\u8868\u793a\u3057\u307e\u3059\u3002\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u9806\u306bMinecraft\u306e\u30c1\u30e3\u30c3\u30c8\u306b\u6253\u3061\u8fbc\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\/scoreboard objectives add test dummy<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\/scoreboard objectives setdisplay sidebar test<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u30d5\u30ed\u30fc\u306e\u6982\u8981<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"945\" height=\"261\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-40.png\" alt=\"\" class=\"wp-image-3800\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-40.png 945w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-40-300x83.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-40-768x212.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-40.png 856w\" sizes=\"auto, (max-width: 945px) 100vw, 945px\" \/><\/figure>\n\n\n\n<p>\u4eca\u56de\u3001\u5b9a\u671f\u7684\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066CPU\u6e29\u5ea6\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u306e\u3067\u3001<br>inject\u30ce\u30fc\u30c9\u3092\u7e70\u308a\u8fd4\u3057\u5b9f\u884c\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CPU\u6e29\u5ea6\u306e\u30b2\u30fc\u30e0\u5185\u8868\u793a<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">exec\u30ce\u30fc\u30c9\u3067CPU\u6e29\u5ea6\u53d6\u5f97<\/h4>\n\n\n\n<p>exec\u30ce\u30fc\u30c9\u3092\u5229\u7528\u3057\u3066\u5916\u90e8\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306fCPU\u6e29\u5ea6\u306e\u51fa\u529b\u304c\u3067\u304d\u308bLinux\u306e\u4e0b\u8a18\u30bf\u30fc\u30df\u30ca\u30eb\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>vcgencmd measure_temp<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Minecraft\u3078\u306e\u9001\u4fe1<\/h4>\n\n\n\n<p>\u4eca\u56de\u306f\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9\u3078\u8868\u793a\u3055\u305b\u307e\u3059\u304c\u3001\u672c\u6765\u4e3b\u306b\u306f\u6570\u5024\u3092\u4f7f\u3046\u3053\u3068\u306e\u591a\u3044\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<br>\u3057\u304b\u3057\u4eca\u56de\u306f\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9\u5185\u3067\u306e\u8868\u793a\u540d\u3092\u5229\u7528\u3057\u3066CPU\u6e29\u5ea6\u3092\u53ef\u8996\u5316\u3057\u3066\u3044\u307e\u3059\u3002<br>\u3057\u305f\u304c\u3063\u3066CPU\u6e29\u5ea6\u304c\u5909\u308f\u308b\u5ea6\u3001\u5225\u540d\u79f0\u3068\u3057\u3066\u767b\u9332\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u30ea\u30bb\u30c3\u30c8\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u3057\u3084\u3059\u3044\uff13\u79d2\u9593\u9694\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<br>delay\u30ce\u30fc\u30c9\u306f\u7e70\u308a\u8fd4\u3057\u306e\u5b9f\u884c\u304c\u3055\u308c\u308b0.5\u79d2\u524d\u306b\u524a\u9664\u7528\u306e\u30b3\u30de\u30f3\u30c9\u3092\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u633f\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>function\u306e\u4e2d\u8eab\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>const uuid = msg.payout;\nconst output = msg.payload;\n\nconst commandRequestMessageJSON = {\n    &quot;header&quot;: {\n        &quot;version&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\n        &quot;requestId&quot;: uuid, \/\/ UUIDv4\u3092\u751f\u6210\u3057\u3066\u6307\u5b9a\n        &quot;messageType&quot;: &quot;commandRequest&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\n        &quot;messagePurpose&quot;: &quot;commandRequest&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\n    },\n    &quot;body&quot;: {\n        &quot;origin&quot;: {\n            &quot;type&quot;: &quot;player&quot; \/\/ \u8ab0\u304c\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u304b\u3092\u6307\u5b9a\uff08\u305f\u3060\u3057\u3001Player\u4ee5\u5916\u306b\u3069\u306e\u5024\u304c\u5229\u7528\u53ef\u80fd\u304b\u306f\u8981\u8abf\u67fb\uff09\n        },\n        &quot;version&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\n        &quot;commandLine&quot;: `scoreboard players set Temp:${output.substr(5,4)}\u00b0C test 0`, \/\/ \u30de\u30a4\u30af\u30e9\u3067\u5b9f\u884c\u3057\u305f\u3044\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff08\u3053\u3053\u3067\u306f\u30cb\u30ef\u30c8\u30ea\u3092\u30b9\u30dd\u30fc\u30f3\u3055\u305b\u308b\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff09\n    }\n};\n\nmsg.payload = JSON.stringify(commandRequestMessageJSON);\n\nreturn msg;<\/code><\/pre><\/div>\n\n\n\n<p>\u524a\u9664\u7528\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u306f\u3001set\u3092reset\u306b\u5909\u66f4\u3057\u305f\u3060\u3051\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ambient\u3078\u306e\u9001\u4fe1<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Ambient\u30ce\u30fc\u30c9\u306e\u30d8\u30eb\u30d7\u3092\u53c2\u7167\u3057\u3066\u307f\u308b<\/h4>\n\n\n\n<p>\u30d8\u30eb\u30d7\u3092\u898b\u3066\u307f\u308b\u3068\u3001Ambient\u30ce\u30fc\u30c9\u304c\u53d7\u4fe1\u3067\u304d\u308b\u6587\u5b57\u5217\u306e\u5f62\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br>\u8a18\u8f09\u306e\u901a\u308a\u3001payload\u306b\u683c\u7d0d\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092{&#8220;d1&#8243;:\u30c7\u30fc\u30bf\uff11,&#8221;d2&#8221;:\u30c7\u30fc\u30bf\uff12}\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">payload\u306e\u7de8\u96c6<\/h4>\n\n\n\n<p>\u30d8\u30eb\u30d7\u3067\u53c2\u7167\u3057\u305f\u901a\u308a\u3001payload\u306e\u5f62\u3092\u9001\u4fe1\u7528\u306e\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\u3002<br>exec\u30ce\u30fc\u30c9\u304b\u3089\u5f97\u305f\u6e29\u5ea6\u30c7\u30fc\u30bf\u306e\u6587\u5b57\u5217\u306b\u306f\u3001\u6539\u884c\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3001javascript\u306e\u6b63\u898f\u8868\u73fe\u3092\u7528\u3044\u3066\u8131\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>const data = msg.payload;\n\nconst dataa = data.replace(&quot;temp=&quot;,&quot;&quot;);\nconst dataaa = dataa.replace(&quot;&#39;C&quot;,&quot;&quot;);\nconst findata = dataaa.replace(\/\\r?\\n\/g, &quot;&quot;);\n\nmsg.payload = &#39;{&quot;d1&quot;: &#39;+findata+&#39;}&#39;;\n\nreturn msg;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u52d5\u4f5c\u3055\u305b\u3066\u307f\u308b<\/h2>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"480\" style=\"aspect-ratio: 852 \/ 480;\" width=\"852\" controls src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/CPUtempMinecraft.mp4\"><\/video><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"241\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-45.png\" alt=\"\" class=\"wp-image-3810\" style=\"width:420px;height:auto\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"276\" height=\"276\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/image-46.png\" alt=\"\" class=\"wp-image-3812\" style=\"width:230px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u30ce\u30fc\u30c9\u30c7\u30fc\u30bf<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>[ { &quot;id&quot;: &quot;e31a9344983d4ffb&quot;, &quot;type&quot;: &quot;websocket out&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;&quot;, &quot;server&quot;: &quot;c838b41f45982027&quot;, &quot;client&quot;: &quot;&quot;, &quot;x&quot;: 980, &quot;y&quot;: 160, &quot;wires&quot;: [] }, { &quot;id&quot;: &quot;c9f21a66d722bb1a&quot;, &quot;type&quot;: &quot;exec&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;command&quot;: &quot;vcgencmd measure_temp&quot;, &quot;addpay&quot;: &quot;&quot;, &quot;append&quot;: &quot;&quot;, &quot;useSpawn&quot;: &quot;true&quot;, &quot;timer&quot;: &quot;&quot;, &quot;winHide&quot;: false, &quot;oldrc&quot;: false, &quot;name&quot;: &quot;view temp&quot;, &quot;x&quot;: 320, &quot;y&quot;: 140, &quot;wires&quot;: [ [ &quot;44a316b0cfd35c61&quot;, &quot;eae2a2251644a4fc&quot;, &quot;a31259ecbc726054&quot;, &quot;27109d1b3fabf25c&quot; ], [], [] ] }, { &quot;id&quot;: &quot;2574015b818a0c87&quot;, &quot;type&quot;: &quot;inject&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;&quot;, &quot;props&quot;: [ { &quot;p&quot;: &quot;payload&quot; }, { &quot;p&quot;: &quot;topic&quot;, &quot;vt&quot;: &quot;str&quot; } ], &quot;repeat&quot;: &quot;3&quot;, &quot;crontab&quot;: &quot;&quot;, &quot;once&quot;: false, &quot;onceDelay&quot;: 0.1, &quot;topic&quot;: &quot;&quot;, &quot;payload&quot;: &quot;&quot;, &quot;payloadType&quot;: &quot;date&quot;, &quot;x&quot;: 150, &quot;y&quot;: 140, &quot;wires&quot;: [ [ &quot;c9f21a66d722bb1a&quot; ] ] }, { &quot;id&quot;: &quot;cac865acbbf690d4&quot;, &quot;type&quot;: &quot;function&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;function 12&quot;, &quot;func&quot;: &quot;const uuid = msg.payout;\\nconst output = msg.payload;\\n\\nconst commandRequestMessageJSON = {\\n    \\&quot;header\\&quot;: {\\n        \\&quot;version\\&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\\n        \\&quot;requestId\\&quot;: uuid, \/\/ UUIDv4\u3092\u751f\u6210\u3057\u3066\u6307\u5b9a\\n        \\&quot;messageType\\&quot;: \\&quot;commandRequest\\&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\\n        \\&quot;messagePurpose\\&quot;: \\&quot;commandRequest\\&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\\n    },\\n    \\&quot;body\\&quot;: {\\n        \\&quot;origin\\&quot;: {\\n            \\&quot;type\\&quot;: \\&quot;player\\&quot; \/\/ \u8ab0\u304c\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u304b\u3092\u6307\u5b9a\uff08\u305f\u3060\u3057\u3001Player\u4ee5\u5916\u306b\u3069\u306e\u5024\u304c\u5229\u7528\u53ef\u80fd\u304b\u306f\u8981\u8abf\u67fb\uff09\\n        },\\n        \\&quot;version\\&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\\n        \\&quot;commandLine\\&quot;: `scoreboard players set Temp:${output.substr(5,4)}\u00b0C test 0`, \/\/ \u30de\u30a4\u30af\u30e9\u3067\u5b9f\u884c\u3057\u305f\u3044\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff08\u3053\u3053\u3067\u306f\u30cb\u30ef\u30c8\u30ea\u3092\u30b9\u30dd\u30fc\u30f3\u3055\u305b\u308b\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff09\\n    }\\n};\\n\\nmsg.payload = JSON.stringify(commandRequestMessageJSON);\\n\\nreturn msg;&quot;, &quot;outputs&quot;: 1, &quot;timeout&quot;: 0, &quot;noerr&quot;: 0, &quot;initialize&quot;: &quot;&quot;, &quot;finalize&quot;: &quot;&quot;, &quot;libs&quot;: [], &quot;x&quot;: 810, &quot;y&quot;: 140, &quot;wires&quot;: [ [ &quot;e31a9344983d4ffb&quot; ] ] }, { &quot;id&quot;: &quot;26976f8ef7c30cb0&quot;, &quot;type&quot;: &quot;function&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;function 13&quot;, &quot;func&quot;: &quot;const uuid = msg.payout;\\nconst oldtmp = msg.payload;\\n\\nconst commandRequestMessageJSON = {\\n    \\&quot;header\\&quot;: {\\n        \\&quot;version\\&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\\n        \\&quot;requestId\\&quot;: uuid, \/\/ UUIDv4\u3092\u751f\u6210\u3057\u3066\u6307\u5b9a\\n        \\&quot;messageType\\&quot;: \\&quot;commandRequest\\&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\\n        \\&quot;messagePurpose\\&quot;: \\&quot;commandRequest\\&quot;, \/\/ commandRequest\u3092\u6307\u5b9a\\n    },\\n    \\&quot;body\\&quot;: {\\n        \\&quot;origin\\&quot;: {\\n            \\&quot;type\\&quot;: \\&quot;player\\&quot; \/\/ \u8ab0\u304c\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u304b\u3092\u6307\u5b9a\uff08\u305f\u3060\u3057\u3001Player\u4ee5\u5916\u306b\u3069\u306e\u5024\u304c\u5229\u7528\u53ef\u80fd\u304b\u306f\u8981\u8abf\u67fb\uff09\\n        },\\n        \\&quot;version\\&quot;: 1, \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f31.18.2\u6642\u70b9\u3067\u306f1\u3067OK\\n        \\&quot;commandLine\\&quot;: `scoreboard players reset Temp:${oldtmp.substr(5,4)}\u00b0C test`, \/\/ \u30de\u30a4\u30af\u30e9\u3067\u5b9f\u884c\u3057\u305f\u3044\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff08\u3053\u3053\u3067\u306f\u30cb\u30ef\u30c8\u30ea\u3092\u30b9\u30dd\u30fc\u30f3\u3055\u305b\u308b\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\uff09\\n    }\\n};\\n\\nmsg.payload = JSON.stringify(commandRequestMessageJSON);\\n\\nreturn msg;&quot;, &quot;outputs&quot;: 1, &quot;timeout&quot;: 0, &quot;noerr&quot;: 0, &quot;initialize&quot;: &quot;&quot;, &quot;finalize&quot;: &quot;&quot;, &quot;libs&quot;: [], &quot;x&quot;: 810, &quot;y&quot;: 200, &quot;wires&quot;: [ [ &quot;e31a9344983d4ffb&quot; ] ] }, { &quot;id&quot;: &quot;eae2a2251644a4fc&quot;, &quot;type&quot;: &quot;delay&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;&quot;, &quot;pauseType&quot;: &quot;delay&quot;, &quot;timeout&quot;: &quot;2.5&quot;, &quot;timeoutUnits&quot;: &quot;seconds&quot;, &quot;rate&quot;: &quot;1&quot;, &quot;nbRateUnits&quot;: &quot;1&quot;, &quot;rateUnits&quot;: &quot;second&quot;, &quot;randomFirst&quot;: &quot;1&quot;, &quot;randomLast&quot;: &quot;5&quot;, &quot;randomUnits&quot;: &quot;seconds&quot;, &quot;drop&quot;: false, &quot;allowrate&quot;: false, &quot;outputs&quot;: 1, &quot;x&quot;: 490, &quot;y&quot;: 200, &quot;wires&quot;: [ [ &quot;b311cc5a69222188&quot; ] ] }, { &quot;id&quot;: &quot;a31259ecbc726054&quot;, &quot;type&quot;: &quot;function&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;payload\u306e\u7de8\u96c6&quot;, &quot;func&quot;: &quot;const data = msg.payload;\\n\\nconst dataa = data.replace(\\&quot;temp=\\&quot;,\\&quot;\\&quot;);\\nconst dataaa = dataa.replace(\\&quot;&#39;C\\&quot;,\\&quot;\\&quot;);\\nconst findata = dataaa.replace(\/\\\\r?\\\\n\/g, \\&quot;\\&quot;);\\n\\nmsg.payload = &#39;{\\&quot;d1\\&quot;: &#39;+findata+&#39;}&#39;;\\n\\nreturn msg;&quot;, &quot;outputs&quot;: 1, &quot;timeout&quot;: 0, &quot;noerr&quot;: 0, &quot;initialize&quot;: &quot;&quot;, &quot;finalize&quot;: &quot;&quot;, &quot;libs&quot;: [], &quot;x&quot;: 220, &quot;y&quot;: 280, &quot;wires&quot;: [ [ &quot;2f562285125439fa&quot; ] ] }, { &quot;id&quot;: &quot;2f562285125439fa&quot;, &quot;type&quot;: &quot;json&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;&quot;, &quot;property&quot;: &quot;payload&quot;, &quot;action&quot;: &quot;&quot;, &quot;pretty&quot;: false, &quot;x&quot;: 370, &quot;y&quot;: 280, &quot;wires&quot;: [ [ &quot;92390ea9542f7d98&quot;, &quot;f05dcbaeb0b56327&quot; ] ] }, { &quot;id&quot;: &quot;92390ea9542f7d98&quot;, &quot;type&quot;: &quot;debug&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;debug 21&quot;, &quot;active&quot;: true, &quot;tosidebar&quot;: true, &quot;console&quot;: false, &quot;tostatus&quot;: false, &quot;complete&quot;: &quot;false&quot;, &quot;statusVal&quot;: &quot;&quot;, &quot;statusType&quot;: &quot;auto&quot;, &quot;x&quot;: 540, &quot;y&quot;: 340, &quot;wires&quot;: [] }, { &quot;id&quot;: &quot;44a316b0cfd35c61&quot;, &quot;type&quot;: &quot;uuid&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;uuidVersion&quot;: &quot;v4&quot;, &quot;namespaceType&quot;: &quot;&quot;, &quot;namespace&quot;: &quot;&quot;, &quot;namespaceCustom&quot;: &quot;&quot;, &quot;name&quot;: &quot;&quot;, &quot;field&quot;: &quot;payout&quot;, &quot;fieldType&quot;: &quot;msg&quot;, &quot;x&quot;: 650, &quot;y&quot;: 140, &quot;wires&quot;: [ [ &quot;cac865acbbf690d4&quot; ] ] }, { &quot;id&quot;: &quot;b311cc5a69222188&quot;, &quot;type&quot;: &quot;uuid&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;uuidVersion&quot;: &quot;v4&quot;, &quot;namespaceType&quot;: &quot;&quot;, &quot;namespace&quot;: &quot;&quot;, &quot;namespaceCustom&quot;: &quot;&quot;, &quot;name&quot;: &quot;&quot;, &quot;field&quot;: &quot;payout&quot;, &quot;fieldType&quot;: &quot;msg&quot;, &quot;x&quot;: 650, &quot;y&quot;: 200, &quot;wires&quot;: [ [ &quot;26976f8ef7c30cb0&quot; ] ] }, { &quot;id&quot;: &quot;27109d1b3fabf25c&quot;, &quot;type&quot;: &quot;debug&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;debug 22&quot;, &quot;active&quot;: true, &quot;tosidebar&quot;: true, &quot;console&quot;: false, &quot;tostatus&quot;: false, &quot;complete&quot;: &quot;false&quot;, &quot;statusVal&quot;: &quot;&quot;, &quot;statusType&quot;: &quot;auto&quot;, &quot;x&quot;: 500, &quot;y&quot;: 80, &quot;wires&quot;: [] }, { &quot;id&quot;: &quot;f05dcbaeb0b56327&quot;, &quot;type&quot;: &quot;Ambient&quot;, &quot;z&quot;: &quot;458a61ef3f0be4ba&quot;, &quot;name&quot;: &quot;&quot;, &quot;channelId&quot;: &quot;&quot;, &quot;writeKey&quot;: &quot;&quot;, &quot;x&quot;: 540, &quot;y&quot;: 280, &quot;wires&quot;: [] }, { &quot;id&quot;: &quot;c838b41f45982027&quot;, &quot;type&quot;: &quot;websocket-listener&quot;, &quot;path&quot;: &quot;ws&quot;, &quot;wholemsg&quot;: &quot;false&quot; } ]<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306fMinecraft\u306e\u753b\u9762\u3067Node-RED\u3092\u5b9f\u884c\u3057\u3066\u3044\u308bRaspberry Pi\u306eCPU\u6e29\u5ea6\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u8868\u793a\u3057\u3001\u305d\u308c\u3092\u30b0\u30e9\u30d5\u5316\u3055\u305b\u3066\u307f\u305f\u306e\u3067\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u958b\u767a\u74b0\u5883 PC\uff1aWindows 11 \u203bRaspberry<\/p>\n","protected":false},"author":10,"featured_media":3815,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,11,12],"tags":[22,14,13],"class_list":["post-3798","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-intern","category-kobayashi","category-kobayashi-intern","tag-ambient","tag-minecraft","tag-node-red"],"jetpack_featured_media_url":"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/01\/title7.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/3798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3798"}],"version-history":[{"count":3,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/3798\/revisions"}],"predecessor-version":[{"id":3814,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/3798\/revisions\/3814"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/media\/3815"}],"wp:attachment":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}