web_server:
port: 80
dallas:
- pin: GPIO2
switch:
- platform: gpio
name: "开门继电器"
id: relay_1
interlock: &interlock [relay_1, relay_2]
interlock_wait_time: 1000ms
pin:
number: GPIO4
inverted: False
restore_mode: ALWAYS_OFF
- platform: gpio
name: "guan men ji dian qi"
id: relay_2
interlock: *interlock
interlock_wait_time: 1000ms
pin:
number: GPIO15
inverted: False
restore_mode: ALWAYS_OFF
binary_sensor:
- platform: gpio
pin:
number: GPIO16
mode: INPUT_PULLDOWN
name: "shang men ci"
id: shangmenci #上门磁传感器
device_class: door
filters:
- delayed_on: 500ms
on_press:
then:
- switch.turn_off: relay_1
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: true
name: "xia men ci" #下门磁传感器
id: xiamenci
device_class: door
filters:
- delayed_on: 500ms
on_press:
then:
- switch.turn_off: relay_2
- platform: template
name: "Car presence"
device_class: presence
lambda: |-
if (id(car_presence).state < 1.5) {
return true;
} else {
return false;
}
- platform: remote_receiver #来源是射频信号,这个不能改
name: "开门信号" #开门信号
rc_switch_raw: #经过rc_switch_raw解码后的信号
code: '110100111010100010100100' #信号值,填写你收到的信号值
protocol: 1 #协议,我填了1,个人理解,看你收到的信号中protocol后面的值
internal: true
filters:
- delayed_off: 1s
on_press: #当传感器为on时,进行自动化
then:
- switch.turn_off: relay_2
- delay: 1s
- switch.turn_on: relay_1 #自动对id为jidianqi1的继电器切换状态
- platform: remote_receiver #来源是射频信号,这个不能改
name: "关门信号" #关门信号
rc_switch_raw: #经过rc_switch_raw解码后的信号
code: '110100111010100010100001' #信号值,填写你收到的信号值
protocol: 1 #协议,我填了1,个人理解,看你收到的信号中protocol后面的值
internal: true
filters:
- delayed_off: 1s
on_press: #当传感器为on时,进行自动化
then:
- switch.turn_off: relay_1
- delay: 1s
- switch.turn_on: relay_2
- platform: remote_receiver #以下操作就是当收到指定的喜好,就把2个继电器全关
name: "停止信号" #暂停信号
rc_switch_raw:
code: '110100111010100010100010'
protocol: 1
internal: true
filters:
- delayed_off: 1s
on_press:
then:
- switch.turn_off: relay_1 #自动将id为jidianqi1的继电器进行关闭
- switch.turn_off: relay_2 #自动将id为jidianqi2的继电器进行关闭
remote_receiver: #rf射频的接收,详见https://esphome.io/components/remote_receiver.html
pin: GPIO5 #rf射频接收模块的信号引脚接入nodemcu的引脚
dump: #解码的类型
- rc_switch #使用RCSwitch RF来解码
tolerance: 50% #远程信号长度在解码过程中可以偏离的百分比。默认为25%,我这设置50%
filter: 200us #过滤所有比此短的脉冲。用于消除噪声信号中的毛刺。默认为10us,我这设置为200us
idle: 4ms #信号应保持稳定(即不发生变化)以使其被视为完整的时间。默认为10ms,我这设置为4ms
buffer_size: 1kb #用于存储远程代码的内部缓冲区的大小。ESP32默认10kb ,ESP8266 默认1kb
sensor: #传感器
- platform: dht
pin: GPIO0
temperature:
name: "che ku wai wen du"
humidity:
name: "che ku wai shi du"
update_interval: 60s
- platform: wifi_signal #这个可以让你的hass显示你nodemcu联网信号强度
name: "WiFi信号强度" #名字自取,随意
update_interval: 60s #更新时间,这里为60秒
- platform: ultrasonic #超声波测距,车库有没有车
trigger_pin: GPIO13
echo_pin: GPIO12
name: "Garage Ultrasonic Sensor"
id: car_presence
update_interval: 20sec
timeout: 3.0m
- platform: dallas
address: 0xbf3cfef6480af928
name: "che ku m"
text_sensor: #这个可以让你的hass显示你nodemcu联网的信息
- platform: wifi_info
ip_address:
name: ESP IP Address #nodemcu的ip地址
ssid:
name: ESP Connected SSID #wifi设备的ssid
bssid:
name: ESP Connected BSSID #wifi设备的mac地址
- platform: template
name: "车库门当前状态" #车库门当前状态
lambda: |-
if ((id(xiamenci).state) == (id(shangmenci).state)) {
return {"正在打开或者关闭"};
} else if ((!id(shangmenci).state) && (id(xiamenci).state)) {
return {"已关闭"};
} else {
return {"已打开"};
}
update_interval: 5s
看我的,车库门上下个一个门磁。433超外差模块,继电器互锁。
|