{"id":621,"date":"2022-11-21T22:50:18","date_gmt":"2022-11-21T14:50:18","guid":{"rendered":"http:\/\/wordpress.loc\/?p=621"},"modified":"2023-02-22T20:48:30","modified_gmt":"2023-02-22T12:48:30","slug":"esp32_ch1-16","status":"publish","type":"post","link":"https:\/\/www.nmking.io\/index.php\/2022\/11\/21\/621\/","title":{"rendered":"\u7b2c13\u7bc7 ESP32 LINE\u901a\u77e5\uff1a\u5009\u5eab\u6eab\u5ea6\u7570\u5e38\u6a5f\u5668\u4eba"},"content":{"rendered":"\n<figure class=\"wp-block-pullquote\"><blockquote><p>\u672c\u7ae0\u5247\u8981\u4ecb\u7d39\u5982\u4f55\u8b93ESP32\u6210\u70ba\u4e00\u500b\u5c0f\u5e6b\u624b\uff0c\u80fd\u5e6b\u6211\u5011\u76e3\u770b\u5009\u5eab\u7684\u6eab\u6fd5\u5ea6\uff0c\u4e26\u5728\u767c\u751f\u7570\u5e38\u6642\u767c\u8a0a\u606f\u901a\u77e5\u6211\u5011\uff0c\u8b93\u6211\u5011\u80fd\u7acb\u5373\u8655\u7406\u7570\u5e38\uff0c\u907f\u514d\u707d\u5bb3\u64f4\u5927\uff0c\u9019\u6a23\u662f\u4e0d\u662f\u5f88\u65b9\u4fbf\u5462\uff1f<\/p><\/blockquote><\/figure>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-ht-block-toc is-style-rounded htoc htoc--position-wide toc-list-style-plain\" data-htoc-state=\"expanded\"><span class=\"htoc__title\"><span class=\"ht_toc_title\">Table of Contents<\/span><span class=\"htoc__toggle\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"16\" height=\"16\"><g fill=\"#444\"><path d=\"M15 7H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z\"><\/path><path d=\"M15 1H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM15 13H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z\"><\/path><\/g><\/svg><\/span><\/span><div class=\"htoc__itemswrap\"><ul class=\"ht_toc_list\"><li class=\"\"><a href=\"#htoc-\">\u5be6\u505a\u8aaa\u660e<\/a><\/li><li class=\"\"><a href=\"#htoc-line-api\">Line-API\u5de5\u5177<\/a><\/li><li class=\"\"><a href=\"#htoc-line-notify\">\u4e00\u3001\u7533\u8acbLine Notify\u6b0a\u6756<\/a><\/li><li class=\"\"><a href=\"#htoc-line-notify1\">\u4e8c\u3001\u624b\u52d5\u6e2c\u8a66Line Notify<\/a><\/li><li class=\"\"><a href=\"#htoc-esp32-dht11\">\u4e09\u3001ESP32 DHT11\u7dda\u8def\u4f48\u7f6e<\/a><\/li><li class=\"\"><a href=\"#htoc-11\">\u56db\u3001\u7a0b\u5f0f\u64b0\u5beb<\/a><\/li><li class=\"\"><a href=\"#htoc-111\">\u4e94\u3001\u6ce8\u610f\u4e8b\u9805<\/a><\/li><\/ul><\/div><\/div>\n\n\n\n<p>\u6211\u7684ESP32\u5be6\u505a\u66f8\u7c4d\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.nmking.io\/index.php\/2022\/11\/10\/esp32_ch1-2\/\" target=\"_blank\">\u6211\u51fa\u66f8\u4e86 ESP32 \u7269\u806f\u7db2\u5c08\u984c<\/a><br>\u535a\u5ba2\u4f86\u7db2\u5740\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.books.com.tw\/products\/0010901195\" target=\"_blank\">https:\/\/www.books.com.tw\/products\/0010901195<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-\">\u5be6\u505a\u8aaa\u660e<\/h2>\n\n\n\n<p>\u7576\u6211\u5011\u5f9e\u4e0a\u4e00\u7ae0\u5b78\u7fd2\u5982\u4f55\u5229\u7528ESP32\u6240\u5177\u5099\u7684WiFi\u4e0a\u7db2\u80fd\u529b\uff0c\u4e26\u5230\u516c\u958b\u8cc7\u8a0a\u7db2\u7ad9\u4e0a\u53d6\u5f97\u53f0\u7063\u5404\u5730PM2.5\u7684\u6578\u503c\uff0c\u672c\u7ae0\u5247\u8981\u4ecb\u7d39\u5982\u4f55\u8b93ESP32\u6210\u70ba\u4e00\u500b\u5c0f\u5e6b\u624b\uff0c\u80fd\u5e6b\u6211\u5011\u76e3\u770b\u5009\u5eab\u7684\u6eab\u6fd5\u5ea6\uff0c\u4e26\u5728\u767c\u751f\u7570\u5e38\u6642\u767c\u8a0a\u606f\u901a\u77e5\u6211\u5011\uff0c\u8b93\u6211\u5011\u80fd\u7acb\u5373\u8655\u7406\u7570\u5e38\uff0c\u907f\u514d\u707d\u5bb3\u64f4\u5927\uff0c\u9019\u6a23\u662f\u4e0d\u662f\u5f88\u65b9\u4fbf\u5462\uff1f<\/p>\n\n\n\n<p>\u800c\u5728\u53f0\u7063\u5e7e\u4e4e\u6bcf\u500b\u4eba\u90fd\u6709\u624b\u6a5f\uff0c\u4e0d\u7ba1\u662fApple\u6216\u662fAndroid\uff0c\u4e5f\u90fd\u6703\u5b89\u88ddLine\u901a\u8a0a\u8edf\u9ad4\u4f86\u8ddf\u5bb6\u4eba\u670b\u53cb\u806f\u7e6b\uff0c\u5229\u7528Line\u4f86\u6253\u6253\u5b57\u6216\u662f\u8a9e\u97f3\u901a\u8a0a\u90fd\u662f\u514d\u8cbb\u7684\uff0c\u800c\u4e14\u9084\u6709\u53ef\u611b\u7684\u8cbc\u5716\u53ef\u4ee5\u7528\uff0c\u6240\u4ee5\u767c\u9001Line\u8a0a\u606f\u53ef\u4ee5\u8aaa\u662f\u6700\u65b9\u4fbf\u5373\u6642\u7684\uff0c\u4e0d\u904eESP32\u8981\u5982\u4f55\u4e32\u63a5Line\u7684\u8a0a\u606f\u5462\uff1fESP32\u53c8\u6c92\u6709\u624b\u6307\u662f\u8981\u5982\u4f55\u6253\u5b57\u5462\uff1f<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-line-api\">Line-API\u5de5\u5177<\/h2>\n\n\n\n<p>Line\u6709\u63d0\u4f9b\u4e00\u500b\u5b98\u65b9\u7684\u7db2\u7ad9\u5de5\u5177\uff0c\u53ef\u4ee5\u8b93\u6211\u5011\u900f\u904e\u8a72\u7db2\u7ad9\u50b3\u905e\u53c3\u6578\uff0c\u53c3\u6578\u5247\u5305\u62ec\u8a0a\u606f\u5167\u5bb9\u53ca\u6b0a\u6756\uff0c\u6b0a\u6756\u5247\u662f\u4ee3\u8868\u8981\u50b3\u905e\u7684Line\u7fa4\u7d44\uff0c\u7576\u7db2\u7ad9\u6536\u5230\u9019\u4e9b\u53c3\u6578\u4e4b\u5f8c\u5c31\u6703\u5c07\u8a0a\u606f\u50b3\u905e\u5230\u6307\u5b9a\u7684Line\u7fa4\u7d44\u3002\u4e5f\u5c31\u662f\u8aaa\uff0cESP32\u4e26\u4e0d\u662f\u76f4\u63a5\u628a\u8a0a\u606f\u50b3\u5230\u67d0\u500b\u4eba\u624b\u6a5f\u7684Line\u88e1\u9762\uff0c\u800c\u662f\u900f\u904e\u67d0\u500b\u7db2\u7ad9\u5354\u52a9\u4e2d\u9593\u8f49\u50b3\u8a0a\u606f\uff0c\u901a\u5e38\u9019\u985e\u7684\u7db2\u7ad9\u5c31\u901a\u7a31\u70baAPI(Application Programming Interface)\uff0c\u4f7f\u7528\u9019\u4e9bAPI\u5de5\u5177\u6211\u5011\u5c31\u53ef\u4ee5\u7701\u53bb\u5b78\u7fd2Line APP\u5167\u8907\u96dc\u7684\u901a\u8a0a\u5354\u5b9a\u3001\u6a5f\u5236\u3001\u683c\u5f0f\u3001\u67b6\u69cb\u2026\u7b49\u7b49\uff0c\u53ea\u9700\u8981\u628a\u8cc7\u6599\u50b3\u7d66API\uff0c\u800cAPI\u5c31\u6703\u8655\u7406\u6240\u6709\u7684\u901a\u8a0a\u904e\u7a0b\uff0c\u8b93\u6211\u5011\u7701\u4e0b\u5f88\u591a\u7a0b\u5f0f\u958b\u767c\u7684\u6642\u9593\u3002<\/p>\n\n\n\n<p>\u6574\u7406\u4e0a\u9762\u7684\u5167\u5bb9\uff0c\u4e5f\u5c31\u662f\u8aaa\u9996\u5148\u6211\u5011\u5229\u7528ESP32\u53caDHT11\u76e3\u770b\u73fe\u5834\u7684\u6eab\u6fd5\u5ea6\uff08\u4e5f\u53ef\u4ee5\u518d\u52a0\u4e0a\u6c23\u9ad4\u5075\u6e2cMQ2\u3001\u6c34\u4f4d\u611f\u6e2c\u2026\u7b49\uff09\uff0c\u7576\u767c\u73fe\u7570\u5e38\u6642\uff08\u4f8b\u5982\u6eab\u5ea6&gt;40\u6216\u6fd5\u5ea6&gt;85\uff09\u5c31\u767c\u9001\u5230Line\u7684API\u7db2\u7ad9\uff0cLine API\u6536\u5230\u6211\u5011\u7684\u8a0a\u606f\u4e4b\u5f8c\uff0c\u5c31\u6703\u8f49\u50b3\u5230\u6307\u5b9a\u7684Line\u7fa4\u7d44\u4e2d\uff0c\u8b93\u76f8\u95dc\u7684\u7ba1\u7406\u4eba\u54e1\u6536\u5230\u8a0a\u606f\uff0c\u7136\u5f8c\u7acb\u5373\u8655\u7406\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-line-notify\">\u4e00\u3001\u7533\u8acbLine Notify\u6b0a\u6756<\/h2>\n\n\n\n<p>Line Notify\u7684\u7db2\u7ad9\u7533\u8acb\u958b\u901a\u670d\u52d9\uff0c\u9996\u5148\u5728\u700f\u89bd\u5668\u4e2d\u8f38\u5165\u7db2\u5740\uff1ahttps:\/\/notify-bot.line.me\/\uff0c\u4e26\u9ede\u9078\u53f3\u4e0a\u89d2\u7684\u767b\u5165\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945452-1358133824_n.png?resize=839%2C468&#038;ssl=1\" alt=\"\" width=\"839\" height=\"468\"\/><figcaption class=\"wp-element-caption\">Line Notify\u7db2\u7ad9<\/figcaption><\/figure>\n\n\n\n<p>\u8f38\u5165Line\u5e33\u865f\u5bc6\u78bc\u5f8c\uff0c\u6309\u4e0b\u65b9\u7684\u767b\u5165<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945549-3047758314_n.png?resize=840%2C498&#038;ssl=1\" alt=\"\" width=\"840\" height=\"498\"\/><figcaption class=\"wp-element-caption\">LINE\u767b\u5165\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<p>\u5b8c\u6210\u767b\u5165\uff0c\u9ede\u9078\u53f3\u4e0a\u89d2\u7684\u767b\u5165\u5e33\u865f\/\u500b\u4eba\u9801\u9762\uff0c\u5373\u53ef\u9032\u5165\u300c\u5df2\u9023\u52d5\u670d\u52d9\u300d\u7ba1\u7406\u9801\u9762<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945636-2115351207_n.png?resize=840%2C434&#038;ssl=1\" alt=\"\" width=\"840\" height=\"434\"\/><figcaption class=\"wp-element-caption\">\u529f\u80fd\u9078\u55ae\u9032\u5165\u500b\u4eba\u9801\u9762<\/figcaption><\/figure>\n\n\n\n<p>Line\u7fa4\u7d44\u901a\u8a0a\u7684\u5bc6\u78bc\uff0c\u82e5\u7121\u6b64\u5bc6\u78bc\uff0c\u6211\u5011\u7684Line\u53ef\u80fd\u6bcf\u5929\u90fd\u6703\u6536\u5230\u4e00\u5806\u5ee3\u544a\u8a0a\u606f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945664-2886370150_n.png?resize=842%2C588&#038;ssl=1\" alt=\"\" width=\"842\" height=\"588\"\/><\/figure>\n\n\n\n<p>\u5728\u8a2d\u5b9a\u6b0a\u6756\u9801\u9762\u5206\u5225\u8f38\u5165<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u540d\u7a31\uff1a\u672a\u4f86\u767c\u8a0a\u8a0a\u606f\u901a\u77e5\u6642\uff0c\u6703\u51fa\u73fe\u7684\u540d\u7a31<\/li>\n\n\n\n<li>\u5c0d\u8c61\uff1a\u8981\u767c\u9001\u8a0a\u606f\u7684\u7fa4\u7d44\uff0c\u6b64\u8655\u7df4\u7fd2\u6642\u5148\u9078\u64c7\u300c\u900f\u904e1\u5c0d1\u804a\u5929\u63a5\u6536LINE Notify\u901a\u77e5\u300d\n<ul class=\"wp-block-list\">\n<li>\u4e5f\u5c31\u662f\u50b3\u8a0a\u7d66\u81ea\u5df1\uff0c\u53e6\u5916\u9019\u88e1\u4f60\u6703\u767c\u73fe\u5728\u6e05\u55ae\u4e2d\u627e\u4e0d\u5230\u4f60\u67d0\u500b\u7279\u5b9a\u7684\u670b\u53cb\uff0c\u800c\u53ea\u80fd\u9078\u300c\u7fa4\u7d44\u300d\u4f86\u767c\u9001\u8a0a\u606f\uff0c\u9019\u662f\u56e0\u70ba\u6211\u5011\u76ee\u524d\u4f7f\u7528\u7684Line\u901a\u77e5\u662f\u514d\u8cbb\u7684Notify\u529f\u80fd\uff0c\u82e5\u60a8\u8981\u901a\u77e5\u7279\u5b9a\u7684\u300c\u4eba\u300d\u5247\u5fc5\u9808\u7533\u8acbLine Bot\uff0c\u9019\u90e8\u4efd\u5247\u8f03\u70ba\u8907\u96dc\uff0c\u672c\u66f8\u5148\u7565\u904e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u5b8c\u6210\u8f38\u5165\u5f8c\uff0c\u6309\u4e0b\u65b9\u7684\u767c\u884c\u5373\u53ef\u7372\u5f97\u4e00\u7d44\u5bc6\u78bc\uff0c\u6b64\u5373\u70ba\u6b0a\u6756\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945734-992693282_n.png?resize=440%2C630&#038;ssl=1\" alt=\"\" width=\"440\" height=\"630\"\/><figcaption class=\"wp-element-caption\">\u8a2d\u5b9a\u6b0a\u6756\u9801\u9762<\/figcaption><\/figure>\n\n\n\n<p>\u62ff\u5230\u6b0a\u6756\u5f8c\uff0c\u9ede\u9078\u4e0b\u65b9\u7684\u8907\u88fd\u6309\u9215\u5c07\u5bc6\u78bc\u8907\u88fd\u8d77\u4f86\uff0c\u4e26\u8cbc\u5728\u8a18\u4e8b\u672c\u4e0a\uff0c\u907f\u514d\u907a\u5931\uff0c\u82e5\u907a\u5931\u4e5f\u4e0d\u7528\u7dca\u5f35\uff0c\u91cd\u65b0\u7533\u8acb\u4e00\u6b21\u5373\u53ef\uff0c\u4e0d\u904e\u5c31\u7b97\u7533\u8acb\u7684\u5c0d\u8c61\u662f\u540c\u4e00\u500b\uff0c\u6bcf\u6b21\u7684\u6b0a\u6756\u5bc6\u78bc\u90fd\u662f\u4e0d\u76f8\u540c\u7684\uff0c\u4f46\u529f\u80fd\u662f\u4e00\u6a23\u7684\uff0c\u5f8c\u9762\u7533\u8acb\u7684\u4e5f\u4e0d\u6703\u4f7f\u4e4b\u524d\u7533\u8acb\u7684\u6b0a\u6756\u5931\u6548\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945779-1202625632.png?resize=433%2C361&#038;ssl=1\" alt=\"\" width=\"433\" height=\"361\"\/><figcaption class=\"wp-element-caption\">\u7372\u53d6\u6b0a\u6756\u5bc6\u78bc<\/figcaption><\/figure>\n\n\n\n<p>\u78ba\u8a8d\u7533\u8acb\u5b8c\u6210\uff0c\u5c07\u6703\u7522\u751f\u4e00\u500b\u9023\u52d5\u670d\u52d9\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945802-77950311.png?resize=841%2C401&#038;ssl=1\" alt=\"\" width=\"841\" height=\"401\"\/><figcaption class=\"wp-element-caption\">\u5b8c\u6210\u9023\u52d5\u8a2d\u5b9a<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-line-notify1\">\u4e8c\u3001\u624b\u52d5\u6e2c\u8a66Line Notify<\/h2>\n\n\n\n<p>Line Notify\u6b0a\u6756\u662f\u5426\u6b63\u5e38\uff0c\u4e5f\u9806\u4fbf\u4e86\u89e3Line API\u7684\u904b\u4f5c\u65b9\u5f0f\uff08\u5982\u9700\u8981\u66f4\u8a73\u7d30\u7684Line Notify API\u53ef\u53c3\u95b1\u7db2\u5740\uff1a<a href=\"https:\/\/notify-bot.line.me\/doc\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/notify-bot.line.me\/doc\/<\/a>\uff09<\/p>\n\n\n\n<p>\u9996\u5148\u6211\u5011\u5148\u5230\u9023\u7dda\u5230\u77e5\u540d\u7684API\u6e2c\u8a66\u7db2\u5740API Tester\uff1a<a href=\"https:\/\/apitester.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/apitester.com\/<\/a>\uff08\u6216\u8005\u5b89\u88ddPOSTMAN API\u6e2c\u8a66\u8edf\u9ad4\uff09\uff0c\u4e26\u4f9d\u7167\u898f\u5b9a\u8f38\u5165Line Notify\u7684\u76f8\u95dc\u8a2d\u5b9a\u5982\u4e0b\u5716\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4fee\u6539\u50b3\u905e\u65b9\u5f0fPOST<\/li>\n\n\n\n<li>\u8f38\u5165Line Notify API\u7db2\u7ad9\uff1ahttps:\/\/notify-api.line.me\/api\/notify<\/li>\n\n\n\n<li>\u8f38\u5165\u50b3\u905e\u7684\u8a0a\u606f\u5167\u5bb9\uff1amessage=\u9019\u662f\u6e2c\u8a66<\/li>\n\n\n\n<li>\u9ede\u9078\u300c+\u300d\u865f\uff0c\u589e\u52a0\u4e00\u500b\u8868\u982dRequest Header\uff0c\u6211\u5011\u6703\u5c07\u5bc6\u78bc\u653e\u5728\u8868\u982d\u8207Line API\u505a\u9a57\u8b49\n<ul class=\"wp-block-list\">\n<li>-\u8f38\u5165\u8868\u982d\u540d\u7a31\uff1aAuthorization<\/li>\n\n\n\n<li>-\u8f38\u5165\u8a8d\u8b49\u5167\u5bb9\uff1aBearer \u6b0a\u6756\u5bc6\u78bc\uff0c\u8981\u6ce8\u610f\u7684\u662fBearer\u8207\u6b0a\u6756\u5bc6\u78bc\u4e2d\u9593\u6709\u4e00\u500b\u7a7a\u767d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u5b8c\u6210\u8a2d\u5b9a\u5f8c\u5f8c\uff0c\u6309\u4e0b\u4e0b\u65b9\u7684\u85cd\u8272Test\u6309\u9215\uff0c\u5373\u53ef\u5728\u624b\u6a5f\u6536\u5230LINE\u50b3\u4f86\u7684\u8a0a\u606f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583945988-2376026651_n.png?resize=842%2C420&#038;ssl=1\" alt=\"\" width=\"842\" height=\"420\"\/><figcaption class=\"wp-element-caption\">API Tester \u7db2\u7ad9\u8a2d\u5b9a<\/figcaption><\/figure>\n\n\n\n<p>\u5176\u4e2d\u524d\u9762\u3010\u3011\u5167\u7684\u540d\u7a31\u5c31\u662f\u4e00\u958b\u59cb\u7533\u8acb\u6642\u7684\u540d\u7a31\uff08\u5716X\uff09\uff0c\u800c\u5f8c\u65b9\u7684\u8a0a\u606f\u300c\u9019\u662f\u6e2c\u8a66\u300d\u5247\u662f\u5728API tester\u7db2\u7ad9\u8f38\u5165\u7684\u5167\u5bb9\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583946028-316829449.png?resize=477%2C425&#038;ssl=1\" alt=\"\" width=\"477\" height=\"425\"\/><figcaption class=\"wp-element-caption\">\u6e2c\u8a66\u6210\u529f\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<p>\u7d93\u7531\u4e0a\u9762\u7684\u6e2c\u8a66\u53ef\u4ee5\u767c\u73fe\uff0c\u7528ESP32\u50b3LINE\u7684\u65b9\u5f0f\u5c31\u662f\u5c07\u8cc7\u6599\u50b3\u905e\u5230LINE\u7684API\u7db2\u7ad9https:\/\/notify-api.line.me\/api\/notify\uff0c\u4e26\u5c07\u8a0a\u606f\u5167\u5bb9\u53ca\u6b0a\u6756\u5bc6\u78bc\u4ee5\u53c3\u6578\u65b9\u5f0f\u593e\u5e36\u7d66\u7db2\u7ad9\uff0c\u7db2\u7ad9\u6536\u5230\u5f8c\u5c31\u6703\u5c07\u8a0a\u606f\u50b3\u905e\u7d66\u6b0a\u6756\u6240\u5c0d\u61c9\u7684\u4f7f\u7528\u8005\u3002<br><br>\u4e0b\u4e00\u7bc0\u6211\u5011\u4f7f\u7528ESP32\u81ea\u52d5\u50b3LINE\u6642\uff0c\u4e5f\u662f\u4e00\u6a23\u8981\u6307\u5b9a\u9019\u4e9b\u8a0a\u606f\uff0c\u5c31\u53ef\u4ee5\u8cc7\u8a0a\u50b3\u905e\u7d66\u76f8\u95dc\u7684\u4eba\u54e1\u3002<br><br>\u53e6\u5916\u5982\u679c\u60a8\u9078\u64c7\u50b3\u8a0a\u7684\u5c0d\u8c61\u662f\u4e00\u500b\u7fa4\u7d44\uff0c\u90a3\u9ebc\u8981\u591a\u4e00\u500b\u52d5\u4f5c\uff1a\u9080\u8acbLINE Notify\u9032\u5165\u7fa4\u7d44\u5167\uff0c\u5426\u5247\u6703\u51fa\u73fe\u4e00\u500b\u932f\u8aa4\u8a0a\u606f\u662f\uff1a\u6b64\u5e33\u865f\u5c1a\u672a\u88ab\u9080\u8acb\u81f3\u5df2\u9023\u52d5\u7684\u7fa4\u7d44\u3002<\/p>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583946136-1636038649.png?resize=408%2C409&#038;ssl=1\" alt=\"\" width=\"408\" height=\"409\"\/><figcaption class=\"wp-element-caption\">LINE\u7fa4\u7d44\u9080\u8acb<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583946142-1200963640.png?w=1290&#038;ssl=1\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u9078\u64c7LINE Notify<\/figcaption><\/figure>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-esp32-dht11\">\u4e09\u3001ESP32 DHT11\u7dda\u8def\u4f48\u7f6e<\/h2>\n\n\n\n<p>\u672c\u90e8\u4efd\u53c3\u8003\u524d\u7bc7\u5167\u5bb9\uff1a<a href=\"https:\/\/www.nmking.io\/index.php\/2022\/11\/17\/esp32_ch1-6\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u7b2c\u4e5d\u7bc7-esp32-\u6eab\u6fd5\u5ea6\u986f\u793a\u5668(dht11+1602-lcd)<\/a> \uff0c\u5b8c\u6210\u7dda\u8def\u4f48\u7f6e\u4e26\u6e2c\u8a66\u8b80\u53d6\u6210\u529f\u5f8c\uff0c\u518d\u9032\u884c\u4e0b\u4e00\u500b\u6b65\u9a5f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-11\">\u56db\u3001\u7a0b\u5f0f\u64b0\u5beb<\/h2>\n\n\n\n<p>\u5c31\u5982\u7b2c\u4e8c\u7bc0\u6240\u5c55\u793a\uff0c\u9019\u6b21\u6211\u5011\u7684\u7a0b\u5f0f\u5c07\u4f7f\u7528wificlientsecure\u9032\u884c\u5be6\u505a\uff0cwificlientsecure\u8ddf\u4e0a\u4e00\u7ae0\u7684httpclient\u4e0d\u540c\u7684\u5730\u65b9\u5728\u65bcwificlientsecure\u53ef\u4ee5\u652f\u63f4https\u52a0\u5bc6\u5354\u5b9a\uff0c\u800chttpclient\u53ea\u80fd\u7528HTTP GET\u5354\u5b9a\u505a\u53c3\u6578\u50b3\u905e\uff0cwificlientsecure\u53cawificlient\u53ef\u4ee5\u7528\u4f86\u505aPOST\u5354\u5b9a\u3002<br>\u7a0b\u5f0f\u4e3b\u8981\u5206\u6210\u5e7e4\u500b\u6d41\u7a0b<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u521d\u59cb\u5316\u8a2d\u5b9a\uff1a\u8a2d\u5b9a\u7121\u7dda\u7db2\u8defSSID, Password, LINE API\u7db2\u5740, \u6b0a\u6756\u5bc6\u78bc\u7b49\u8cc7\u8a0a<\/li>\n\n\n\n<li>\u9023\u7ddaWifi\u7db2\u8def<\/li>\n\n\n\n<li>\u5728Loop\u4e2d\u91cd\u8907\u76e3\u770bDHT11\u6eab\u6fd5\u5ea6\u8cc7\u6599<\/li>\n\n\n\n<li>\u767c\u73feDHT11\u6eab\u5ea6\u6216\u6fd5\u5ea6\u904e\u9ad8\uff0c\u5247\u5229\u7528wificlientsecure\u5c07\u8cc7\u6599POST\u5230LINE\u7db2\u5740<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-111\">\u4e94\u3001\u6ce8\u610f\u4e8b\u9805<\/h2>\n\n\n\n<p>\u6700\u8fd1\u5f88\u591a\u5925\u4f34\u8aaa\u7a0b\u5f0f\u7121\u6cd5\u57f7\u884c\uff0c\u6703\u9047\u5230\u300cConnection Failed\u300d\u7684\u554f\u984c\uff0c\u4e3b\u8981\u662f\u56e0\u70baESP32\u76841.0.6\u7684\u6838\u5fc3\u6703\u5f37\u8feb\u4f7f\u7528SSL\u8a8d\u8b49<\/p>\n\n\n\n<p class=\"quote\">\u6b64\u6642\u53ef\u4ee5\u5148\u900f\u904e\u5728Setup()\u5167\u52a0\u4e0a\u300cclient.setInsecure();\u300d\u8a9e\u6cd5\u4f86\u89e3\u6c7a\uff0c\u5982\u4e0b\u65b9\u7d05\u8272\u5b57\u7684\u90e8\u4efd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u8acb\u6ce8\u610f\uff0cESP32 1.0.6\u7248WiFiClientSecure\u6709\u4e9b\u554f\u984c\uff0c\u5efa\u8b70\u5b89\u88dd1.0.4\u7248\n#include &lt;WiFi.h&gt;\n#include &lt;WiFiClientSecure.h&gt;\n#include &lt;SimpleDHT.h&gt;\n\n\/\/\u8acb\u4fee\u6539\u4ee5\u4e0b\u53c3\u6578--------------------------------------------\nchar SSID&#91;] = \"YourSSID\";\nchar PASSWORD&#91;] = \"YourPassword\";\nString Linetoken = \"Your Line Token\";\nint pinDHT11 = 14;\/\/\u5047\u8a2dDHT11\u63a5\u5728\u8173\u4f4dGPIO14\uff0c\u9eb5\u5305\u677f\u5de6\u5074\u5e8f\u865f8\n\/\/---------------------------------------------------------\nSimpleDHT11 dht11(pinDHT11);\/\/DHT11\u7269\u4ef6\nWiFiClientSecure client;\/\/\u7db2\u8def\u9023\u7dda\u7269\u4ef6\nchar host&#91;] = \"notify-api.line.me\";\/\/LINE Notify API\u7db2\u5740\n\nvoid setup() {\n  Serial.begin(115200);\n  \/\/\u9023\u7dda\u5230\u6307\u5b9a\u7684WiFi SSID\n  Serial.print(\"Connecting Wifi: \");\n  Serial.println(SSID);\n  WiFi.begin(SSID, PASSWORD);\n  while (WiFi.status() != WL_CONNECTED) {\n    Serial.print(\".\");\n    delay(500);\n  }\n  \/\/\u9023\u7dda\u6210\u529f\uff0c\u986f\u793a\u53d6\u5f97\u7684IP\n  Serial.println(\"\");\n  Serial.println(\"WiFi connected\");\n  Serial.println(\"IP address: \");\n  IPAddress ip = WiFi.localIP();\n  Serial.println(ip);\n  \/\/client.setInsecure();\/\/ESP32\u6838\u5fc3 1.0.6\u4ee5\u4e0a\n}\n\nvoid loop() {\n\n  \/\/\u5617\u8a66\u8b80\u53d6\u6eab\u6fd5\u5ea6\u5167\u5bb9\n  byte temperature = 0;\n  byte humidity = 0;\n  int err = SimpleDHTErrSuccess;\n  if ((err = dht11.read(&amp;temperature, &amp;humidity, NULL)) != SimpleDHTErrSuccess) {\n    Serial.print(\"Read DHT11 failed, err=\"); Serial.println(err); delay(1000);\n    return;\n  }\n  \/\/\u8b80\u53d6\u6210\u529f\uff0c\u5c07\u6eab\u6fd5\u5ea6\u986f\u793a\u5728\u5e8f\u5217\u8996\u7a97\n  Serial.print(\"Sample OK: \");\n  Serial.print((int)temperature); Serial.print(\" *C, \");\n  Serial.print((int)humidity); Serial.println(\" H\");\n\n  \/\/\u8a2d\u5b9a\u89f8\u767cLINE\u8a0a\u606f\u689d\u4ef6\u70ba\u6eab\u5ea6\u8d85\u904e30\u6216\u6fd5\u5ea6\u8d85\u904e80\n  if ((int)temperature &gt;= 30 || (int)humidity &gt;= 80) {\n    \/\/\u7d44\u6210Line\u8a0a\u606f\u5167\u5bb9\n    String message = \"\u6aa2\u6e2c\u74b0\u5883\u767c\u751f\u7570\u5e38\uff0c\u8acb\u5354\u52a9\u5118\u901f\u6d3e\u4eba\u67e5\u770b\u8655\u7406\uff0c\u76ee\u524d\u74b0\u5883\u72c0\u614b\uff1a\";\n    message += \"\\n\u6eab\u5ea6=\" + String(((int)temperature)) + \" *C\";\n    message += \"\\n\u6fd5\u5ea6=\" + String(((int)humidity)) + \" H\";\n    Serial.println(message);\n    if (client.connect(host, 443)) {\n      int LEN = message.length();\n      \/\/\u50b3\u905ePOST\u8868\u982d\n      String url = \"\/api\/notify\";\n      client.println(\"POST \" + url + \" HTTP\/1.1\");\n      client.print(\"Host: \"); client.println(host);\n      \/\/\u6b0a\u6756\n      client.print(\"Authorization: Bearer \"); client.println(Linetoken);\n      client.println(\"Content-Type: application\/x-www-form-urlencoded\");\n      client.print(\"Content-Length: \"); client.println( String((LEN + 8)) );\n      client.println();      \n      client.print(\"message=\"); client.println(message);\n      client.println();\n      \/\/\u7b49\u5019\u56de\u61c9\n      delay(2000);\n      String response = client.readString();\n      \/\/\u986f\u793a\u50b3\u905e\u7d50\u679c\n      Serial.println(response);\n      client.stop(); \/\/\u65b7\u7dda\uff0c\u5426\u5247\u53ea\u80fd\u50b35\u6b21\n    }\n    else {\n      \/\/\u50b3\u9001\u5931\u6557\n      Serial.println(\"connected fail\");\n    }\n  }\n  \/\/\u6bcf5\u79d2\u8b80\u53d6\u4e00\u6b21\u6eab\u6fd5\u5ea6\n  delay(5000);\n}\n\n <\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583946500-4126276577_n.png?resize=527%2C458&#038;ssl=1\" alt=\"\" width=\"527\" height=\"458\"\/><figcaption class=\"wp-element-caption\">\u5b8c\u6210\u5f8c\u5e8f\u5217\u57e0\u50b3\u8f38\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1583946516-2194721341.png?resize=490%2C461&#038;ssl=1\" alt=\"\" width=\"490\" height=\"461\"\/><figcaption class=\"wp-element-caption\">LINE Notify\u8a0a\u606f\u756b\u9762<\/figcaption><\/figure>\n<\/div>\n\n\n\n<p>\u9664\u4e86\u50b3\u905e\u6587\u5b57\u4e4b\u5916\uff0c\u4e5f\u53ef\u4ee5\u50b3\u905e\u8cbc\u5716\u6216\u7167\u7247\u5594\uff0c\u6b64\u5916\u4e5f\u53ef\u4f7f\u7528LINE Library\u7684\u65b9\u5f0f\u5247\u66f4\u70ba\u7c21\u55ae\uff0c\u4f7f\u7528\u8005\u53ef\u81ea\u884cGoogle \u300cLine-Notify-ESP32\u300d\u5c31\u6703\u6709\u66f4\u591a\u7684\u8cc7\u8a0a\u5594\u3002<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"htoc-111111111\" style=\"font-size:clamp(16.293px, 1.018rem + ((1vw - 3.2px) * 0.68), 25px);\">\u5ef6\u4f38\u95b1\u8b80<\/h4>\n\n\n\n<p class=\"has-background has-medium-font-size\" style=\"background-color:#f2f2f2\">????   <a href=\"https:\/\/www.nmking.io\/index.php\/2022\/11\/22\/esp32_ch1-17\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u7b2c\u5341\u56db\u7bc7 ESP32 \u8cc7\u6599\u5eab\u5b58\u53d6ThingSpeak\u5716\u8868\u88fd\u4f5c<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7ae0\u5247\u8981\u4ecb\u7d39\u5982\u4f55\u8b93ESP32\u6210\u70ba\u4e00\u500b\u5c0f\u5e6b\u624b\uff0c\u80fd\u5e6b\u6211\u5011\u76e3\u770b\u5009\u5eab\u7684\u6eab\u6fd5\u5ea6\uff0c\u4e26\u5728\u767c\u751f\u7570\u5e38\u6642\u767c\u8a0a\u606f\u901a\u77e5\u6211\u5011\uff0c\u8b93\u6211\u5011\u80fd\u7acb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1,29],"tags":[],"class_list":["post-621","post","type-post","status-publish","format-standard","hentry","category-esp32","category-esp32-started"],"blocksy_meta":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/comments?post=621"}],"version-history":[{"count":4,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/621\/revisions"}],"predecessor-version":[{"id":928,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/621\/revisions\/928"}],"wp:attachment":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/media?parent=621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/categories?post=621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/tags?post=621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}