使用ESPHome燒錄固件到ESP32-C3并接入HomeAssistant

文章目錄

  • 一、安裝ESPHome
  • 二、配置ESP32-C3控制燈
    • 1.主配置文件esp32c3-luat.yaml
    • 2.基礎通用配置base.yaml
    • 3.密碼文件secret.yaml
    • 4.圍欄燈four_light.yaml
    • 5.彩燈rgb_light.yaml
    • 6.左右柱燈left_right_light.yaml
  • 三、安裝固件
  • 四、HomeAssistant配置ESPHome
    • 1.直接訪問
    • 2.配置ESPHome地址
    • 3.接入成功

一、安裝ESPHome

uv init
uv add esphome
uv run esphome dashboard ./esphome

二、配置ESP32-C3控制燈

注意事項
1. id和name要用英文,不要用中文
2. wifi連接要用2.4GHz,不要用5GHz
3. i2c要注意frequency的設置

文件目錄如下
在這里插入圖片描述
ESP32-C3開發板
在這里插入圖片描述

1.主配置文件esp32c3-luat.yaml

# https://wiki.luatos.com/chips/esp32c3/board.html
esphome:name: esp32c3-luatfriendly_name: esp32c3-luat
#  name_add_mac_suffix: trueplatformio_options:board_build.flash_mode: dioboard_build.mcu: esp32c3esp32:# HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flashboard: esp32-c3-devkitm-1variant: esp32c3framework:type: esp-idf# Enable logging
logger:hardware_uart: USB_SERIAL_JTAGpackages:# MAC: 60:55:f9:73:59:68base: !include common/base.yaml
#  luat_light: !include common/light/luat_light.yaml
#  luat_switch: !include common/switch/luat_switch.yamlfour_light: !include common/light/four_light.yamlrgb_light: !include common/light/rgb_light.yamlleft_right_light: !include common/light/left_right_light.yaml
captive_portal:
#<<: !include common/mechanical/matrix_keypad.yaml#WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
#WARNING GPIO8 is a strapping PIN and should only be used for I/O with care.
#WARNING GPIO9 is a strapping PIN and should only be used for I/O with care.
#Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
#See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
#12 13 This pin cannot be used on ESP32-C3s and is already used by the SPI/PSRAM interface (function: SPIHD).

2.基礎通用配置base.yaml

# https://esphome.io/components/wifi
wifi:ssid: !secret wifi_ssidpassword: !secret wifi_passwordfast_connect: true# https://esphome.io/components/ota
ota:platform: esphomepassword: !secret ota_password# https://esphome.io/components/api
api:encryption:key: !secret api_encryption_key# 沒有連接HA,默認15min會重啟一次,設置為0s,將不再重啟reboot_timeout: 0s# https://esphome.io/components/web_server
web_server:port: 80# https://esphome.io/components/mdns
mdns:disabled: falsetext_sensor:# https://esphome.io/components/text_sensor/version- platform: versionname: "Version"# https://esphome.io/components/text_sensor/wifi_info- platform: wifi_infomac_address:name: "Mac"ip_address:name: "IP"update_interval: 1mindns_address:name: "DNS"update_interval: 1minssid:name: "SSID"update_interval: 1minbssid:name: "BSSID"update_interval: 1min

3.密碼文件secret.yaml

上面base.yaml中!secret wifi_ssid就是引用secret.yaml里面的wifi_ssid的值

# Your Wi-Fi SSID and password
wifi_ssid: "xxx"
wifi_password: "xxx"api_encryption_key: "xxx"
ota_password: "xxx"
ap_password: "xxx"

4.圍欄燈four_light.yaml

# https://esphome.io/components/light/binary
light:- platform: binaryname: four_lightoutput: four_light_outputoutput:- id: four_light_outputplatform: gpiopin: 0

5.彩燈rgb_light.yaml

# https://esphome.io/components/light/rgb
light:- platform: rgbid: colorful_lightname: colorful_lightred: output_component_redgreen: output_component_greenblue: output_component_blue
# https://esphome.io/components/light/#pulse-effect
#    effects:
#        - pulse:
#        - pulse:
#            name: "Fast Pulse"
#            transition_length: 0.5s
#            update_interval: 0.5s
#            min_brightness: 0%
#            max_brightness: 100%
#        - pulse:
#            name: "Slow Pulse"
#            # transition_length: 1s      # defaults to 1s
#            update_interval: 2s
#        - pulse:
#            name: "Asymmetrical Pulse"
#            transition_length:
#              on_length: 1s
#              off_length: 500ms
#            update_interval: 1.5s
output:# https://esphome.io/components/output/ledc
#  - platform: ledc
#    id: output_component_red
#    pin:
#      number: 4
#      inverted: true
#  - platform: ledc
#    id: output_component_blue
#    pin:
#      number: 3
#      inverted: true
#  - platform: ledc
#    id: output_component_green
#    pin:
#      number: 2
#      inverted: true- platform: ledcid: output_component_redpin:number: 1inverted: true- platform: ledcid: output_component_bluepin:number: 18inverted: true- platform: ledcid: output_component_greenpin:number: 19inverted: true#output:
#  - platform: esp8266_pwm
#    id: output_component_red
#    pin: D1
#  - platform: esp8266_pwm
#    id: output_component_green
#    pin: D2
#  - platform: esp8266_pwm
#    id: output_component_blue
#    pin: D3

