ambiot / ambd_matter

AmebaD public SDK to support Matter project
10 stars 10 forks source link

[bridge_dm] matter bridge evaluation... #104

Open chinfu opened 4 months ago

chinfu commented 4 months ago

Dear I have two issues while trying to"make all" : (2024/02/26) [0] My system: cygwin on windows10

[Err1] log: tar -jxvf /cygdrive/d/_Y/ambd_matter-main/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/…/…/project_hp/toolchain/asdk/asdk-6.4.1-cygwin-newlib-build-2778-i686.tar.bz2 -C cygwin/ bzip2: Compressed file ends unexpectedly; perhaps it is corrupted? Possible reason follows. bzip2: No error Input file = (stdin), output file = (stdout) Been fixed: a. I use "git clone", but these is no "asdk-6.4.1-cygwin-newlib-build-2778-i686.tar" on my local project. b. After copy that file from ambd_sdk, this issue is gone. (not sure cause by "git clone" or git-database or .... ) [Err2] I can make these two projects w/o error on my system 1, GitHub - ambiot/ambd_sdk: Release SDK for AmebaD 2, GitHub - ambiot/ambd_matter: AmebaD public SDK to support Matter project → GCC-RELEASE\project_lp

But, there are errors on GitHub - ambiot/ambd_matter: AmebaD public SDK to support Matter project → GCC-RELEASE\project_hp Any idea ?

.....here is the log...... __collect2: error: ld returned 1 exit status make[1]: ** [Makefile:514: linker_image2_ns] Error 1 make[1]: Leaving directory ‘/cygdrive/d/_Y/GitHub/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk’ make: [Makefile:17: all] Error 2** logMakErr PNG

Thank you . Br, Vic

chinfu commented 4 months ago

Dear, By reference the file of "AN0204 Realtek Matter application note.en.pdf", I had setup one Ubuntu system for building this Matter project.But there is no luck for me.

[OS] Distributor ID: Ubuntu Description: Ubuntu 22.04.4 LTS

[Refernce Doc] AN0204 Realtek Matter application note.en.pdf

[Build Steps] (followinf 3.2.1.2 Building with AmebaD (RTL8722D) ) Step 1: Create a common directory for Ameba and Matter SDK Step 2: Git clone repository ==> OK Step 3: Build Matter Environment ==> OK Step 4: Build Matter Libraries and Ameba Project //Make project_lp ==>OK

//Make Matter Libraries for all-cluster apps ==> ERROR

I got the following error. Did I missed some configuration ?

_make[1]: No rule to make target 'message.o', needed by 'CORE_TARGETS'. Stop. make[1]: Leaving directory '/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/make/chip_main/all_clusters_app' make: [Makefile:206: allclusters] Error 2 make: Leaving directory '/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk'

Capture

chinfu commented 4 months ago

mm.. no body home... I had tried all-clusters, light-app, light-port . All these three builds have this error "*** No rule to make target 'message.o', needed by 'CORE_TARGETS'. Stop."

And it looks like there is no message.cpp in the makefile!? Or, had I missed someting ?

==> these is a meesage.o in the Makefile... Screenshot from 2024-03-12 15-53-48

==>There is no message.cpp in the directory.. Screenshot from 2024-03-12 15-55-35

xshuqun commented 4 months ago

@chinfu Sorry for the delay, the message.cpp file has been removed on connectedhomeip sdk, so we need to make changes for this. If there is no need for use of the latest sdk, maybe you can change to use the Tag: TE_24_01/rc1

chinfu commented 4 months ago

Roger that. Thank you, @xshuqun !

chinfu commented 4 months ago

Dear @xshuqun , (This is not an issue!)(This is not an issue!)(This is not an issue!)

I am wondering if our products possible to fit the CHIP standards.

Here are our simplified products/plans:

Products: one control-center; many on/off switches. The control-center can control/communicate all the switches. Users can add/remove switches into the control-center any time. (The control-center and switches use wires to communicate)

