求个esphome配置文件
本帖最后由 Awe7 于 2024-3-1 18:19 编辑esphome配置,创建一个自动化 用pir501控制一个继电器有人时打开继电器,感应到无人时延迟10秒关闭继电器。再用一个翘板开关控制状态,来控制感应到无人时延迟10秒关闭继电器这个动作是否执行。
可以问问AI
DDDear 发表于 2024-2-24 08:13
可以问问AI
ai一直生成不了合适的0.0
第一个要求很简单
第二个要求我看不懂 要不你重新描述一下 kjjuhfv 发表于 2024-2-24 13:59
第一个要求很简单
第二个要求我看不懂 要不你重新描述一下
感应到无人时延迟10秒关闭继电器<<==用一个翘板开关控制状态这个动作是否执行 Pir501在感应10秒没人的时候就自动关闭继电器了
你这翘班开关没用啊
都关闭继电器了你还要去按它吗? 本帖最后由 Awe7 于 2024-2-24 14:45 编辑
kjjuhfv 发表于 2024-2-24 13:59
第一个要求很简单
第二个要求我看不懂 要不你重新描述一下
binary_sensor:
- platform: gpio
pin:
number: 14
mode: INPUT_PULLUP
name: "SWITCHguodao"
id: kaiguan
on_press:
then:
- switch.toggle: relay
- platform: gpio
pin:
number: 12
mode: INPUT_PULLUP
name: "erlouganyingqi"
device_class: motion
id: pir501
filters:
- delayed_on: 800ms
- delayed_off: 10s on_press:
then:
- if:
condition:
and:
- binary_sensor.is_on: pir501
then:
- logger.log: "Detected somebody activity"
- switch.turn_on: relay
else:
- logger.log: "There is no one around"
- switch.turn_off: relay
on_release:
then:
- switch.turn_off: relay
switch:
- platform: gpio
name: "SWITCHguodao"
pin: GPIO4
id: relay
目前配置是这样的,但是因为pir501的感应距离不够。导致人在灯下10s内未触发pir会自动关闭继电器。
所以需要用翘板开关来控制(自动关闭pir的自动化).人手动打开翘板开关灯一直亮 ,关闭翘板开关恢复10s内未检测到自动关.
george65 发表于 2024-2-24 14:23
感应到无人时延迟10秒关闭继电器
对的就是这个意思.试过添加到
on_state:
- if:
condition:
and:
- binary_sensor.is_on: pir501
- binary_sensor.is_on: kaiguan
后面发现这是触发开继电器的条件,并不能控制关 :dizzy: 大概这样?
binary_sensor:
- platform: gpio
pin:
number: 14
mode: INPUT_PULLUP
name: "SWITCHguodao"
id: kaiguan
on_state:
- if:
condition:
and:
- binary_sensor.is_on: pir501
- binary_sensor.is_on: kaiguan
then:
- binary_sensor.template.publish:
id: trigger
state: on
else:
- binary_sensor.template.publish:
id: trigger
state: off
- platform: gpio
pin:
number: 12
mode: INPUT_PULLUP
name: "erlouganyingqi"
device_class: motion
id: pir501
filters:
- delayed_on: 800ms
- delayed_off: 5s
on_press:
then:
- if:
condition:
and:
- binary_sensor.is_on: pir501
then:
- logger.log: "Detected somebody activity"
- binary_sensor.template.publish:
id: trigger
state: on
else:
- logger.log: "There is no one around"
- binary_sensor.template.publish:
id: trigger
state: on
on_release:
then:
- switch.turn_off: relay
- platform: template
name: "Infrared sensor"
id: trigger
device_class: motion
on_press:
- switch.turn_off: relay
- delayed_off: 10s
on_release:
- switch.turn_off: relay
switch:
- platform: gpio
name: "SWITCHguodao"
pin: GPIO4
id: relay
kjjuhfv 发表于 2024-2-24 15:27
大概这样?
INFO ESPHome 2024.2.0
INFO Reading configuration /config/esphome/32.yaml...
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block collection
in "/config/esphome/32.yaml", line 61, column 7
expected <block end>, but found '?'
in "/config/esphome/32.yaml", line 63, column 7
报错0.0
页:
[1]
2