6.左右柱燈left_right_light.yaml

# https://esphome.io/components/light/binary
light:- platform: binaryname: left_lightoutput: left_light_output- platform: binaryname: right_lightoutput: right_light_output
output:- id: left_light_outputplatform: gpiopin: 6- id: right_light_outputplatform: gpiopin: 7

三、安裝固件

在這里插入圖片描述

四、HomeAssistant配置ESPHome

1.直接訪問

在這里插入圖片描述

2.配置ESPHome地址

如果配置了api_encryption_key,需要填寫密鑰
在這里插入圖片描述

3.接入成功

在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/82179.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/82179.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/82179.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

什么是變量提升?

變量提升&#xff08;Hoisting&#xff09; 是 JavaScript 引擎在代碼執行前的一個特殊行為&#xff0c;它會將變量聲明和函數聲明自動移動到當前作用域的頂部。但需要注意的是&#xff0c;只有聲明會被提升&#xff0c;賦值操作不會提升。 ??核心概念?? 變量聲明提升&…

【萬字長文】深入淺出 LlamaIndex 和 LangChain:從RAG到智能體,輕松駕馭LLM應用開發

Langchain系列文章目錄 01-玩轉LangChain&#xff1a;從模型調用到Prompt模板與輸出解析的完整指南 02-玩轉 LangChain Memory 模塊&#xff1a;四種記憶類型詳解及應用場景全覆蓋 03-全面掌握 LangChain&#xff1a;從核心鏈條構建到動態任務分配的實戰指南 04-玩轉 LangChai…

2025 后端自學UNIAPP【項目實戰:旅游項目】3、API接口請求封裝,封裝后的簡單測試以及實際使用

一、創建請求封裝目錄 選中自己的項目&#xff0c;右鍵鼠標---->新建---->目錄---->名字自定義【我的是api】 二、創建兩個js封裝文件 選中封裝的目錄&#xff0c;右鍵鼠標---->新建---->js文件---->名字自定義【我的兩個js文件分別是my_http和my_api】 三…

autojs和冰狐智能輔助該怎么選擇?

最近打算做自動化腳本&#xff0c;在autojs和冰狐智能輔助中做選擇&#xff0c;不知道該怎么選。沒辦法只能花費大量時間仔細研究了autojs和冰狐智能輔助&#xff0c;綜合考慮功能需求、開發復雜度、編程經驗及項目規模等因素。以下是兩者的核心對比及選擇建議&#xff0c;僅供…

python24-匿名函數

課程&#xff1a;B站大學 記錄python學習&#xff0c;直到學會基本的爬蟲&#xff0c;使用python搭建接口自動化測試就算學會了&#xff0c;在進階webui自動化&#xff0c;app自動化 匿名函數 匿名函數實踐是檢驗真理的唯一標準 匿名函數 匿名函數是指沒有名字的函數&#xff…

Android 查看 Logcat (可純手機方式 無需電腦)

安裝 Logcat Reader Github Google Play 如果有電腦 使用其ADB方式可執行如下命令 后續無需安裝Termux # 使用 ADB 授予 android.permission.READ_LOGS 權限給 Logcat Reader adb shell "pm grant com.dp.logcatapp android.permission.READ_LOGS && am force-…

驅動開發硬核特訓 · Day 30(上篇):深入理解 I2C 總線驅動模型(以 at24 EEPROM 為例)

作者&#xff1a;嵌入式Jerry 視頻教程請關注 B 站&#xff1a;“嵌入式Jerry” 一、寫在前面 在上一階段我們已經深入理解了字符設備驅動與設備模型之間的結合方式、sysfs 的創建方式以及平臺驅動模型的實際運用。今天我們邁入總線驅動模型的世界&#xff0c;聚焦于 I2C 總線…

超詳細講解注意力機制、自注意力機制、多頭注意力機制、通道注意力機制、空間注意力機制

在如今的機器學習和深度學習領域&#xff0c;注意力機制絕對是一個熱度居高不下的話題。事實上&#xff0c;注意力機制并不是一個全新的概念&#xff0c;早在多年前就已經被提出并應用。比如在圖像分類任務中&#xff0c;SENet 和 ECA-Net 等模型中都運用了注意力機制&#xff…