Here raise the question: Only the control-center has the WIFI ability. Is this scenario is able to make the control-center CHIP-able? Such as: A) We are thinking to commission the control-center into the nest-hub. B) Switches connect with control-center by our own wire/flow. C) The control-center would know all the switches’ status, and can report it to nest-hub. D) And, the switches are able to remove/add into the control-center in the future. And the control-center can "update/change" this info to the nest-hub. Is this kind of control-center being able to fit with CHIP? What type should be for it? (7.15.3.4.) Dynamic Device Type?

Thank you any info.... BR, Vic

chinfu commented 4 months ago

I thing what I need is Matter Bridge !? Is amebaD be able to be a bridge ? matterBridge

chinfu commented 4 months ago

Dear @xshuqun , I am able to run light example on Tag: TE_24_01/rc1.

Now I am tryiing bridge_dm, ( https://github.com/ambiot/ambd_matter/tree/main/component/common/application/matter/example/bridge_dm). Is bradge_dm available on this Tag: TE_24_01/rc1. ?

Thanks you .

=================== my errro log for trying bridge_dm on this tag.

/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(matter_data_model_presets.o): in function Presets::Clusters::matter_cluster_groups_server(ClusterConfig*)': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../component/common/application/matter/core/matter_data_model_presets.cpp:473: undefined reference toemberAfGroupsClusterServerInitCallback(unsigned short)' /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(util.o): in function emberAfInit()': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../third_party/connectedhomeip/src/app/util/util.cpp:109: undefined reference toMatterActionsPluginServerInitCallback()' /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(IMClusterCommandHandler.o): in function chip::app::Clusters::Actions::DispatchServerCommand(chip::app::CommandHandler*, chip::app::ConcreteCommandPath const&, chip::TLV::TLVReader&)': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../third_party/connectedhomeip/examples/bridge-app/ameba/build/chip/codegen/zap-generated/IMClusterCommandHandler.cpp:54: undefined reference toemberAfActionsClusterInstantActionCallback(chip::app::CommandHandler*, chip::app::ConcreteCommandPath const&, chip::app::Clusters::Actions::Commands::InstantAction::DecodableType const&)' collect2: error: ld returned 1 exit status make[1]: [Makefile:503: linker_image2_ns] Error 1 make[1]: Leaving directory '/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk' make: [Makefile:17: all] Error 2

xshuqun commented 4 months ago

@chinfu Matter Bridge is used for non-Matter device (which is also known as Bridged Device) to join into Matter Fabric. if you wish to test the bridge_dm example, you need to use

I am sorry for the inconvenience, as we fixed the build error in our Sample App after TE_24_01/rc1. Alternatively, you can pull to the latest sdk for both ambd_matter and connectedhomeip to build bridge_dm.

chinfu commented 3 months ago

Dear @xshuqun , Thanks for your info. I am trying to use the latest version for building the bridge_dm. But there is no luck for me. Did I miss any settings?

1. I try to follow "https://github.com/ambiot/ambd_matter/blob/2f4dfc36019272d9d138f13054aab52724eb3453/component/common/application/matter/example/bridge_dm/README.md#L4"

2. my ambda_matter version: matter@ubuntu:~/dev/ambd_matter$ git log commit 2f4dfc36019272d9d138f13054aab52724eb3453 (grafted, HEAD -> main, origin/main, origin/HEAD) Author: xshuqun 77948861+xshuqun@users.noreply.github.com Date: Fri Mar 22 13:53:43 2024 +0800

3. my connectedhomeip version: matter@ubuntu:~/dev/connectedhomeip$ git log commit 437c5743ef4eac87ec5f80114d295f71e8a4f0e0 (grafted, HEAD -> master, origin/master, origin/HEAD) Author: Justin Wood woody@apple.com Date: Sat Mar 23 09:36:43 2024 -0700

========= error log on cd ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp make all

/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(attribute-storage.o): in function emberAfEndpointEnableDisable(unsigned short, bool)': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../third_party/connectedhomeip/src/app/util/attribute-storage.cpp:948: undefined reference toMatterReportingAttributeChangeCallback(unsigned short)' /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(ember-compatibility-functions.o): in function chip::app::WriteSingleClusterData(chip::Access::SubjectDescriptor const&, chip::app::ConcreteDataAttributePath const&, chip::TLV::TLVReader&, chip::app::WriteHandler*)': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../third_party/connectedhomeip/src/app/util/ember-compatibility-functions.cpp:1014: undefined reference toMatterReportingAttributeChangeCallback(chip::app::ConcreteAttributePath const&)' /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/toolchain/linux/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application/lib_main.a(matter_drivers.o): in function (anonymous namespace)::CallReportingCallback(int)': /home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../../../../component/common/application/matter/example/bridge_dm/matter_drivers.cpp:32: undefined reference toMatterReportingAttributeChangeCallback(chip::app::ConcreteAttributePath const&)' collect2: error: ld returned 1 exit status make[1]: [Makefile:516: linker_image2_ns] Error 1 make[1]: Leaving directory '/home/matter/dev/ambd_matter/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk' make: [Makefile:17: all] Error 2

xshuqun commented 3 months ago

@chinfu Recently CHIP had changed the location of MatterReportingAttributeChangeCallback.. Please include the following files into https://github.com/ambiot/ambd_matter/blob/main/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/make/chip_main/bridge_dm_app/Makefile#L120 for build CPPSRC += $(CHIPDIR)/src/app/reporting/reporting.cpp

chinfu commented 3 months ago

Dear @xshuqun , Thanks, that does fix the BUILD error! :-)

