Awe7 发表于 2024-2-21 18:07:04

如何设置idkaiguan为开时间,中断自动化?


binary_sensor:
- platform: gpio
    pin:
      number: 14
      mode: INPUT_PULLUP
    id: kaiguan

    name: "SWITHguodao"
#    internal: true
    on_state:   #切换relay开关
       then:
         switch.toggle: relay


- platform: gpio
    pin:
      number: 12
      mode: INPUT_PULLUP
    name: "erlouganyingqi"
    device_class: motion
    id: pir501
    filters:
#      - invert:
      - 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


现在的情况是手动切换kaiguan的状态,过10秒也会延时关灯。
需要中断或者关闭自动关灯的自动化,


感谢!!


页: [1]
查看完整版本: 如何设置idkaiguan为开时间,中断自动化?