使用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.mzph.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;系统 图片演示 一. 系统概述 用过百…