코딩게시판

esp32-c6 wifi 와 zigbee 설정 인체 감지 ld2412 esphome 설정

작성자 정보

  • 최고관리자 작성
  • 192.♡.0.1 아이피
  • 작성일

컨텐츠 정보


  • 링크

  • 첨부


  • 본문

    esp32-c6 wifi 와 zigbee 설정 인체 감지 ld2412 esphome 설정

     

    최적 zigbee2mqtt 설정은

    https://cafe.naver.com/homestation/527

    s:\esphome\esp32-c6-ip70_z2m.yaml

    참조 드립니다.

     

    aab70-68d80a8a7aa7a-5fba0ac265074cebbbfb0f8cb9988984b7ec61fd.png

    https://cafe.naver.com/homestation/526

    C6 제품은 esphome으로 wifi 인스톨 가능 하고 zigbee 와 같이 구성 사례 입니다

    동시 동작 합니다.

     

    구성파일를 저장 합니다

    s:\esphome\esp32-c6-ip70.yaml

    aab70-68d808ed7a784-0e1ae53909f4bce89cc5dbc660ee704703f5d0b2.png

    aab70-68d8088b37794-87f442bf29b3e71202e56d3c7aa6c89c56e34c3a.png

    aab70-68d808b802b6d-325425afe1e29613ef4d5cd4cba3c6b5a3f12339.png

    aab70-68d808d885e9a-09649c1efb85a1857e1e73fedbe6a737f83c10e6.png

    ### #################### zigbee 전환 적용 ##################################################################
    ## 단독으로 구성해야 사용가능  다은 switch light  binary_sensor: 로  구성
    zigbee:
      id: "zb"                          # 위에서 참조한 zigbee 인스턴스 ID
      endpoints:
        - num: 1                        # Endpoint 1번 정의
          device_type: SIMPLE_SENSOR     # Zigbee 디바이스 타입을 단순 센서로 설정
          clusters:
            - id: ON_OFF                 # Cluster ID = 0x0006 (On/Off 클러스터)
              role: SERVER               # 서버 역할 (값을 보유하고 외부 요청에 응답)
              attributes:
                - attribute_id: 0        # Attribute ID 0 = OnOff 속성
                  type: BOOL             # 값 타입: 불리언 (true/false)
                  id: attr_button_contact # ESPHome 내부에서 참조 가능한 속성 ID
        - num: 2
          device_type: COLOR_DIMMABLE_LIGHT
          clusters:
            - id: ON_OFF
              attributes:
                - attribute_id: 0
                  type: bool
                  on_value:
                    then:
                      - light.control:
                          id: light_1
                          state: !lambda "return (bool)x;"
            - id: LEVEL_CONTROL
              attributes:
                - attribute_id: 0
                  type: U8
                  value: 255
                  on_value:
                    then:
                      - light.control:
                          id: light_1
                          brightness: !lambda "return ((float)x)/255;"
            - id: COLOR_CONTROL
              attributes:
                - attribute_id: 3
                  type: U16
                  on_value:
                    then:
                      - lambda: id(color_x) = (float)x/65536;
                      - light.control:
                          id: light_1
                          red: !lambda "return zigbee::get_r_from_xy(id(color_x), id(color_y));"
                          green: !lambda "return zigbee::get_g_from_xy(id(color_x), id(color_y));"
                          blue: !lambda "return zigbee::get_b_from_xy(id(color_x), id(color_y));"
                - attribute_id: 4
                  type: U16
                  on_value:
                    then:
                      - lambda: id(color_y) = (float)x/65536;
                      - light.control:
                          id: light_1
                          red: !lambda "return zigbee::get_r_from_xy(id(color_x), id(color_y));"
                          green: !lambda "return zigbee::get_g_from_xy(id(color_x), id(color_y));"
                          blue: !lambda "return zigbee::get_b_from_xy(id(color_x), id(color_y));"
      on_join:
        then:
          - logger.log: "Joined network"
     
    # ##################### ld2410-out sensor 구성########################
    binary_sensor:
     
      # ------------------------
      - platform: gpio
        device_class: presence
        pin:
          number: GPIO3
          mode: INPUT_PULLUP
        
        name: "MMWave LD2410C out8"
        id: mmwave_ld2410c_out_id8 
        icon: "mdi:motion-sensor"
        filters:
          - delayed_off: 300ms   # 노이즈 필터링  still_target
     
        on_press:                       # 버튼이 눌리거나 센서가 ON 상태일 때 실행
          then:
            - switch.turn_on: light_blue_switch
            - lambda: |-
                bool val = true;          // ON 상태를 Zigbee 속성 값으로 설정
                esp_zb_zcl_set_attribute_val(
                    1,                    // Endpoint 번호 (1번 엔드포인트)
                    0x0006,               // Cluster ID: On/Off 클러스터
                    ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, // 서버 역할
                    0,                    // Attribute ID 0 (OnOff 속성)
                    &val,                 // true 값 전달
                    false);               // 그 외 옵션 (리포트 즉시 전송 안 함)
            - zigbee.report: zb           # zigbee 모듈로 현재 속성 값(report)을 전송
    
     
        on_release:                     # 버튼이 떼어지거나 센서가 OFF 상태일 때 실행
          then:
            - switch.turn_off: light_blue_switch
            - lambda: |-
                bool val = false;         // OFF 상태를 Zigbee 속성 값으로 설정
                esp_zb_zcl_set_attribute_val(
                    1,  
                    0x0006,               // Cluster ID: On/Off
                    ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
                    0,                    // Attribute ID 0
                    &val,                 // false 값 전달
                    false);
            - zigbee.report: zb           # Zigbee 엔드포인트로 값 보고
    
     
    # ########### zigbee로 적용 ################################################################   
    ### binary_sensor:
      - platform: gpio
        pin:
          number: 9
          mode:
            input: true
            pullup: true
          inverted: true
        id: button_1
        on_press:
          then:
            - zigbee.report: zb
        on_click:
          min_length: 5s
          max_length: 20s
          then:
            - zigbee.reset: zb
    # ########### zigbee로 적용 ################################################################

    첨부 파일을 스킨보드에 구성 PDF보기( W:\g5\skin\board\BS4-Basic-Webzine_11q_pdf_php82\view.skin.php + view_pdf.php구성)



    관련자료

    댓글 0
    등록된 댓글이 없습니다.

    최근글


    새댓글