본문으로 바로가기

[esp-matter] [generic_switch][2] matter light 장치 연동하기

category ESP32 2024. 7. 5. 15:24

: SmartThings 앱을 사용해 generic_switch 장치의 버튼을 누를 경우 matter light 장치의 LED를  On/Off  테스트 하기

 

< 준비사항>

 → SmartThings 앱 설치

 → SmartThings 앱에 SmartThings Station 장치 추가

 → SmartThings 앱에 light 장치 추가

 

▶ generic_switch 장치를  SmartThings 앱에 기기추가하기

→ generic_switch 장치 부팅 로그

더보기
load:0x40875720,len:0x1804
load:0x4086c410,len:0xe58
load:0x4086e610,len:0x2e20
entry 0x4086c41a
I (23) boot: ESP-IDF v5.2.1-dirty 2nd stage bootloader
I (24) boot: compile time Jul  5 2024 12:23:39
I (24) boot: chip revision: v0.0
I (27) boot.esp32c6: SPI Speed      : 80MHz
I (32) boot.esp32c6: SPI Mode       : DIO
I (36) boot.esp32c6: SPI Flash Size : 4MB
I (41) boot: Enabling RNG early entropy source...
I (47) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length
I (57) boot:  0 esp_secure_cert  unknown          3f 06 0000d000 00002000
I (65) boot:  1 nvs              WiFi data        01 02 00010000 0000c000
I (72) boot:  2 nvs_keys         NVS keys         01 04 0001c000 00001000
I (80) boot:  3 otadata          OTA data         01 00 0001d000 00002000
I (87) boot:  4 phy_init         RF data          01 01 0001f000 00001000
I (95) boot:  5 ota_0            OTA app          00 10 00020000 001e0000
I (102) boot:  6 ota_1            OTA app          00 11 00200000 001e0000
I (110) boot:  7 fctry            WiFi data        01 02 003e0000 00006000
I (117) boot: End of partition table
I (122) esp_image: segment 0: paddr=00020020 vaddr=42140020 size=3dee8h (253672) map
I (183) esp_image: segment 1: paddr=0005df10 vaddr=40800000 size=02108h (  8456) load
I (185) esp_image: segment 2: paddr=00060020 vaddr=42000020 size=133554h (1258836) map
I (448) esp_image: segment 3: paddr=0019357c vaddr=40802108 size=17c84h ( 97412) load
I (471) esp_image: segment 4: paddr=001ab208 vaddr=40819d90 size=03bc8h ( 15304) load
I (476) esp_image: segment 5: paddr=001aedd8 vaddr=50000000 size=00004h (     4) load
I (483) boot: Loaded app from partition at offset 0x20000
I (484) boot: Disabling RNG early entropy source...
I (500) cpu_start: Unicore app
W (509) clk: esp_perip_clk_init() has not been implemented yet
I (516) cpu_start: Pro cpu start user code
I (516) cpu_start: cpu freq: 160000000 Hz
I (516) cpu_start: Application information:
I (519) cpu_start: Project name:     generic_switch
I (524) cpu_start: App version:      1.0
I (529) cpu_start: Compile time:     Jul  5 2024 12:23:33
I (535) cpu_start: ELF file SHA256:  bb322b1e3...
I (540) cpu_start: ESP-IDF:          v5.2.1-dirty
I (546) cpu_start: Min chip rev:     v0.0
I (551) cpu_start: Max chip rev:     v0.99
I (555) cpu_start: Chip rev:         v0.0
I (560) heap_init: Initializing. RAM available for dynamic allocation:
I (567) heap_init: At 4082FDA0 len 0004C870 (306 KiB): RAM
I (573) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
I (580) heap_init: At 50000004 len 00003FE4 (15 KiB): RTCRAM
I (587) spi_flash: detected chip: generic
I (591) spi_flash: flash io: dio
I (596) sleep: Configure to isolate all GPIO pins in sleep state
I (601) sleep: Enable automatic switching of GPIO sleep configuration
I (608) coexist: coex firmware version: 77cd7f8
I (614) coexist: coexist rom version 5b8dcfa
I (619) main_task: Started on CPU0
I (619) main_task: Calling app_main()
I (639) gpio: GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (639) app_main: Generic Switch created with endpoint_id 1
I (649) pp: pp rom version: 5b8dcfa
I (649) net80211: net80211 rom version: 5b8dcfa
I (669) wifi:wifi driver task: 4083bafc, prio:23, stack:6656, core=0
I (669) wifi:wifi firmware version: a9f5b59
I (669) wifi:wifi certification version: v7.0
I (669) wifi:config NVS flash: enabled
I (669) wifi:config nano formating: disabled
I (679) wifi:mac_version:HAL_MAC_ESP32AX_761,ut_version:N
I (679) wifi:Init data frame dynamic rx buffer num: 32
I (689) wifi:Init static rx mgmt buffer num: 5
I (689) wifi:Init management short buffer num: 32
I (699) wifi:Init dynamic tx buffer num: 32
I (699) wifi:Init static tx FG buffer num: 2
I (699) wifi:Init static rx buffer size: 1700
I (709) wifi:Init static rx buffer num: 10
I (709) wifi:Init dynamic rx buffer num: 32
I (719) wifi_init: rx ba win: 6
I (719) wifi_init: tcpip mbox: 32
I (719) wifi_init: udp mbox: 6
I (729) wifi_init: tcp mbox: 6
I (729) wifi_init: tcp tx win: 5760
I (739) wifi_init: tcp rx win: 5760
I (739) wifi_init: tcp mss: 1440
I (739) wifi_init: WiFi IRAM OP enabled
I (749) wifi_init: WiFi RX IRAM OP enabled
I (769) chip[DL]: NVS set: chip-counters/reboot-count = 2 (0x2)
I (769) chip[DL]: Real time clock set to 946684800 (0100/00/01 00:00:00 UTC)
I (769) BLE_INIT: Using main XTAL as clock source
I (779) BLE_INIT: ble controller commit:[217f1bf]
I (779) phy_init: phy_version 250,e14681b,Jan 24 2024,17:43:11
I (829) phy: libbtbb version: 939f79c, Jan 24 2024, 17:43:26
I (829) NimBLE: GAP procedure initiated: stop advertising.

