새창 작성 수정 목록 링크 Edit G카랜다 HDD HDD HDD 게시물 주소 복사


● 화장실 재실 감지 자동화 LM2401 ESP32의 ESPHOME 적용 자동화 적용 소스

♨ 카랜더 일정 : 2024년05월27일
  • 링크

  • 첨부

  • 컨텐츠 정보

    본문

    ● 화장실 재실 감지 자동화 LM2401 ESP32의 ESPHOME 적용 자동화 적용 소스

    재실감지로 전등on / off 자동화 구성 사용중니다

    조건 사용 구성

    1) 재실시 on /off ( 전등 on /off 재실시 동작 )

    2) 20분간격으로 트리거 ( 전등이 안꺼지는 경우 발생 대응 >> 재실확인 전등 끄기 )

    3) moving distance 150 이하 트이거 ( 책상에 앉아서 있으면 꺼질때가 있음 대응 )

    ​4) WIFI 불능상태시 전원 끄기 ( 추가)

    질문) 상기 구성으로 사용중인데 여러분은 어떻게 구성을 하여 재실감지 구성 사용하는지 문의 드립니다.

    하기 센서를 어느것을 사용해야 최적인지 조언을 부탁 드립니다

    아래에 회원님 댓글 정보로

    WIFI 불능/외출조건에 전등OFF 를 추가 적용 했습니다.

    https://cafe.naver.com/koreassistant/17192

    3232235521_1716795988.1368.png


    alias: 안방 화장실 켜기 끄기,,ble1
    description: ""
    trigger:
      - platform: state
        entity_id:
          - binary_sensor.esp32_s3_ble1_still_target
        from: null
        to: null
      - type: present
        platform: device
        device_id: 9b8a2b89cbe15b6f3b942c94e50fe7fa
        entity_id: f081a80ea2c1555ede9fc362996540ba
        domain: binary_sensor
      - type: not_present
        platform: device
        device_id: 9b8a2b89cbe15b6f3b942c94e50fe7fa
        entity_id: f081a80ea2c1555ede9fc362996540ba
        domain: binary_sensor
      - platform: state
        entity_id:
          - device_tracker.nmap_tracker_3c_84_27_c7_15_64
        from: home
        to: not_home
      - platform: state
        entity_id:
          - device_tracker.nmap_tracker_3c_84_27_c7_15_64
        from: null
        to: unavailable
      - platform: time_pattern
        minutes: "10"
    condition: []
    action:
      - if:
          - condition: state
            entity_id: binary_sensor.esp32_s3_ble1_mmwave_ld2410c_out2
            state: "on"
        then:
          - type: turn_on
            device_id: 87cb966b43c853ca45357d1cb61622b2
            entity_id: c6cfae7e170f87fb498f5b707bd78b04
            domain: switch
          - service: tts.google_say
            metadata: {}
            data:
              cache: false
              entity_id: media_player.speaker_1
              message: 안방 화장실 불  켜기,,ble1
      - if:
          - condition: state
            entity_id: binary_sensor.esp32_s3_ble1_mmwave_ld2410c_out2
            state: "off"
        then:
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - service: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id:
                - switch.anbang_hwajangsil_switch_3
                - switch.anbang_hwajangsil_syaweo_bul
                - switch.anbang_hwajangsil_paen
          - service: tts.google_say
            metadata: {}
            data:
              cache: false
              entity_id: media_player.speaker_1
              message: 안방 화장실 불 OFF ,,ble1
      - if:
          - condition: or
            conditions:
              - condition: state
                state: "off"
                entity_id: device_tracker.nmap_tracker_3c_84_27_c7_15_64
              - condition: state
                entity_id: device_tracker.nmap_tracker_3c_84_27_c7_15_64
                state: unavailable
        then:
          - service: tts.google_say
            metadata: {}
            data:
              cache: false
              entity_id: media_player.speaker_1
              message: 안방 화장실 WIFI 연결이 끊어져 10분후 화장실전등 OFF 합니다
          - delay:
              hours: 0
              minutes: 10
              seconds: 1
              milliseconds: 0
          - service: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id:
                - switch.anbang_hwajangsil_switch_3
                - switch.anbang_hwajangsil_syaweo_bul
                - switch.anbang_hwajangsil_paen
    mode: single



    ESP32의 LM2401C의 재실감지 ESPHOME의 적용 소스

    3232235521_1716796713.7555.png

    적용 YAML 소스

    esphome:
      name: esp32-s3-ble1
      friendly_name: esp32_s3_ble1
     

    esp32:
      board: esp32-s3-devkitc-1
      framework:
        type: arduino

    api:
      encryption:
        key: "3S6VfgIsq5OI1NWBpgRfGoKaeHX++FMkOwyOtZyBhD0="

    ota:
      password: "33a68e0138dcc1ad088c3e3e71c14a4a"

    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password
      power_save_mode: LIGHT  
      manual_ip:
        static_ip: 192.168.0.75
        gateway: 192.168.0.1
        subnet: 255.255.255.0
        dns1: 8.8.8.8
        dns2: 8.8.4.4

      ap:
        ssid: "Esp32-S3-Ble1 Fallback Hotspot"
        password: "2nwSNwr0stM7"

    captive_portal:


    # ===========================================  #
    # ESP32  pin
    # mmwave GPIO2
    # ledc  GPIO4
    # tx_pin: GPIO1
    # rx_pin: GPIO3
    # 2410_pir GPIO15

    # ESP32-C3FH4  pin
    # mmwave GPIO2
    # ledc  GPIO5
    # tx_pin: GPIO21
    # rx_pin: GPIO20

    # ESP32-S3
    # mmwave GPIO2
    # tx_pin: GPIO17
    # rx_pin: GPIO18
    # ===========================================  #

    web_server:
      port: 80
      version: 2
      include_internal: true

    logger:
      # level: ERROR
      # baud_rate: 0
      level: DEBUG  
    uart:
      # tx_pin: GPIO43
      # rx_pin: GPIO44
      tx_pin: GPIO17
      rx_pin: GPIO18
      baud_rate: 256000
      parity: NONE
      stop_bits: 1
     

    ld2410:
      id: my_ld2410

    sensor:
      - platform: ld2410
        light:
          name: light
        moving_distance:
          name: Moving Distance
        still_distance:
          name: Still Distance
        moving_energy:
          name: Move Energy
        still_energy:
          name: Still Energy


        detection_distance:
          name: Detection Distance
        g0:
          move_energy:
            name: g0 move energy
          still_energy:
            name: g0 still energy
        g1:
          move_energy:
            name: g1 move energy
          still_energy:
            name: g1 still energy
        g2:
          move_energy:
            name: g2 move energy
          still_energy:
            name: g2 still energy
        g3:
          move_energy:
            name: g3 move energy
          still_energy:
            name: g3 still energy
        g4:
          move_energy:
            name: g4 move energy
          still_energy:
            name: g4 still energy
        g5:
          move_energy:
            name: g5 move energy
          still_energy:
            name: g5 still energy
        g6:
          move_energy:
            name: g6 move energy
          still_energy:
            name: g6 still energy
        g7:
          move_energy:
            name: g7 move energy
          still_energy:
            name: g7 still energy
        g8:
          move_energy:
            name: g8 move energy
          still_energy:
            name: g8 still energy

      - platform: uptime
        name: Uptime Sensor    
    # 8888888888888888888888888888888888888888   #
    # sensor:
      - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
        name: "WiFi Signal dB"
        id: wifi_signal_db
        update_interval: 60s
        entity_category: "diagnostic"

      - platform: copy # Reports the WiFi signal strength in %
        source_id: wifi_signal_db
        name: "WiFi Signal Percent"
        filters:
          - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
        unit_of_measurement: "Signal %"
        entity_category: "diagnostic"
        device_class: ""
      #  99999999999999999999999999999999999999999999999999999 #


    binary_sensor:
      - platform: ld2410
        has_target:
          name: Presence
        has_moving_target:
          name: Moving Target
        # 888888888888888888888888888 ERROR 대응 #
        # has_still_target:
        #   name: Still Target
        # 2024_0513_1531_32
        has_still_target:
          name: Still Target
          filters:
            - delayed_on: 15s
            - delayed_off: 15s
            # 9999999999999999999
        out_pin_presence_status:
          name: out pin presence status


    # 8888888888888888888888888
    # binary_sensor:
      # - platform: gpio
      #   pin: GPIO15
      #   name: "PIR_Sensor_out15"
      #   device_class: motion
      #   id: pir_sensor_only_GPIO15

    # binary_sensor:
      - platform: gpio
        device_class: PRESENCE
        pin:
          number: GPIO2
          mode: INPUT_PULLUP
        name: mmwave_ld2410c_out2
        filters:
          - delayed_off: 10ms
        on_press:
          then:
            - light.turn_on: RGB_right_sw
        on_release:
          then:
            - light.turn_off: RGB_right_sw

    # ===========================================  #
    # ESP32-S3
    # mmwave GPIO2
    # tx_pin: GPIO17
    # rx_pin: GPIO18
    # ===========================================  #

    # output:
    #   - platform: ledc
    #     pin: GPIO4
    #     id: led_output
    #     inverted: true

    # light:
    #   - platform: binary
    #     name: "mmwave_LED_light"
    #     output: led_output
    #     id: pir_led_output_sw
        # 2024_0510_2221_53
    light:
      - platform: esp32_rmt_led_strip
        rgb_order: RBG
        pin: GPIO48
        num_leds: 3
        rmt_channel: 2
        chipset: ws2812
        name: "mmwave_My_Light"
        id: RGB_right_sw

    switch:
      - platform: restart
        name: "Restart Node"#
        id: restart_id
    # 9999999999999999999999999999999999

    # switch:
      - platform: ld2410
        engineering_mode:
          name: "engineering mode"
        bluetooth:
          name: "control bluetooth"



    number:
      - platform: ld2410
        timeout:
          name: timeout

        light_threshold:
          name: light threshold
        max_move_distance_gate:
          name: max move distance gate
        max_still_distance_gate:
          name: max still distance gate
        g0:
          move_threshold:
            name: g0 move threshold
          still_threshold:
            name: g0 still threshold
        g1:
          move_threshold:
            name: g1 move threshold
          still_threshold:
            name: g1 still threshold
        g2:
          move_threshold:
            name: g2 move threshold
          still_threshold:
            name: g2 still threshold
        g3:
          move_threshold:
            name: g3 move threshold
          still_threshold:
            name: g3 still threshold
        g4:
          move_threshold:
            name: g4 move threshold
          still_threshold:
            name: g4 still threshold
        g5:
          move_threshold:
            name: g5 move threshold
          still_threshold:
            name: g5 still threshold
        g6:
          move_threshold:
            name: g6 move threshold
          still_threshold:
            name: g6 still threshold
        g7:
          move_threshold:
            name: g7 move threshold
          still_threshold:
            name: g7 still threshold
        g8:
          move_threshold:
            name: g8 move threshold
          still_threshold:
            name: g8 still threshold

    button:
      - platform: ld2410
        factory_reset:
          name: "factory reset"
        restart:
          name: "restart"
        query_params:
          name: query params

    text_sensor:
      - platform: ld2410
        version:
          name: "firmware version"
        mac_address:
          name: "mac address"
    # 8888888888888888888888888888888888888888      #
    # text_sensor:
      - platform: wifi_info
        ip_address:
          name: Address
          id: ip
        ssid:
          name: SSID
        mac_address:
          name: Mac
    # 999999999999999999999999999999999999999999
    select:
      - platform: ld2410
        distance_resolution:
          name: "distance resolution"
        baud_rate:
          name: "baud rate"
        light_function:
          name: light function
        out_pin_level:
          name: out pin level
    # 2024_0508_2051_54

    ☞ https://11q.kr 에 등록된 자료 입니다. ♠ 정보찾아 공유 드리며 출처는 링크 참조 바랍니다♠1.png

    [ 추가 정보 ... 더보기) ]
    뷰PDF 1,2



    office view

    관련자료

    댓글목록

    등록된 댓글이 없습니다.


    새창 작성 수정 목록 링크 Edit G카랜다 HDD HDD HDD 게시물 주소 복사


    ♥간단_메모글♥


    최근글


    새댓글



    PHP 안에 HTML ☞ 홈페이지 화면갱신 시간은 ♨
    ▶ 2024-11-22 00:53:55

    오늘의 홈 현황


    • 현재 접속자♨ 378 명
    • 오늘 가입자※ 0 명
    • 어제 가입자※ 3 명
    • 주간 가입자※ 9 명
    • 오늘 방문자 1,218 명
    • 어제 방문자 3,272 명
    • 최대 방문자 13,042 명
    • 전체 방문자 4,800,374 명
    • 전체 게시물※ 8,855 개
    • 전체 댓글수※ 25,229 개
    • 전체 회원수 11,324 명

    QR코드


    ☞ QR코드 스캔은 kakao앱 자체 QR코드

    알림 0








    최신글↑