{"id":684,"date":"2020-08-13T22:35:09","date_gmt":"2020-08-13T14:35:09","guid":{"rendered":"https:\/\/www.iotch.xyz\/?p=684"},"modified":"2020-08-13T22:35:09","modified_gmt":"2020-08-13T14:35:09","slug":"%e4%bd%bf%e7%94%a8-esphome-%e6%8e%a5%e5%85%a5%e5%90%84%e7%a7%8d%e4%bc%a0%e6%84%9f%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.iotch.xyz\/?p=684","title":{"rendered":"\u4f7f\u7528 ESPHome \u63a5\u5165\u5404\u79cd\u4f20\u611f\u5668"},"content":{"rendered":"\n<p>\u6700\u5f00\u59cb\u63a5\u5165\u8fd9\u4e9b\u4f20\u611f\u5668\u662f\u4f7f\u7528 <a href=\"https:\/\/www.letscontrolit.com\/wiki\/index.php\/ESPEasy#Source_code_development\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >ESPEasy<\/a> \u7684\uff0c\u4f46\u540e\u6765\u53d1\u73b0\u83ab\u540d\u5176\u5999\u7684\u6b7b\u673a\uff0c\u4e00\u76f4\u6ca1\u6709\u627e\u5230\u539f\u56e0\uff0c\u5c1d\u8bd5\u66f4\u6362 MQTT \u548c\u4fee\u6539\u65e0\u7ebf\u7f51\u4fe1\u9053\u4e5f\u6ca1\u6709\u89e3\u51b3\uff0c\u6211\u63a8\u65ad\u53ef\u80fd\u662f\u6211\u53d1\u9001\u7684\u6570\u636e\u91cf\u8fc7\u5927\u5bfc\u81f4\u6a21\u5757\u65e0\u6cd5\u54cd\u5e94\uff08\u4e00\u79d2\u949f\u5927\u6982\u53d1\u9001\u4e09\u56db\u6761\u6570\u636e\uff09\uff0c\u540e\u6765\u5c31\u63a5\u5165\u4e00\u4e2a\u4f20\u611f\u5668\uff08\u4e00\u79d2\u949f\u53d1\u9001\u4e00\u6761\u6570\u636e\uff09\u4f46\u8fd9\u6837\u8fd8\u662f\u7ef4\u6301\u4e0d\u5230\u51e0\u5929\u53c8\u6b7b\u673a\u4e86\uff0c\u4e0d\u5f97\u5df2\u5c31\u653e\u5f03\u4e86 ESPEasy, \u4e8e\u662f\u5c31\u6709\u4e86\u4e0b\u9762\u7684 ESPHome\uff0c\u8fd9\u6b21\u6211\u6ca1\u6709\u4f7f\u7528 MQTT \u800c\u662f\u76f4\u63a5\u4f7f\u7528 API\u3002<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.taron.top\/usr\/plugins\/Mirages\/biaoqing\/aru\/E591B2E78999_2x.png\" alt=\"\u4f7f\u7528 ESPHome \u63a5\u5165\u5404\u79cd\u4f20\u611f\u5668\" title=\"\u4f7f\u7528 ESPHome \u63a5\u5165\u5404\u79cd\u4f20\u611f\u5668\" width=\"33\" height=\"33\"><\/p>\n\n\n\n<p><a href=\"https:\/\/esphome.io\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >ESPHome<\/a> \u662f\u4e3a ESP8266 \/ ESP32 \u677f\u521b\u5efa\u81ea\u5b9a\u4e49\u56fa\u4ef6\u7684\u5b8c\u7f8e\u89e3\u51b3\u65b9\u6848\u3002<br>\u4eba\u4f53\u4f20\u611f\u5668\u3001\u5149\u7ebf\u4f20\u611f\u5668\u548c\u8d85\u58f0\u6ce2\u4f20\u611f\u5668\u5728\u81ea\u52a8\u5316\u4e2d\u8d77\u5230\u4e86\u6bd4\u8f83\u91cd\u8981\u7684\u4f5c\u7528\uff0c\u901a\u8fc7\u4eba\u4f53\u4f20\u611f\u5668\u7684\u72b6\u6001\u5207\u6362\u53ef\u4ee5\u6267\u884c\u4e00\u7cfb\u5217\u7684\u81ea\u52a8\u5316\uff0c\u6bd4\u5982\u5f00\u5173\u706f\uff0c\u901a\u8fc7\u5149\u7ebf\u4f20\u611f\u5668\u7684\u5177\u4f53\u6570\u503c\u8303\u56f4\u4e5f\u53ef\u4ee5\u5f00\u5173\u706f\u3002<br>\u8a00\u5f52\u6b63\u4f20<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u51c6\u5907\uff1a<\/h2>\n\n\n\n<p>ESP8266 \u5f00\u53d1\u677f<br>BH1750<br>HC-SR04<br>DHT11<br>\u4eba\u4f53\u4f20\u611f\u5668<\/p>\n\n\n\n<p>\u9996\u5148\u5b89\u88c5 ESPHome\uff0cESPHome \u7684\u5b89\u88c5\u73af\u5883\u9700\u8981\u4f9d\u8d56 Python2.7, \u5bf9\u4e8e Linux \u548c Mac \u7528\u6237\u5c31\u6bd4\u8f83\u65b9\u4fbf\u4e86\uff0c\u53ea\u9700\u8981\u51e0\u6761\u547d\u4ee4\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u5b89\u88c5tornado\nsudo pip install tornado==5.1.1\n#\u5b89\u88c5esphome\nsudo pip2 install esphome\n#\u5f00\u542fesphome\u7684web\u8bbf\u95ee\nesphome esphome_config\/ dashboard\n<\/code><\/pre>\n\n\n\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\u8f93\u5165\u672c\u5730 IP:6052<img decoding=\"async\" alt=\"dashboard.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3052763430.png\">\u70b9\u51fb + \u53f7\u5f00\u59cb\u6dfb\u52a0\u914d\u7f6e\u7b2c\u4e00\u6b65\u8f93\u5165\u914d\u7f6e\u540d\u79f0<img decoding=\"async\" alt=\"1.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3923288801.png\">\u7b2c\u4e8c\u6b65\u9009\u62e9\u5408\u9002\u7684\u8bbe\u5907\u7c7b\u578b<img decoding=\"async\" alt=\"2.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/922207843.png\">\u7b2c\u4e09\u6b65\u8f93\u5165 wifi \u540d\u79f0\u548c\u5bc6\u7801<img decoding=\"async\" alt=\"4.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/1177108734.png\">\u7b2c\u56db\u6b65\u70b9\u51fb submit \u63d0\u4ea4\uff0c\u9009\u62e9\u5b9e\u9645\u7684 USB \u53e3\u7136\u540e\u70b9\u51fb\u4e0b\u9762\u7684 upload \u5c31\u4f1a\u81ea\u52a8\u5f00\u59cb\u4e0b\u8f7d\u4f9d\u8d56\u6253\u5305\u7f16\u8bd1\u4e0a\u4f20\u56fa\u4ef6\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u5148\u7f16\u8bd1\u4e0b\u8f7d\u4e0b\u6765\u7136\u540e\u7528 Flashesp8266 \u6216\u8005 esptool \u7b49\u5de5\u5177\u4e0a\u4f20<img decoding=\"async\" alt=\"5.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3696569514.png\"><img decoding=\"async\" alt=\"6.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3459978306.png\">\u70b9\u51fb EDIT \u5199\u5165\u76f8\u5173\u4f20\u611f\u5668\u914d\u7f6e<img decoding=\"async\" alt=\"7.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/1351541308.png\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>esphome:\n  name: chuangtou\n  platform: ESP8266\n  board: nodemcuv2\n\nwifi:\n  ssid: \"######\"\n  password: \"########\"\n  manual_ip:\n    static_ip: 192.168.123.56\n    gateway: 192.168.123.1\n    subnet: 255.255.255.0\n\n# Enable logging\nlogger:\n\n# Enable Home Assistant API\napi:\n  password: 'admin'\n\nota:\n  password: 'admin'\n\ni2c:\n  sda: 4\n  scl: 5\n  scan: True\n  \nsensor:\n  - platform: bh1750\n    name: \"lux\"\n    address: 0x23\n    update_interval: 1s\n    \n  - platform: ultrasonic\n    trigger_pin: D7\n    echo_pin: D6\n    name: \"sr04\"\n    update_interval: 1s\n    \n    \n  - platform: dht\n    pin: D5\n    temperature:\n      name: \"tem\"\n    humidity:\n      name: \"hum\"\n    update_interval: 1s\n    model: DHT11\n    \n    \nbinary_sensor:\n  - platform: gpio\n    pin: D3\n    name: \"ctrenti\"\n    device_class: motion\n    \n  - platform: status\n    name: \"esp1_status\"\n<\/code><\/pre>\n\n\n\n<p>\u63a5\u7ebf\uff1a<br>BH1750\uff1a<br>VCC\u2014\u2014\u2014\u2014\u2014\u20143V<br>SCL\u2014\u2014\u2014\u2014\u2014\u2014D1<br>SDA\u2014\u2014\u2014\u2014\u2014\u2014D2<br>GND\u2014\u2014\u2014\u2014\u2014\u2014GND<\/p>\n\n\n\n<p>HC-SR04:<br>VCC\u2014\u2014\u2014\u2014\u2014\u20143V<br>Trig\u2014\u2014\u2014\u2014\u2014D7<br>Echo\u2014\u2014\u2014\u2014\u2014D6<br>GND\u2014\u2014\u2014\u2014\u2014\u2014GND<\/p>\n\n\n\n<p>DHT11:<br>VCC\u2014\u2014\u2014\u2014\u2014\u20143V<br>DATA\u2014\u2014\u2014\u2014\u2014D5<br>GND\u2014\u2014\u2014\u2014\u2014\u2014GND<\/p>\n\n\n\n<p>\u4eba\u4f53\u4f20\u611f\u5668\uff1a<br>VCC\u2014\u2014\u2014\u2014\u2014\u2014VU<br>OUT\u2014\u2014\u2014\u2014\u2014D3<br>GND\u2014\u2014\u2014\u2014\u2014\u2014GND<\/p>\n\n\n\n<p>\u5728 HomeAssistant \u96c6\u6210\u91cc\u914d\u7f6e ESPHonme<img decoding=\"async\" alt=\"9.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3002447988.png\"><img decoding=\"async\" alt=\"10.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/796820129.png\"><\/p>\n\n\n\n<p>\u6548\u679c\u56fe<img decoding=\"async\" alt=\"8.jpg\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/3335813723.jpg\"><img decoding=\"async\" alt=\"11.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/05\/2040013093.png\"><img decoding=\"async\" alt=\"huanjing.png\" src=\"https:\/\/cdn.taron.top\/usr\/uploads\/2019\/06\/2768952472.png\"><\/p>\n\n\n\n<p><a href=\"https:\/\/taron.top\/tag\/Intelligence\/\" target=\"_blank\"  rel=\"nofollow\" >\u667a\u80fd\u5bb6\u5c45<\/a><a href=\"https:\/\/taron.top\/tag\/automation\/\" target=\"_blank\"  rel=\"nofollow\" >\u81ea\u52a8\u5316<\/a><a href=\"https:\/\/taron.top\/tag\/homeassistant\/\" target=\"_blank\"  rel=\"nofollow\" >homeassistant<\/a><a href=\"https:\/\/taron.top\/tag\/%E6%99%BA%E8%83%BD\/\" target=\"_blank\"  rel=\"nofollow\" >\u667a\u80fd<\/a><\/p>\n\n\n\n<p>\u539f\u6587\uff1a<a href=\"https:\/\/taron.top\/archives\/193.html\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >https:\/\/taron.top\/archives\/193.html<\/a><\/p>\n<button class=\"simplefavorite-button\" data-postid=\"684\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u6700\u5f00\u59cb\u63a5\u5165\u8fd9\u4e9b\u4f20\u611f\u5668\u662f\u4f7f\u7528 ESPEasy \u7684\uff0c\u4f46\u540e\u6765\u53d1\u73b0\u83ab\u540d\u5176\u5999\u7684\u6b7b\u673a\uff0c\u4e00\u76f4\u6ca1\u6709\u627e\u5230\u539f\u56e0\uff0c\u5c1d\u8bd5\u66f4\u6362 MQTT \u548c\u4fee\u6539\u65e0\u7ebf\u7f51\u4fe1\u9053\u4e5f &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,11],"tags":[],"class_list":["post-684","post","type-post","status-publish","format-standard","hentry","category-9","category-11"],"_links":{"self":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=684"}],"version-history":[{"count":0,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/684\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}