Maybe you can help me on this quick questiuon : If my matter briage will add&remove non-matter-device in the running-time/future, which sample should I study ? bridge_dm or bridge ? Thank you ...

xshuqun commented 3 months ago

Dear @chinfu , Thats great, we will get the build error fixed soon. Regarding your next question, you can take a look at bridge_dm, dm stands for dynamic model, which allows dynamically adding and removing of endpoint during runtime.

Thank you.

chinfu commented 2 months ago

Dear @xshuqun , About "bridge_dm", I was not able to connect the amebaD with my apple TV. I could do all the make/download by the README.md.

Do you have any other resource/doc for using matter-bridge ? Or, did I miss some tasks for running this bridge_dm ?

Thank you . BR, Vic

xshuqun commented 2 months ago

@chinfu could you provide the amebaD's logs when commissioning fails?

chinfu commented 2 months ago

Dear @xshuqun , Thanks for your help....

log ambd-git.txt iphone/apple tv image IMG_5798 IMG_5799 IMG_5800 IMG_5801

chinfu commented 2 months ago

I just got one Google Nest. It's no luck for it !

log by using GoogleNest+SamsungPhone CoolTerm Capture (ambd.stc) 2024-05-09 16-37-28-456.txt

some screenshot Screenshot_20240509_164654_Google Play services Screenshot_20240509_164701_Google Play services Screenshot_20240509_164709_Google Play services Screenshot_20240509_164715_Google Play services Screenshot_20240509_164719_Google Play services

xshuqun commented 2 months ago

@chinfu Did you make any changes to the sdk? As I tested with Apple and Google SmartHub, there is no issue with the commissioning. I had build the image using the follow SHA ambd_matter: 1cf89f2f0c62f24beeb06eab8d078530c3c1436a connectedhomeip: 437c5743ef4eac87ec5f80114d295f71e8a4f0e0

chinfu commented 2 months ago

Dear @xshuqun , I think I had just add some log for study......

Let me try your sha versions first . Thank you for the info... BR, Vic

chinfu commented 2 months ago

