{"id":78,"date":"2025-12-27T13:15:05","date_gmt":"2025-12-27T05:15:05","guid":{"rendered":"https:\/\/fky.ltd\/?p=78"},"modified":"2025-12-27T13:15:05","modified_gmt":"2025-12-27T05:15:05","slug":"%e6%b8%a9%e5%ba%a6%e4%bc%a0%e6%84%9f%e5%99%a8%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/fky.ltd\/index.php\/2025\/12\/27\/%e6%b8%a9%e5%ba%a6%e4%bc%a0%e6%84%9f%e5%99%a8%e6%b5%8b%e8%af%95\/","title":{"rendered":"\u6e29\u5ea6\u4f20\u611f\u5668\u6d4b\u8bd5"},"content":{"rendered":"\n<div>\n  <h3>\u6e29\u6e7f\u5ea6\u76d1\u6d4b<\/h3>\n  <p id=\"inTemp\">\u5ba4\u5185\u6e29\u5ea6: --<\/p>\n  <p id=\"inHum\">\u5ba4\u5185\u6e7f\u5ea6: --<\/p>\n  <p id=\"outTemp\">\u5ba4\u5916\u6e29\u5ea6: --<\/p>\n  <p id=\"outHum\">\u5ba4\u5916\u6e7f\u5ea6: --<\/p>\n  <p id=\"comfort\">\u8212\u9002\u5ea6: --<\/p>\n<\/div>\n\n<script>\nasync function fetchData(){\n  try{\n    const res = await fetch('http:\/\/192.168.0.72:5000\/latest');\n    const data = await res.json();\n\n    document.getElementById(\"inTemp\").innerText = \"\u5ba4\u5185\u6e29\u5ea6: \" + data.indoorT + \"\u00b0C\";\n    document.getElementById(\"inHum\").innerText = \"\u5ba4\u5185\u6e7f\u5ea6: \" + data.indoorH + \"%\";\n    document.getElementById(\"outTemp\").innerText = \"\u5ba4\u5916\u6e29\u5ea6: \" + data.outdoorT + \"\u00b0C\";\n    document.getElementById(\"outHum\").innerText = \"\u5ba4\u5916\u6e7f\u5ea6: \" + data.outdoorH + \"%\";\n\n    let comfort = \"\u672a\u77e5\";\n    if(data.indoorT>=20 && data.indoorT<=26 && data.indoorH>=40 && data.indoorH<=60){\n      comfort = \"\u8212\u9002 :)\";\n    } else if(data.indoorT<20 || data.indoorH<40){ comfort = \"\u5e72\u51b7 :|\"; }\n    else if(data.indoorT>26 || data.indoorH>60){ comfort = \"\u70ed\u6e7f :(\"; }\n    else { comfort = \"\u4e00\u822c :\/\"; }\n\n    document.getElementById(\"comfort\").innerText = \"\u8212\u9002\u5ea6: \" + comfort;\n\n  }catch(e){\n    console.log(\"Error:\",e);\n  }\n}\n\nsetInterval(fetchData,5000); \/\/ \u6bcf5\u79d2\u5237\u65b0\nfetchData();\n<\/script>\n\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6e29\u6e7f\u5ea6\u76d1\u6d4b \u5ba4\u5185\u6e29\u5ea6: &#8212; \u5ba4\u5185\u6e7f\u5ea6: &#8212; \u5ba4\u5916\u6e29\u5ea6: &#8212; \u5ba4\u5916\u6e7f\u5ea6: &#8212; \u8212\u9002\u5ea6: &#8212;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":0,"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fky.ltd\/index.php\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}