I (829) NimBLE: Failed to restore IRKs from store; status=8

I (829) CHIP[DL]: BLE host-controller synced
I (1339) chip[DL]: Starting ESP WiFi layer
W (1339) wifi:(bf)761:0x600a7cac:0x01b4b4b0
W (1339) wifi:(agc)0x600a7128:0xd21e2c1a, min.avgNF:0xce->0xd2(dB), RCalCount:0x1e2, min.RRssi:0xc1a(-62.38)
W (1339) wifi:(TB)WDEV_PWR_TB_MCS0:19
W (1349) wifi:(TB)WDEV_PWR_TB_MCS1:19
W (1349) wifi:(TB)WDEV_PWR_TB_MCS2:19
W (1349) wifi:(TB)WDEV_PWR_TB_MCS3:19
W (1359) wifi:(TB)WDEV_PWR_TB_MCS4:19
W (1359) wifi:(TB)WDEV_PWR_TB_MCS5:19
W (1359) wifi:(TB)WDEV_PWR_TB_MCS6:18
W (1369) wifi:(TB)WDEV_PWR_TB_MCS7:18
W (1369) wifi:(TB)WDEV_PWR_TB_MCS8:17
W (1369) wifi:(TB)WDEV_PWR_TB_MCS9:15
W (1379) wifi:(TB)WDEV_PWR_TB_MCS10:15
W (1379) wifi:(TB)WDEV_PWR_TB_MCS11:15
I (1379) wifi:11ax coex: WDEVAX_PTI0(0x55777555), WDEVAX_PTI1(0x00003377).