Dear @xshuqun , There is no luck for me. Here is my flows, maybe you can take a quick look for me .

  1. try to use same versions as you. _(a)matter@ubuntu:~/dev/ambdmatter$ git rev-parse HEAD 1cf89f2f0c62f24beeb06eab8d078530c3c1436a (b)matter@ubuntu:~/dev/connectedhomeip$ git rev-parse HEAD 437c5743ef4eac87ec5f80114d295f71e8a4f0e0

  2. follow the bridge_dm ( README.md ) ( https://github.com/ambiot/ambd_matter/tree/main/component/common/application/matter/example/bridge_dm )

  3. Same issues as trying to join a apple tv. Did I missed some "Certificate" process ?

    (a) log : CoolTerm Capture (ambd.stc) 2024-05-13 12-32-16-239.txt

    (b) here are two "error" msg in the log:

    (1)chip[BLE] Releasing end point's BLE connection back to application. chip[BLE] HandleChipConnectionReceived failed, err = d chip[BLE] failed handle new chip BLE connection, status = d chip[DL] _OnPlatformEvent kCHIPoBLEConnectionError (2) chip[ZCL] OpCreds: Received an AddTrustedRootCertificate command chip[EM] <<< [E:29241r S:36644 M:112677866 (Ack:135873171)] (S) Msg TX to 1:0000000034822193 [17DE] [UDP:[FE80::14F5:1902:2EDD:548C%r00]:62099] --- Type 0000:10 (SecureChannel:StandaloneAck) chip[ZCL] OpCreds: Failed AddTrustedRootCertificate request with IM error 0x01 (err = 3)

chinfu commented 2 months ago

Dear @xshuqun , I CAN to join bridge_dm to the Nest Audio. :-) image

xshuqun commented 2 months ago

Dear @chinfu , for Apple, you can check the OS version. iPhone and HomePod must have the same version e.g., iOS 17.

Thank you.

chinfu commented 2 months ago

Dear @xshuqun , For apples, my center is appleTV(tvOS 17.4) . And I use iPhone15(17.4.1). BR, Vic

chinfu commented 1 month ago

Dear @xshuqun ,

Any hint for adding more devices( such as A1Light, Outlet.. ) in the bridge_dm sample ? ( more device hooking on this matter-bridge)

Thanks you! Br, Vic

xshuqun commented 1 month ago

@chinfu Sorry for the late response, as I might had overlook it. You can check this file: driver In Line 26, we declared a Light and had set some components in matter_driver_bridge_light_init(). after you have initialize the device, you have to add the endpoint like what was did here

So if you want to add another light, you can continue to use matter_driver_bridge_light_init() and just add ALight2, otherwise you can create a new api to handle your device, afterward just add the endpoint to get it working.

chinfu commented 1 month ago

@xshuqun , great to hear from you.

If I comment out "ALight1.Set()" , the flows for control by android phone still workd well. I think/guess : this Alight1.Set() is where I set my private command to control my bridged device . Am I correct ?

On the other condition: If the on/off status of Alight1 had been revied by the users, how/where do I upload/update/hook the status into this matter bridge ?

BR, Vic

chinfu commented 1 month ago

@chinfu Sorry for the late response, as I might had overlook it. You can check this file: driver In Line 26, we declared a Light and had set some components in matter_driver_bridge_light_init(). after you have initialize the device, you have to add the endpoint like what was did here

So if you want to add another light, you can continue to use matter_driver_bridge_light_init() and just add ALight2, otherwise you can create a new api to handle your device, afterward just add the endpoint to get it working.

Dear @xshuqun ,

By, simply by adding ALight and endpoints, does not add a proper device in the Android app.

Here raise a question for me : In this bridge_dm sample codes, I don't knwo how you connect ALight1 with endpoint 2 . (I know, 0 , 1 is for the matter bridge ) Sucha as, If I add ALight2,ALight3,ALight4, how do I mapping endpoint id to these three devices ? Thanks!

BR, Vic

xshuqun commented 1 month ago

Dear @chinfu , Thank you for informing us about this issue. Based on the code, it does not map the objects to the endpoint, let me check further and provide solutions for it.

