标准版
ESP8266 4路分控插排 接入HASS
3.0k
0
0
2
简介
ESP8266-12F为核心制作4路插排,4个按钮独立控制。
简介:ESP8266-12F为核心制作4路插排,4个按钮独立控制。开源协议
:Public Domain
创建时间:2023-02-18 20:24:18更新时间:2023-03-17 14:09:00
描述
ESP8266-12F为核心制作4路插排,4个按钮独立控制。
用于接入HASS,ESPHome插件识别
用ESPHome刷固件后,可wifi升级代码。
4路按钮独立控制4路输出,可设置总开关,本制作暂时用不到,未写出相关代码。
4路输出带4路NPN三极管射极输出,高电位有效,输出4V电压给后级插排光耦,
电源取自插排5V电源78L05
实际过程发现输出三极管基极接地电阻不添加输出更稳定
即R7、R9、R13、R16可以省略
ESPHome代码如下:
esphome:
name: mypowerstick-01
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "***********************"
ota:
password: "***********"
wifi:
ssid: "你的wifi的ssid"
password: "你的wifi的密码"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "*********"
password: "**********"
web_server:
port: 自行设置
switch:
- platform: gpio
name: "开关1"
id: kaiguan1
pin:
number: 16
inverted: no
- platform: gpio
name: "开关2"
id: kaiguan2
pin:
number: 14
inverted: no
- platform: gpio
name: "开关3"
id: kaiguan3
pin:
number: 12
inverted: no
- platform: gpio
name: "开关4"
id: kaiguan4
pin:
number: 13
inverted: no
binary_sensor:
- platform: gpio
pin:
number: 5
mode: INPUT_PULLUP
inverted: True
name: "自复位开关1"
on_press:
- switch.toggle: kaiguan1
- platform: gpio
pin:
number: 4
mode: INPUT_PULLUP
inverted: True
name: "自复位开关2"
on_press:
- switch.toggle: kaiguan2
- platform: gpio
pin:
number: 0
mode: INPUT_PULLUP
inverted: True
name: "自复位开关3"
on_press:
- switch.toggle: kaiguan3
- platform: gpio
pin:
number: 2
mode: INPUT_PULLUP
inverted: True
name: "自复位开关4"
on_press:
- switch.toggle: kaiguan4
设计图
未生成预览图,请在编辑器重新保存一次
BOM
暂无BOM
克隆工程
添加到专辑
0
0
分享
侵权投诉
评论