본문으로 바로가기

[ESP-IDF][Matter] [1] light_switch 프로젝트

category ESP32 2024. 1. 2. 17:22

: Data model 을 사용해 matter light  장치의 LED on/off  테스트 예제 입니다.

 

목차

     

    ▶github espressif matter light_switch 링크 

    https://github.com/espressif/esp-matter/tree/main/examples/light_switch

      : 실제로 위코드를 클론해서 사용하지는 않았습니다.

    ▶ 준비사항

     → ESP32 light 프로젝트  기기

     → ESP32 light-switch 프로젝트 기기

     → ESP-IDF 소스 클론

     git clone -b release/v5.2 --recursive https://github.com/espressif/esp-idf.git

     → ESP-MATTER 소스 클론 

    git clone --recursive https://github.com/espressif/esp-idf.git

     

    light_switch 프로젝트 Create/Build/Deploy

      →  프로젝트 복사

         :  esp-matter/examples/light_switch 예제를 프로젝트 루트 밑으로 복사해 줍니다.

     

     

    →  set-target

       : 빌드시 사용할 칩 타겟 설정 , 기존에 존재하는 sdkconfig 제거하고 새로 생성합니다.

      > idf.py set-target  <chip target>

    $ idf.py set-target esp32c6
    Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
    Executing action: fullclean
    Build directory '/home/xxx/Project/esp32-matter/light_switch/build' not found. Nothing to clean.
    Executing action: set-target
    Set Target to: esp32c6, new sdkconfig will be created.
    Running cmake in directory /home/xxx/Project/esp32-matter/light_switch/build
    Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/home/xxx/.espressif/python_env/idf5.2_py3.10_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=esp32c6 -DCCACHE_ENABLE=0 /home/xxx/Project/esp32-matter/light_switch"...
    -- Found Git: /usr/bin/git (found version "2.34.1") 
    -- Component directory /home/xxx/esp/esp-matter/examples/common/blemesh_platform does not contain a CMakeLists.txt file. No component will be added
    -- Component directory /home/xxx/esp/esp-matter/examples/common/external_platform does not contain a CMakeLists.txt file. No component will be added
    -- Component directory /home/xxx/esp/esp-matter/examples/common/relinker does not contain a CMakeLists.txt file. No component will be added
    -- The C compiler identification is GNU 13.2.0
    -- The CXX compiler identification is GNU 13.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-g++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Building ESP-IDF components for target esp32c6
    Dependencies lock doesn't exist, solving dependencies.
    NOTICE: Skipping optional dependency: espressif/cmake_utilities
    ....................Updating lock file at /home/xxx/Project/esp32-matter/light_switch/dependencies.lock
    Processing 16 dependencies:
    [1/16] espressif/button (2.5.0)
    [2/16] espressif/cbor (0.6.0~1)
    [3/16] espressif/esp-serial-flasher (0.0.11)
    [4/16] espressif/esp_diag_data_store (1.0.1)
    [5/16] espressif/esp_diagnostics (1.0.2)
    [6/16] espressif/esp_encrypted_img (2.1.0)
    [7/16] espressif/esp_insights (1.0.1)
    [8/16] espressif/esp_rcp_update (1.0.1)
    [9/16] espressif/esp_secure_cert_mgr (2.4.1)
    [10/16] espressif/jsmn (1.1.0)
    [11/16] espressif/json_generator (1.1.2)
    [12/16] espressif/json_parser (1.0.3)
    [13/16] espressif/led_strip (1.0.0)
    [14/16] espressif/mdns (1.2.2)
    [15/16] espressif/rmaker_common (1.4.4)
    [16/16] idf (5.2.0)
    -- Found Python3: /home/xxx/.espressif/python_env/idf5.2_py3.10_env/bin/python3.10 (found version "3.10.12") found components: Interpreter 
    NOTICE: Skipping optional dependency: espressif/cmake_utilities
    -- Project sdkconfig file /home/xxx/Project/esp32-matter/light_switch/sdkconfig
    warning: default on the choice symbol SEC_CERT_DAC_PROVIDER (defined at /home/xxx/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/Kconfig:853, /home/xxx/esp/esp-matter/components/esp_matter/Kconfig:41) will have no effect, as defaults do not affect choice symbols
    warning: the choice symbol SEC_CERT_DAC_PROVIDER (defined at /home/xxx/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/Kconfig:853, /home/xxx/esp/esp-matter/components/esp_matter/Kconfig:41) is defined with a prompt outside the choice
    Loading defaults file /home/xxx/Project/esp32-matter/light_switch/sdkconfig.defaults...
    Loading defaults file /home/xxx/Project/esp32-matter/light_switch/sdkconfig.defaults.esp32c6...
    /home/xxx/Project/esp32-matter/light_switch/sdkconfig.defaults.esp32c6:10 CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of time_t
    -- Check size of time_t - done
    -- Found Python3: /home/xxx/.espressif/python_env/idf5.2_py3.10_env/bin/python (found version "3.10.12") found components: Interpreter 
    -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
    -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
    -- App "light_switch" version: 1.0
    -- Adding linker script /home/xxx/Project/esp32-matter/light_switch/build/esp-idf/esp_system/ld/memory.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_system/ld/esp32c6/sections.ld.in
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.api.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.rvfp.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.version.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.phy.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.net80211.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.wdt.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-normal.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.heap.ld
    -- Adding linker script /home/xxx/esp/esp-idf/components/soc/esp32c6/ld/esp32c6.peripherals.ld
    ESP Insights Project commit: bbe4f76
    -- Components: app_bridge app_reset app_trace app_update bootloader bootloader_support bt chip cmock console cxx device driver efuse esp-tls esp_adc esp_app_format esp_bootloader_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_matter esp_matter_bridge esp_matter_console esp_matter_controller esp_matter_rainmaker esp_matter_thread_br esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump espressif__button espressif__cbor espressif__esp-serial-flasher espressif__esp_diag_data_store espressif__esp_diagnostics espressif__esp_encrypted_img espressif__esp_insights espressif__esp_rcp_update espressif__esp_secure_cert_mgr espressif__jsmn espressif__json_generator espressif__json_parser espressif__led_strip espressif__mdns espressif__rmaker_common esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 iot_button json led_driver log lwip main mbedtls mqtt newlib nvs_flash nvs_sec_provider openthread partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
    -- Component paths: /home/xxx/esp/esp-matter/examples/common/app_bridge /home/xxx/esp/esp-matter/examples/common/app_reset /home/xxx/esp/esp-idf/components/app_trace /home/xxx/esp/esp-idf/components/app_update /home/xxx/esp/esp-idf/components/bootloader /home/xxx/esp/esp-idf/components/bootloader_support /home/xxx/esp/esp-idf/components/bt /home/xxx/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip /home/xxx/esp/esp-idf/components/cmock /home/xxx/esp/esp-idf/components/console /home/xxx/esp/esp-idf/components/cxx /home/xxx/esp/esp-matter/device_hal/device /home/xxx/esp/esp-idf/components/driver /home/xxx/esp/esp-idf/components/efuse /home/xxx/esp/esp-idf/components/esp-tls /home/xxx/esp/esp-idf/components/esp_adc /home/xxx/esp/esp-idf/components/esp_app_format /home/xxx/esp/esp-idf/components/esp_bootloader_format /home/xxx/esp/esp-idf/components/esp_coex /home/xxx/esp/esp-idf/components/esp_common /home/xxx/esp/esp-idf/components/esp_eth /home/xxx/esp/esp-idf/components/esp_event /home/xxx/esp/esp-idf/components/esp_gdbstub /home/xxx/esp/esp-idf/components/esp_hid /home/xxx/esp/esp-idf/components/esp_http_client /home/xxx/esp/esp-idf/components/esp_http_server /home/xxx/esp/esp-idf/components/esp_https_ota /home/xxx/esp/esp-idf/components/esp_https_server /home/xxx/esp/esp-idf/components/esp_hw_support /home/xxx/esp/esp-idf/components/esp_lcd /home/xxx/esp/esp-idf/components/esp_local_ctrl /home/xxx/esp/esp-matter/components/esp_matter /home/xxx/esp/esp-matter/components/esp_matter_bridge /home/xxx/esp/esp-matter/components/esp_matter_console /home/xxx/esp/esp-matter/components/esp_matter_controller /home/xxx/esp/esp-matter/components/esp_matter_rainmaker /home/xxx/esp/esp-matter/components/esp_matter_thread_br /home/xxx/esp/esp-idf/components/esp_mm /home/xxx/esp/esp-idf/components/esp_netif /home/xxx/esp/esp-idf/components/esp_netif_stack /home/xxx/esp/esp-idf/components/esp_partition /home/xxx/esp/esp-idf/components/esp_phy /home/xxx/esp/esp-idf/components/esp_pm /home/xxx/esp/esp-idf/components/esp_psram /home/xxx/esp/esp-idf/components/esp_ringbuf /home/xxx/esp/esp-idf/components/esp_rom /home/xxx/esp/esp-idf/components/esp_system /home/xxx/esp/esp-idf/components/esp_timer /home/xxx/esp/esp-idf/components/esp_wifi /home/xxx/esp/esp-idf/components/espcoredump /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__button /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__cbor /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp-serial-flasher /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_diag_data_store /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_diagnostics /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_encrypted_img /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_insights /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_rcp_update /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__esp_secure_cert_mgr /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__jsmn /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__json_generator /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__json_parser /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__led_strip /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__mdns /home/xxx/Project/esp32-matter/light_switch/managed_components/espressif__rmaker_common /home/xxx/esp/esp-idf/components/esptool_py /home/xxx/esp/esp-idf/components/fatfs /home/xxx/esp/esp-idf/components/freertos /home/xxx/esp/esp-idf/components/hal /home/xxx/esp/esp-idf/components/heap /home/xxx/esp/esp-idf/components/http_parser /home/xxx/esp/esp-idf/components/idf_test /home/xxx/esp/esp-idf/components/ieee802154 /home/xxx/esp/esp-matter/device_hal/button_driver/iot_button /home/xxx/esp/esp-idf/components/json /home/xxx/esp/esp-matter/device_hal/led_driver /home/xxx/esp/esp-idf/components/log /home/xxx/esp/esp-idf/components/lwip /home/xxx/Project/esp32-matter/light_switch/main /home/xxx/esp/esp-idf/components/mbedtls /home/xxx/esp/esp-idf/components/mqtt /home/xxx/esp/esp-idf/components/newlib /home/xxx/esp/esp-idf/components/nvs_flash /home/xxx/esp/esp-idf/components/nvs_sec_provider /home/xxx/esp/esp-idf/components/openthread /home/xxx/esp/esp-idf/components/partition_table /home/xxx/esp/esp-idf/components/protobuf-c /home/xxx/esp/esp-idf/components/protocomm /home/xxx/esp/esp-idf/components/pthread /home/xxx/esp/esp-idf/components/riscv /home/xxx/esp/esp-idf/components/sdmmc /home/xxx/esp/esp-idf/components/soc /home/xxx/esp/esp-idf/components/spi_flash /home/xxx/esp/esp-idf/components/spiffs /home/xxx/esp/esp-idf/components/tcp_transport /home/xxx/esp/esp-idf/components/ulp /home/xxx/esp/esp-idf/components/unity /home/xxx/esp/esp-idf/components/usb /home/xxx/esp/esp-idf/components/vfs /home/xxx/esp/esp-idf/components/wear_levelling /home/xxx/esp/esp-idf/components/wifi_provisioning /home/xxx/esp/esp-idf/components/wpa_supplicant
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/xxx/Project/esp32-matter/light_switch/build

     

    →  build

       : 프로젝트 빌드 

      > idf.py build

       build 로그는 생략 합니다.

     

    →  flash

      :  light_switch 프로젝트를 esp32 장치로 이미지 배포

    $ idf.py flash
    Executing action: flash
    Running ninja in directory /home/xxx/Project/esp32-matter/light_switch/build
    Executing "ninja flash"...
    [1/10] Performing build step for 'chip_gn'
    ninja: no work to do.
    [1/1] cd /home/xxx/Project/esp32-ma...witch/build/bootloader/bootloader.bin
    Bootloader binary size 0x5430 bytes. 0x6bd0 bytes (56%) free.
    [3/4] cd /home/xxx/Project/esp32-ma...r/light_switch/build/light_switch.bin
    light_switch.bin binary size 0x182e10 bytes. 
    Smallest app partition is 0x1e0000 bytes. 0x5d1f0 bytes (19%) free.
    [3/4] cd /home/xxx/esp/esp-idf/comp...ents/esptool_py/run_serial_tool.cmake
    esptool.py --chip esp32c6 -p /dev/ttyACM0 -b 460800 --before=default_reset 
       --after=hard_reset write_flash --flash_mode dio --flash_freq 80m 
       --flash_size 4MB 0x0 bootloader/bootloader.bin 
                        0x20000 light_switch.bin 
                        0xc000 partition_table/partition-table.bin 
                        0x1d000 ota_data_initial.bin
    esptool.py v4.7.0
    Serial port /dev/ttyACM0
    Connecting...
    Chip is ESP32-C6 (QFN40) (revision v0.0)
    Features: WiFi 6, BT 5, IEEE802.15.4
    Crystal is 40MHz
    MAC: 40:4c:ca:ff:fe:43:9c:90
    BASE MAC: 40:4c:ca:43:9c:90
    MAC_EXT: ff:fe
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 460800
    Changed.
    Configuring flash size...
    Flash will be erased from 0x00000000 to 0x00005fff...
    Flash will be erased from 0x00020000 to 0x001a2fff...
    Flash will be erased from 0x0000c000 to 0x0000cfff...
    Flash will be erased from 0x0001d000 to 0x0001efff...
    Compressed 21552 bytes to 12994...
    Writing at 0x00000000... (100 %)
    Wrote 21552 bytes (12994 compressed) at 0x00000000 in 0.2 seconds (effective 1040.7 kbit/s)...
    Hash of data verified.
    Compressed 1584656 bytes to 965550...
    Writing at 0x0019b8b0... (100 %)
    Wrote 1584656 bytes (965550 compressed) at 0x00020000 in 5.3 seconds (effective 2377.2 kbit/s)...
    Hash of data verified.
    Compressed 3072 bytes to 181...
    Writing at 0x0000c000... (100 %)
    Wrote 3072 bytes (181 compressed) at 0x0000c000 in 0.0 seconds (effective 761.0 kbit/s)...
    Hash of data verified.
    Compressed 8192 bytes to 31...
    Writing at 0x0001d000... (100 %)
    Wrote 8192 bytes (31 compressed) at 0x0001d000 in 0.1 seconds (effective 1036.8 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    Done

     

    ▶ Post Commissioning Setup

       : chip-tool을 사용해 node-id 및 wifi 연결설정 ,discriminator 및 pincode 가

      두장비(light, light_swith)가 동일하니 한개 설정시 다른장비는 꺼주세요.

       > 이과정이 핵심입니다. 이부분을 chip-tool을 사용하지 않고 해결 하려면 controller  예제 참고하세요.

    → light 장치를 light-switch 장치에 바인딩하기

      ↓ light-switch 장치에  Node ID (0x7283 == 29315 ) 넣고 commissioning 하기

    ./chip-tool pairing ble-wifi 0x7283 WIFI_SSID xxxx1234 20202021 3840

     

     ↓ light 장치에 Node ID (0x5164 == 20836) 넣고 commissioning 하기   

    ./chip-tool pairing ble-wifi 0x5164 WIFI_SSID xxxx1234 20202021 3840

     

     

     ↓  light-switch 장비 연결을위한 light 장치의 endpoint 0  ACL 업데이트 하기

        // Update the light's acl attribute to add the entry of remote device (switch) in the access control list

         :  subjects 의 29315(0x7283) 추가 하기

    $ ./chip-tool accesscontrol write acl '[{"privilege": 5, "authMode": 2, "subjects": [ 112233, 29315 ], "targets": null}]' 0x5164 0x0
    ~~ 중략 ~~
    [1704366664.903073][14099:14101] CHIP:TOO: Sending command to node 0x5164
    [1704366664.903190][14099:14101] CHIP:CSM: FindOrEstablishSession: PeerId = [1:0000000000005164]
    [1704366664.903197][14099:14101] CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found
    [1704366664.903204][14099:14101] CHIP:DIS: OperationalSessionSetup[1:0000000000005164]: State change 1 --> 2
    [1704366664.912268][14099:14101] CHIP:DIS: UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540: new best score: 7
    [1704366664.912276][14099:14101] CHIP:DIS: Lookup clearing interface for non LL address
    [1704366664.912288][14099:14101] CHIP:DIS: UDP:192.168.19.34%enp3s0:5540: new best score: 2
    [1704366664.912292][14099:14101] CHIP:DIS: Checking node lookup status after 10 ms
    [1704366664.912296][14099:14101] CHIP:DIS: Keeping DNSSD lookup active
    [1704366664.912556][14099:14101] CHIP:DIS: UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540: new best score: 7
    [1704366664.912564][14099:14101] CHIP:DIS: Lookup clearing interface for non LL address
    [1704366664.912575][14099:14101] CHIP:DIS: UDP:192.168.19.34%enp3s0:5540: new best score: 2
    [1704366664.912579][14099:14101] CHIP:DIS: Checking node lookup status after 10 ms
    [1704366664.912583][14099:14101] CHIP:DIS: Keeping DNSSD lookup active
    [1704366665.102875][14099:14101] CHIP:DIS: Checking node lookup status after 200 ms
    [1704366665.102971][14099:14101] CHIP:DIS: OperationalSessionSetup[1:0000000000005164]: Updating device address to UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540 while in state 2
    [1704366665.102998][14099:14101] CHIP:DIS: OperationalSessionSetup[1:0000000000005164]: State change 2 --> 3
    [1704366665.103113][14099:14101] CHIP:IN: SecureSession[0x7f710c00ed30]: Allocated Type:2 LSID:53616
    [1704366665.103154][14099:14101] CHIP:SC: Initiating session on local FabricIndex 1 from 0x000000000001B669 -> 0x0000000000005164
    [1704366665.104056][14099:14101] CHIP:EM: <<< [E:32462i S:0 M:96523752] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540] --- Type 0000:30 (SecureChannel:CASE_Sigma1)
    [1704366665.104178][14099:14101] CHIP:SC: Sent Sigma1 msg
    [1704366665.104206][14099:14101] CHIP:DIS: OperationalSessionSetup[1:0000000000005164]: State change 3 --> 4
    [1704366665.187222][14099:14101] CHIP:EM: >>> [E:32462i S:0 M:81579763 (Ack:96523752)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366665.187265][14099:14101] CHIP:EM: Found matching exchange: 32462i, Delegate: 0x7f710c00ea88
    [1704366665.187297][14099:14101] CHIP:EM: Rxd Ack; Removing MessageCounter:96523752 from Retrans Table on exchange 32462i
    [1704366665.257902][14099:14101] CHIP:EM: >>> [E:32462i S:0 M:81579764 (Ack:96523752)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:31 (SecureChannel:CASE_Sigma2)
    [1704366665.257945][14099:14101] CHIP:EM: Found matching exchange: 32462i, Delegate: 0x7f710c00ea88
    [1704366665.257968][14099:14101] CHIP:EM: CHIP MessageCounter:96523752 not in RetransTable on exchange 32462i
    [1704366665.258010][14099:14101] CHIP:SC: Received Sigma2 msg
    [1704366665.258042][14099:14101] CHIP:SC: Peer assigned session session ID 33820
    [1704366665.261879][14099:14101] CHIP:SC: Found MRP parameters in the message
    [1704366665.261930][14099:14101] CHIP:SC: Sending Sigma3
    [1704366665.262549][14099:14101] CHIP:EM: <<< [E:32462i S:0 M:96523753 (Ack:81579764)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540] --- Type 0000:32 (SecureChannel:CASE_Sigma3)
    [1704366665.262670][14099:14101] CHIP:SC: Sent Sigma3 msg
    [1704366665.298385][14099:14101] CHIP:EM: >>> [E:32462i S:0 M:81579765 (Ack:96523753)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366665.298428][14099:14101] CHIP:EM: Found matching exchange: 32462i, Delegate: 0x7f710c00ea88
    [1704366665.298460][14099:14101] CHIP:EM: Rxd Ack; Removing MessageCounter:96523753 from Retrans Table on exchange 32462i
    [1704366665.423228][14099:14101] CHIP:EM: >>> [E:32462i S:0 M:81579766 (Ack:96523753)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport)
    [1704366665.423271][14099:14101] CHIP:EM: Found matching exchange: 32462i, Delegate: 0x7f710c00ea88
    [1704366665.423295][14099:14101] CHIP:EM: CHIP MessageCounter:96523753 not in RetransTable on exchange 32462i
    [1704366665.423335][14099:14101] CHIP:SC: Success status report received. Session was established
    [1704366665.426989][14099:14101] CHIP:SC: SecureSession[0x7f710c00ed30, LSID:53616]: State change 'kEstablishing' --> 'kActive'
    [1704366665.427025][14099:14101] CHIP:IN: SecureSession[0x7f710c00ed30]: Activated - Type:2 LSID:53616
    [1704366665.427045][14099:14101] CHIP:IN: New secure session activated for device <0000000000005164, 1>, LSID:53616 PSID:33820!
    [1704366665.427070][14099:14101] CHIP:DIS: OperationalSessionSetup[1:0000000000005164]: State change 4 --> 5
    [1704366665.427165][14099:14101] CHIP:TOO:      cluster 0x0000_001F, attribute: 0x0000_0000, endpoint 0
    [1704366665.427242][14099:14101] CHIP:DMG: WriteClient moving to [AddAttribu]
    [1704366665.427316][14099:14101] CHIP:DMG: WriteClient moving to [AddAttribu]
    [1704366665.427473][14099:14101] CHIP:EM: <<< [E:32463i S:53616 M:69275124] (S) Msg TX to 1:0000000000005164 [B1E9] [UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540] --- Type 0001:06 (IM:WriteRequest)
    [1704366665.427593][14099:14101] CHIP:DMG: WriteClient moving to [AwaitingRe]
    [1704366665.427699][14099:14101] CHIP:EM: <<< [E:32462i S:0 M:96523754 (Ack:81579766)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366665.427769][14099:14101] CHIP:EM: Flushed pending ack for MessageCounter:81579766 on exchange 32462i
    [1704366665.474779][14099:14101] CHIP:EM: >>> [E:32463i S:53616 M:100477587 (Ack:69275124)] (S) Msg RX from 1:0000000000005164 [B1E9] --- Type 0001:07 (IM:WriteResponse)
    [1704366665.474823][14099:14101] CHIP:EM: Found matching exchange: 32463i, Delegate: 0x7f710c00a700
    [1704366665.474855][14099:14101] CHIP:EM: Rxd Ack; Removing MessageCounter:69275124 from Retrans Table on exchange 32463i
    [1704366665.474889][14099:14101] CHIP:DMG: WriteClient moving to [ResponseRe]
    [1704366665.474941][14099:14101] CHIP:DMG: WriteResponseMessage =
    [1704366665.474964][14099:14101] CHIP:DMG: {
    [1704366665.474982][14099:14101] CHIP:DMG:      AttributeStatusIBs =
    [1704366665.475010][14099:14101] CHIP:DMG:      [
    [1704366665.475035][14099:14101] CHIP:DMG:              AttributeStatusIB =
    [1704366665.475058][14099:14101] CHIP:DMG:              {
    [1704366665.475080][14099:14101] CHIP:DMG:                      AttributePathIB =
    [1704366665.475106][14099:14101] CHIP:DMG:                      {
    [1704366665.475135][14099:14101] CHIP:DMG:                              Endpoint = 0x0,
    [1704366665.475161][14099:14101] CHIP:DMG:                              Cluster = 0x1f,
    [1704366665.475183][14099:14101] CHIP:DMG:                              Attribute = 0x0000_0000,
    [1704366665.475206][14099:14101] CHIP:DMG:                      }
    [1704366665.475236][14099:14101] CHIP:DMG:
    [1704366665.475259][14099:14101] CHIP:DMG:                      StatusIB =
    [1704366665.475282][14099:14101] CHIP:DMG:                      {
    [1704366665.475306][14099:14101] CHIP:DMG:                              status = 0x00 (SUCCESS),
    [1704366665.475328][14099:14101] CHIP:DMG:                      },
    [1704366665.475353][14099:14101] CHIP:DMG:
    [1704366665.475374][14099:14101] CHIP:DMG:              },
    [1704366665.475409][14099:14101] CHIP:DMG:
    [1704366665.475430][14099:14101] CHIP:DMG:              AttributeStatusIB =
    [1704366665.475451][14099:14101] CHIP:DMG:              {
    [1704366665.475472][14099:14101] CHIP:DMG:                      AttributePathIB =
    [1704366665.475494][14099:14101] CHIP:DMG:                      {
    [1704366665.475518][14099:14101] CHIP:DMG:                              Endpoint = 0x0,
    [1704366665.475541][14099:14101] CHIP:DMG:                              Cluster = 0x1f,
    [1704366665.475566][14099:14101] CHIP:DMG:                              Attribute = 0x0000_0000,
    [1704366665.475589][14099:14101] CHIP:DMG:                              ListIndex = Null,
    [1704366665.475611][14099:14101] CHIP:DMG:                      }
    [1704366665.475640][14099:14101] CHIP:DMG:
    [1704366665.475662][14099:14101] CHIP:DMG:                      StatusIB =
    [1704366665.475685][14099:14101] CHIP:DMG:                      {
    [1704366665.475706][14099:14101] CHIP:DMG:                              status = 0x00 (SUCCESS),
    [1704366665.475728][14099:14101] CHIP:DMG:                      },
    [1704366665.475752][14099:14101] CHIP:DMG:
    [1704366665.475773][14099:14101] CHIP:DMG:              },
    [1704366665.475800][14099:14101] CHIP:DMG:
    [1704366665.475821][14099:14101] CHIP:DMG:      ],
    [1704366665.475855][14099:14101] CHIP:DMG:
    [1704366665.475876][14099:14101] CHIP:DMG:      InteractionModelRevision = 11
    [1704366665.475896][14099:14101] CHIP:DMG: }
    [1704366665.476021][14099:14101] CHIP:DMG: WriteClient moving to [AwaitingDe]
    [1704366665.476167][14099:14101] CHIP:EM: <<< [E:32463i S:53616 M:69275125 (Ack:100477587)] (S) Msg TX to 1:0000000000005164 [B1E9] [UDP:[fe80::424c:caff:fe43:9c90%enp3s0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366665.476254][14099:14101] CHIP:EM: Flushed pending ack for MessageCounter:100477587 on exchange 32463i
    ~~ 중략 ~~

     

     

    ↓ light-switch 장치의 바인딩 attribute 에  light 장치의 엔트리 추가하기 

      Update the switch's binding attribute to add the entry of remote device (light) in the binding table

    $ ./chip-tool binding write binding '[{"node":20836, "endpoint":1, "cluster":6}]' 0x7283 0x1
    ~~ 중략 ~~
    [1704366784.727180][14107:14109] CHIP:TOO: Sending command to node 0x7283
    [1704366784.727268][14107:14109] CHIP:CSM: FindOrEstablishSession: PeerId = [1:0000000000007283]
    [1704366784.727274][14107:14109] CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found
    [1704366784.727282][14107:14109] CHIP:DIS: OperationalSessionSetup[1:0000000000007283]: State change 1 --> 2
    [1704366784.735424][14107:14109] CHIP:DIS: UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540: new best score: 7
    [1704366784.735448][14107:14109] CHIP:DIS: Lookup clearing interface for non LL address
    [1704366784.735484][14107:14109] CHIP:DIS: UDP:192.168.19.10%enp3s0:5540: new best score: 2
    [1704366784.735499][14107:14109] CHIP:DIS: Checking node lookup status after 8 ms
    [1704366784.735513][14107:14109] CHIP:DIS: Keeping DNSSD lookup active
    [1704366784.735624][14107:14109] CHIP:DIS: UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540: new best score: 7
    [1704366784.735641][14107:14109] CHIP:DIS: Lookup clearing interface for non LL address
    [1704366784.735672][14107:14109] CHIP:DIS: UDP:192.168.19.10%enp3s0:5540: new best score: 2
    [1704366784.735690][14107:14109] CHIP:DIS: Checking node lookup status after 8 ms
    [1704366784.735703][14107:14109] CHIP:DIS: Keeping DNSSD lookup active
    [1704366784.928012][14107:14109] CHIP:DIS: Checking node lookup status after 200 ms
    [1704366784.928109][14107:14109] CHIP:DIS: OperationalSessionSetup[1:0000000000007283]: Updating device address to UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540 while in state 2
    [1704366784.928136][14107:14109] CHIP:DIS: OperationalSessionSetup[1:0000000000007283]: State change 2 --> 3
    [1704366784.928252][14107:14109] CHIP:IN: SecureSession[0x7f06e800ed30]: Allocated Type:2 LSID:29124
    [1704366784.928291][14107:14109] CHIP:SC: Initiating session on local FabricIndex 1 from 0x000000000001B669 -> 0x0000000000007283
    [1704366784.929193][14107:14109] CHIP:EM: <<< [E:22753i S:0 M:28044805] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540] --- Type 0000:30 (SecureChannel:CASE_Sigma1)
    [1704366784.929316][14107:14109] CHIP:SC: Sent Sigma1 msg
    [1704366784.929343][14107:14109] CHIP:DIS: OperationalSessionSetup[1:0000000000007283]: State change 3 --> 4
    [1704366785.000196][14107:14109] CHIP:EM: >>> [E:22753i S:0 M:209035258 (Ack:28044805)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366785.000246][14107:14109] CHIP:EM: Found matching exchange: 22753i, Delegate: 0x7f06e800ea88
    [1704366785.000284][14107:14109] CHIP:EM: Rxd Ack; Removing MessageCounter:28044805 from Retrans Table on exchange 22753i
    [1704366785.067171][14107:14109] CHIP:EM: >>> [E:22753i S:0 M:209035259 (Ack:28044805)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:31 (SecureChannel:CASE_Sigma2)
    [1704366785.067222][14107:14109] CHIP:EM: Found matching exchange: 22753i, Delegate: 0x7f06e800ea88
    [1704366785.067247][14107:14109] CHIP:EM: CHIP MessageCounter:28044805 not in RetransTable on exchange 22753i
    [1704366785.067291][14107:14109] CHIP:SC: Received Sigma2 msg
    [1704366785.067327][14107:14109] CHIP:SC: Peer assigned session session ID 48188
    [1704366785.071288][14107:14109] CHIP:SC: Found MRP parameters in the message
    [1704366785.071345][14107:14109] CHIP:SC: Sending Sigma3
    [1704366785.071980][14107:14109] CHIP:EM: <<< [E:22753i S:0 M:28044806 (Ack:209035259)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540] --- Type 0000:32 (SecureChannel:CASE_Sigma3)
    [1704366785.072141][14107:14109] CHIP:SC: Sent Sigma3 msg
    [1704366785.100196][14107:14109] CHIP:EM: >>> [E:22753i S:0 M:209035260 (Ack:28044806)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366785.100218][14107:14109] CHIP:EM: Found matching exchange: 22753i, Delegate: 0x7f06e800ea88
    [1704366785.100233][14107:14109] CHIP:EM: Rxd Ack; Removing MessageCounter:28044806 from Retrans Table on exchange 22753i
    [1704366785.234291][14107:14109] CHIP:EM: >>> [E:22753i S:0 M:209035261 (Ack:28044806)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport)
    [1704366785.234340][14107:14109] CHIP:EM: Found matching exchange: 22753i, Delegate: 0x7f06e800ea88
    [1704366785.234365][14107:14109] CHIP:EM: CHIP MessageCounter:28044806 not in RetransTable on exchange 22753i
    [1704366785.234412][14107:14109] CHIP:SC: Success status report received. Session was established
    [1704366785.238250][14107:14109] CHIP:SC: SecureSession[0x7f06e800ed30, LSID:29124]: State change 'kEstablishing' --> 'kActive'
    [1704366785.238326][14107:14109] CHIP:IN: SecureSession[0x7f06e800ed30]: Activated - Type:2 LSID:29124
    [1704366785.238354][14107:14109] CHIP:IN: New secure session activated for device <0000000000007283, 1>, LSID:29124 PSID:48188!
    [1704366785.238382][14107:14109] CHIP:DIS: OperationalSessionSetup[1:0000000000007283]: State change 4 --> 5
    [1704366785.238461][14107:14109] CHIP:TOO:      cluster 0x0000_001E, attribute: 0x0000_0000, endpoint 1
    [1704366785.238558][14107:14109] CHIP:DMG: WriteClient moving to [AddAttribu]
    [1704366785.238651][14107:14109] CHIP:DMG: WriteClient moving to [AddAttribu]
    [1704366785.238866][14107:14109] CHIP:EM: <<< [E:22754i S:29124 M:215625777] (S) Msg TX to 1:0000000000007283 [B1E9] [UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540] --- Type 0001:06 (IM:WriteRequest)
    [1704366785.239031][14107:14109] CHIP:DMG: WriteClient moving to [AwaitingRe]
    [1704366785.239182][14107:14109] CHIP:EM: <<< [E:22753i S:0 M:28044807 (Ack:209035261)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366785.239285][14107:14109] CHIP:EM: Flushed pending ack for MessageCounter:209035261 on exchange 22753i
    [1704366785.281888][14107:14109] CHIP:EM: >>> [E:22754i S:29124 M:112801182 (Ack:215625777)] (S) Msg RX from 1:0000000000007283 [B1E9] --- Type 0001:07 (IM:WriteResponse)
    [1704366785.281937][14107:14109] CHIP:EM: Found matching exchange: 22754i, Delegate: 0x7f06e800a700
    [1704366785.281973][14107:14109] CHIP:EM: Rxd Ack; Removing MessageCounter:215625777 from Retrans Table on exchange 22754i
    [1704366785.282009][14107:14109] CHIP:DMG: WriteClient moving to [ResponseRe]
    [1704366785.282064][14107:14109] CHIP:DMG: WriteResponseMessage =
    [1704366785.282085][14107:14109] CHIP:DMG: {
    [1704366785.282105][14107:14109] CHIP:DMG:      AttributeStatusIBs =
    [1704366785.282135][14107:14109] CHIP:DMG:      [
    [1704366785.282156][14107:14109] CHIP:DMG:              AttributeStatusIB =
    [1704366785.282179][14107:14109] CHIP:DMG:              {
    [1704366785.282201][14107:14109] CHIP:DMG:                      AttributePathIB =
    [1704366785.282225][14107:14109] CHIP:DMG:                      {
    [1704366785.282249][14107:14109] CHIP:DMG:                              Endpoint = 0x1,
    [1704366785.282311][14107:14109] CHIP:DMG:                              Cluster = 0x1e,
    [1704366785.282335][14107:14109] CHIP:DMG:                              Attribute = 0x0000_0000,
    [1704366785.282358][14107:14109] CHIP:DMG:                      }
    [1704366785.282387][14107:14109] CHIP:DMG:
    [1704366785.282409][14107:14109] CHIP:DMG:                      StatusIB =
    [1704366785.282434][14107:14109] CHIP:DMG:                      {
    [1704366785.282457][14107:14109] CHIP:DMG:                              status = 0x00 (SUCCESS),
    [1704366785.282480][14107:14109] CHIP:DMG:                      },
    [1704366785.282504][14107:14109] CHIP:DMG:
    [1704366785.282526][14107:14109] CHIP:DMG:              },
    [1704366785.282560][14107:14109] CHIP:DMG:
    [1704366785.282581][14107:14109] CHIP:DMG:              AttributeStatusIB =
    [1704366785.282603][14107:14109] CHIP:DMG:              {
    [1704366785.282624][14107:14109] CHIP:DMG:                      AttributePathIB =
    [1704366785.282647][14107:14109] CHIP:DMG:                      {
    [1704366785.282670][14107:14109] CHIP:DMG:                              Endpoint = 0x1,
    [1704366785.282694][14107:14109] CHIP:DMG:                              Cluster = 0x1e,
    [1704366785.282720][14107:14109] CHIP:DMG:                              Attribute = 0x0000_0000,
    [1704366785.282744][14107:14109] CHIP:DMG:                              ListIndex = Null,
    [1704366785.282767][14107:14109] CHIP:DMG:                      }
    [1704366785.282795][14107:14109] CHIP:DMG:
    [1704366785.282817][14107:14109] CHIP:DMG:                      StatusIB =
    [1704366785.282840][14107:14109] CHIP:DMG:                      {
    [1704366785.282863][14107:14109] CHIP:DMG:                              status = 0x00 (SUCCESS),
    [1704366785.282885][14107:14109] CHIP:DMG:                      },
    [1704366785.282908][14107:14109] CHIP:DMG:
    [1704366785.282930][14107:14109] CHIP:DMG:              },
    [1704366785.282958][14107:14109] CHIP:DMG:
    [1704366785.282978][14107:14109] CHIP:DMG:      ],
    [1704366785.283012][14107:14109] CHIP:DMG:
    [1704366785.283033][14107:14109] CHIP:DMG:      InteractionModelRevision = 11
    [1704366785.283054][14107:14109] CHIP:DMG: }
    [1704366785.283206][14107:14109] CHIP:DMG: WriteClient moving to [AwaitingDe]
    [1704366785.283378][14107:14109] CHIP:EM: <<< [E:22754i S:29124 M:215625778 (Ack:112801182)] (S) Msg TX to 1:0000000000007283 [B1E9] [UDP:[fe80::424c:caff:fe43:b1d0%enp3s0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [1704366785.283475][14107:14109] CHIP:EM: Flushed pending ack for MessageCounter:112801182 on exchange 22754i
    ~~ 중략 ~~

     

      

    ▶ switch 로 light 장치 LED On 하기

    switch 장치의 시리얼 창에 다음 입력 또는 boot 버튼 클릭

    matter esp client invoke 0x1 0x5164 0x1 0x6 0x1

     

    switch 장치 시리얼 로그

    I (1383870) chip[DIS]: Found an existing secure session to [1:0000000000005164]!
    I (1383870) esp_matter_client: New connection success
    I (1383880) chip[EM]: <<< [E:30240i S:48190 M:140668087] (S) Msg TX to 1:0000000000005164 [B1E9] [UDP:[FE80::424C:CAFF:FE43:9C90%st1]:5540] --- Type 0001:08 (IM:InvokeCommandRequest)
    Done
    > I (1384140) chip[EM]: >>> [E:30240i S:48190 M:209149247 (Ack:140668087)] (S) Msg RX from 1:0000000000005164 [B1E9] --- Type 0001:09 (IM:InvokeCommandResponse)
    I (1384160) chip[DMG]: Received Command Response Status for Endpoint=1 Cluster=0x0000_0006 Command=0x0000_0001 Status=0x0
    I (1384170) esp_matter_client: Send command success
    I (1384170) chip[EM]: <<< [E:30240i S:48190 M:140668088 (Ack:209149247)] (S) Msg TX to 1:0000000000005164 [B1E9] [UDP:[FE80::424C:CAFF:FE43:9C90%st1]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck)

     

    → light 장치 시리얼 로그

    > I (1132729) chip[EM]: >>> [E:30240r S:33821 M:140668087] (S) Msg RX from 1:0000000000007283 [B1E9] --- Type 0001:08 (IM:InvokeCommandRequest)
    I (1132749) esp_matter_command: Received command 0x00000001 for endpoint 0x0001's cluster 0x00000006
    I (1132749) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00000000 is 0 **********
    I (1132759) chip[ZCL]: Toggle ep1 on/off from state 0 to 1
    I (1132769) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x0000FFFC is 1 **********
    I (1132779) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00004001 is 0 **********
    I (1132789) chip[ZCL]: On Command - OffWaitTime :  0
    I (1132789) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00004002 is 0 **********
    I (1132809) chip[ZCL]: On/Toggle Command - Stop Timer
    I (1132819) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00004000 is 1 **********
    I (1132829) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00000000 is 1 **********
    I (1132839) led_driver_ws2812: led set r:63, g:51, b:40
    I (1132859) chip[EM]: <<< [E:30240r S:33821 M:209149247 (Ack:140668087)] (S) Msg TX to 1:0000000000007283 [B1E9] [UDP:[FE80::424C:CAFF:FE43:B1D0%st1]:5540] --- Type 0001:09 (IM:InvokeCommandResponse)
    I (1132929) chip[EM]: >>> [E:30240r S:33821 M:140668088 (Ack:209149247)] (S) Msg RX from 1:0000000000007283 [B1E9] --- Type 0000:10 (SecureChannel:StandaloneAck)

     

     

    그럼 오늘도 수고하세요.

     

    반응형