TuyaInc / tuyasmart_home_ios_sdk

Tuya Smart iOS Home SDK
https://tuyainc.github.io/tuyasmart_home_ios_sdk_doc
50 stars 19 forks source link

Product Id in a group #7

Closed Coiado closed 5 years ago

Coiado commented 5 years ago

Hello, I'm trying to create a group of devices with the function TuyaSmartGroup.createGroup, but there's a parameter called productId, where can I find this ID? In the documentation, they said we must use the user device list, but I can't find the groupId in my device list.

0x5e commented 5 years ago

The productId can be found in TuyaSmartDeviceModel. You can get your home list by -[TuyaSmartHomeManager getHomeListWithSuccess:failure:], then get home detail by -[TuyaSmartHome getHomeDetailWithSuccess], then get deviceList in TuyaSmartHome instance property.

Coiado commented 5 years ago

Thank you very much for your answer! Now I can create a group, but I saw that some productIds in my deviceList are not the same, what make they different? Is there a unique productId for each deviceList?

0x5e commented 5 years ago

productId represents the type of product, devId represents the unique id of the specific device. For example, Smart plug A and Smart plug B have the same productId, but different devId.

Coiado commented 5 years ago

I see, but if I try to create my own group with a plug and a lamp, which productId should I use? Because everytime I create a group with different devices I have the Error: "No permission", I can only create group with the same devices?

0x5e commented 5 years ago

Yes, different product can't in same group.

Coiado commented 5 years ago

Okay, thank you very much for your help!