I (1389) wifi:mode : sta (40:4c:ca:43:5e:6c)
I (1389) wifi:enable tsf
W (1399) wifi:Haven't to connect to a suitable AP now!
I (1399) chip[DL]: Done driving station state, nothing else to do...
W (1409) wifi:Haven't to connect to a suitable AP now!
I (1409) chip[DL]: Done driving station state, nothing else to do...
I (1419) chip[SVR]: Initializing subscription resumption storage...
I (1429) chip[SVR]: Server initializing...
I (1429) chip[TS]: Last Known Good Time: 2023-10-14T01:16:48
I (1439) chip[DMG]: AccessControl: initializing
I (1439) chip[DMG]: Examples::AccessControlDelegate::Init
I (1449) chip[DMG]: AccessControl: setting
I (1449) chip[DMG]: DefaultAclStorage: initializing
I (1459) chip[DMG]: DefaultAclStorage: 0 entries loaded
I (1479) chip[ZCL]: Using ZAP configuration...
I (1479) esp_matter_cluster: Cluster plugin init common callback
I (1479) chip[DMG]: AccessControlCluster: initializing
I (1489) chip[ZCL]: 0x42145730 ep 0 clus 0x0000_0030 attr 0x0000_0000 not supported
I (1499) chip[ZCL]: Initiating Admin Commissioning cluster.
I (1499) chip[DIS]: Updating services using commissioning mode 1
I (1509) chip[DIS]: CHIP minimal mDNS started advertising.
I (1519) chip[DIS]: Advertise commission parameter vendorID=65521 productID=32768 discriminator=3841/15 cm=1 cp=0
I (1529) chip[DIS]: CHIP minimal mDNS configured as 'Commissionable node device'; instance name: 08D1D4F7E4E5F25C.
I (1539) chip[DIS]: mDNS service published: _matterc._udp
I (1539) chip[IN]: CASE Server enabling CASE session setups
I (1549) chip[SVR]: Joining Multicast groups
I (1549) chip[SVR]: Server Listening...
I (1559) esp_matter_core: Dynamic endpoint 0 added
I (1559) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000003's Attribute 0x00000001 is 0 **********
I (1579) esp_matter_core: Dynamic endpoint 1 added
I (1579) chip[DL]: WIFI_EVENT_STA_START
W (1589) wifi:Haven't to connect to a suitable AP now!
I (1589) chip[DL]: Done driving station state, nothing else to do...
I (1599) chip[DL]: Configuring CHIPoBLE advertising (interval 25 ms, connectable)
I (1609) NimBLE: GAP procedure initiated: advertise;
I (1609) NimBLE: disc_mode=2
I (1619) NimBLE:  adv_channel_map=0 own_addr_type=1 adv_filter_policy=0 adv_itvl_min=40 adv_itvl_max=40
I (1629) NimBLE:

I (1629) chip[DL]: CHIPoBLE advertising started
I (1629) app_main: Commissioning window opened
I (1639) esp_matter_core: esp matter started
I (1699) main_task: Returned from app_main()
I (31499) chip[DL]: Configuring CHIPoBLE advertising (interval 500 ms, connectable)
I (31509) chip[DL]: Device already advertising, stop active advertisement and restart
I (31519) NimBLE: GAP procedure initiated: stop advertising.

I (31519) NimBLE: GAP procedure initiated: advertise;
I (31529) NimBLE: disc_mode=2
I (31529) NimBLE:  adv_channel_map=0 own_addr_type=1 adv_filter_policy=0 adv_itvl_min=800 adv_itvl_max=800
I (31539) NimBLE:

 

→ SmartThings 앱 기기 추가하기

↓ 앱 실행후 우측 상단 + 버튼 클릭

 

↓ 기기 추가

 

 

↓ "Matter device(3841)" 장치가 나올때 까지 대기

 

 

↓ QR code 스캔 화면 출력 시 아래의 QR 넣어주세요.

  

 