Wireshark基本使用

本文會對Wireshark做簡單介紹&#xff0c;帶大家熟悉一下Wireshark的界面&#xff0c;以及如何使用過濾器。 接著會帶大家查看TCP五層模型下&#xff0c;帶大家回顧各層首部的格式。 最后會演示 Wireshark 如何抓取三次握手和四次揮手包的過程。 目錄 一.Wireshark簡介 二…

加速項目落地(Trae編輯器)

目錄 vscode安裝python支持 vscode常用插件 Trae編輯器 兩個界面合成 補充&#xff08;QT開發的繁瑣&#xff09; AI編程哪家強&#xff1f;Cursor、Trae深度對比&#xff0c;超詳細&#xff01; - 知乎 Trae兼容vscode的插件&#xff0c;我們可以先在vscode里面裝好再一…

stable diffusion的attention-map:提取和可視化跨注意力圖

項目&#xff1a; wooyeolbaek/attention-map-diffusers: &#x1f680; Cross attention map tools for huggingface/diffusers 參考&#xff1a;【可視化必備技能&#xff08;1&#xff09;】SD / Flux 文生圖模型的 Attention Map 可視化-CSDN博客

多環串級PID

文章目錄 為什么要多環程序主函數內環外環 雙環PID調參內環Kp調法Ki調法 外環Kp 以一定速度到達指定位置封裝 為什么要多環 單環只能單一控制速度或者位置&#xff0c;如果想要同時控制多個量如速度&#xff0c;位置&#xff0c;角度&#xff0c;就需要多個PID 速度環一般PI…

基于Kubernetes的Apache Pulsar云原生架構解析與集群部署指南(上)

#作者&#xff1a;閆乾苓 文章目錄 概念和架構概述主要特點消息傳遞核心概念Pulsar 的消息模型Pulsar 的消息存儲與分發Pulsar 的高級特性架構BrokerBookKeeperZooKeeper 概念和架構 概述 Pulsar 是一個多租戶、高性能的服務器到服務器消息傳遞解決方案。Pulsar 最初由雅虎開…

電子電氣架構 --- 如何有助于提安全性并減少事故

我是穿拖鞋的漢子,魔都中堅持長期主義的汽車電子工程師。 老規矩,分享一段喜歡的文字,避免自己成為高知識低文化的工程師: 鈍感力的“鈍”,不是木訥、遲鈍,而是直面困境的韌勁和耐力,是面對外界噪音的通透淡然。 生活中有兩種人,一種人格外在意別人的眼光;另一種人無論…

rest_framework學習之認證 權限

權限 DRF提供如下幾種常見權限&#xff1a; IsAuthenticated, 認證通過 IsAdminUser, 管理員權限 IsAuthenticatedOrReadOnly, 登錄用戶增刪改 非登錄用戶只能查詢 AllowAny&#xff0c;無需認證&#xff08;默認&#xff09; 在rest_framework的APIView基礎類中&#xf…

【使用switch結構輸出季節】2021-11-23

緣由用switch語句設計程序一年有12個月-編程語言-CSDN問答 void 使用switch結構輸出季節(int y) {//緣由https://ask.csdn.net/questions/7577096?spm1005.2025.3001.5141std::cout << y << "\t";switch (y){case 3: case 4: case 5:std::cout <<…

主備Smart Link + Monitor Link組網技術詳細配置

1.實驗拓撲 2.使用設備 eNSP模擬建議下行設備三臺使用S3700模擬&#xff08;全部使用S5700可能會出現流量丟失等異常問題。&#xff09; 3.實驗配置 [SW1]dis cu # sysname SW1 # vlan batch 100 110 # interface Ethernet0/0/1port link-type accessport default vlan 100 …

【hadoop】案例:Sqoop遷移倉庫數據

1 數據導出&#xff1a;Hive導入MySQL [hadoophadoop1 sqoop]$ bin/sqoop export \ > --connect jdbc:mysql://localhost/weather \ > --username root \ > --password 123456 \ > --table mean_temperature \ > --export-dir /user/hive/warehouse/mydb/mean…

Mysql-OCP PPT課程講解并翻譯

#跳過介紹&#xff0c;直接從干貨開始記錄 第一章 安裝mysql

springboot+vue實現在線網盤(云盤)系統

今天教大家如何設計一個網盤&#xff08;云盤&#xff09;系統系統 , 基于目前主流的技術&#xff1a;前端vue&#xff0c;后端springboot。 同時還帶來的項目的部署教程。 視頻演示 springbootvue實現在線網盤&#xff08;云盤&#xff09;系統 圖片演示 一. 系統概述 用過百…