Thank you.

xshuqun commented 1 month ago

Dear @chinfu , Could you check the commit here, I added some test code that could bind the device with the assigned endpoint. Please try it and let me know if there is anything missing.

Thank you

chinfu commented 1 month ago

Dear @chinfu , Could you check the commit here, I added some test code that could bind the device with the assigned endpoint. Please try it and let me know if there is anything missing.

Thank you

Dear @xshuqun ,

Is it possilbe to let me know your connectedhomeip SHA which works with this bridge_update update ?

Thank you ~

xshuqun commented 1 month ago

@chinfu please use connectedhomeip SHA: 70d9a61475d31686f0fde8e7b56f352a0f59b299 Thank you,

chinfu commented 1 month ago

0.My versions: ambd_matter$ git describe --tag v1.3-release-1-gfe28d72 connectedhomeip$ git describe --tag v1.3.0.0-426-g70d9a61475

  1. By using the example of bridge_dm, the TEST_PRODUCT works well. Both the on-off and level-control can works on the android Home app. Screenshot_20240612_174923_Home

2.Now, I try to add three ALight devices.

void matter_bridge_test_device(void)
{
    bridge.Init(node);

    EndpointConfig bridgedonoffEndpointConfig;
    Presets::Endpoints::matter_dimmable_light_preset(&bridgedonoffEndpointConfig);
    chip::EndpointId endpointid = bridge.addBridgedEndpoint(bridgedonoffEndpointConfig, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes));
    matter_driver_bridge_bind_device(&ALight1, endpointid);
#if 1
    chip::EndpointId endpointid2 = bridge.addBridgedEndpoint(bridgedonoffEndpointConfig, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes));
    matter_driver_bridge_bind_device(&ALight2, endpointid2);
    chip::EndpointId endpointid3 = bridge.addBridgedEndpoint(bridgedonoffEndpointConfig, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes));
    matter_driver_bridge_bind_device(&ALight3, endpointid3);
    chip::EndpointId endpointid4 = bridge.addBridgedEndpoint(bridgedonoffEndpointConfig, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes));
    matter_driver_bridge_bind_device(&ALight4, endpointid4);
#endif

    if(xTaskCreate(matter_customer_bridge_code, ((const char*)"matter_customer_bridge_code"), 1024, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
        printf("\n\r%s xTaskCreate(matter_customer_bridge_code) failed\n", __FUNCTION__);

    vTaskDelay(20000);

    //matter_driver_bridge_unbind_device(&ALight1);
}
  1. On the Home app, only two TEST_PRODUCT appears,and: a) only on-off command works. b) level-control command would go wrong. Screenshot_20240612_180155_Home

  2. My log: chip[DIS] resolver inactive, continue to next CoolTerm Capture (ambd.stc) 2024-06-12 17-59-22-225.txt

chinfu commented 1 month ago

Dear @xshuqun ,

The following code will resolve the issues I mentioned above..... Please help to verify if this is correct !? Thank you! Br Vic

EmberAfDeviceType gBridgedOnOffDeviceTypes[] = {
    { DEVICE_TYPE_LO_ON_OFF_LIGHT, DEVICE_VERSION_DEFAULT },
    //$$//{ DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT },
};
xshuqun commented 1 month ago

@chinfu there seem to be some issue with the dynamic endpoint when declaring two device type. I am investigating on the issue now.

Thank you.

chinfu commented 1 month ago

@xshuqun , FYI. Please check the these code, I can have four on/off devices working well ( on/off , level control...)

EmberAfDeviceType gBridgedOnOffDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF_LIGHT, DEVICE_VERSION_DEFAULT }, //$$//{ DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT }, };

xshuqun commented 1 month ago

It is required to add BRIDGED NODE as device type for the devices in Bridge implementation. It seems that there is issue identifying the device type.

chinfu commented 1 month ago

👌 will wait for your update... Thanks you!