↓ 미인증 기기라서 팝업화면에서 "계속" 버튼 클릭

 

 

  네트워크 선택 화면 

 

 

  기기 등록 마지막 단계

 

 

  기기 화면이 마지막으로 나오면 OK

 

 

 

SmartThings 앱의 generic_switch 장치 누름버튼 설정

  ↓  generic_switch 장치 선택후  아래처럼 "누름" 버튼 선택

 

 

↓ 동작추가하기

 

↓ 기기 제어하기 선택

 

기존에 등록한 light 장치 선택

 

↓ 버튼 누를때 light 장치 현재 상태 토글되게 설정

 

 

↓ 이후는 "저장" 버튼 클릭

 

 

↓ generic_switch 장치의  누름 버튼의 기능 확인하기

 

 

 

▶ generic_switch 장치의 버튼 클릭시 light 장치 on/off 확인하기

  : 조금 느림..(1분은 아니더라도 많이 느림.)

 SmartThings 앱에서 버튼 상태를 읽고 그에 맞는 루틴를 실행함.

더보기
// light On
I (3989139) app_driver: Initial button pressed
I (3989139) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 1 **********
I (3989169) chip[ZCL]: SwitchServer: OnInitialPress
I (3989339) app_driver: Short button release
I (3989339) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 0 **********
I (3989369) chip[ZCL]: SwitchServer: OnShortRelease
I (3989539) app_driver: Multipress Complete
I (3989539) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 0 **********
I (3989559) chip[ZCL]: SwitchServer: OnMultiPressComplete
I (3995579) chip[EM]: <<< [E:24901i S:61534 M:185036914] (S) Msg TX to 1:1BC15B739A5D27FF [085D] [UDP:[FDF5:60C8:E646:2D6B:2EBA:BAFF:FE96:C057]:45557] --- Type 0001:05 (IM:ReportData)
I (3995789) chip[EM]: >>> [E:24901i S:61534 M:212443442 (Ack:185036914)] (S) Msg RX from 1:1BC15B739A5D27FF [085D] --- Type 0001:01 (IM:StatusResponse)
I (3995809) chip[IM]: Received status response, status is 0x00
I (3995809) chip[EM]: <<< [E:24901i S:61534 M:185036915 (Ack:212443442)] (S) Msg TX to 1:1BC15B739A5D27FF [085D] [UDP:[FDF5:60C8:E646:2D6B:2EBA:BAFF:FE96:C057]:45557] --- Type 0000:10 (SecureChannel:StandaloneAck)


// light Off
I (4124559) app_driver: Initial button pressed
I (4124559) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 1 **********
I (4124589) chip[ZCL]: SwitchServer: OnInitialPress
I (4124739) app_driver: Short button release
I (4124739) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 0 **********
I (4124769) chip[ZCL]: SwitchServer: OnShortRelease
I (4124939) app_driver: Multipress Complete
I (4124939) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x0000003B's Attribute 0x00000001 is 0 **********
I (4124959) chip[ZCL]: SwitchServer: OnMultiPressComplete
I (4145669) chip[EM]: <<< [E:24906i S:61534 M:185036925] (S) Msg TX to 1:1BC15B739A5D27FF [085D] [UDP:[FDF5:60C8:E646:2D6B:2EBA:BAFF:FE96:C057]:45557] --- Type 0001:05 (IM:ReportData)
I (4145729) chip[EM]: >>> [E:24906i S:61534 M:212443447 (Ack:185036925)] (S) Msg RX from 1:1BC15B739A5D27FF [085D] --- Type 0001:01 (IM:StatusResponse)
I (4145739) chip[IM]: Received status response, status is 0x00
I (4145739) chip[EM]: <<< [E:24906i S:61534 M:185036926 (Ack:212443447)] (S) Msg TX to 1:1BC15B739A5D27FF [085D] [UDP:[FDF5:60C8:E646:2D6B:2EBA:BAFF:FE96:C057]:45557] --- Type 0000:10 (SecureChannel:StandaloneAck)

 

 

 

 

반응형