Accessing rooms using the tuya-device-sharing-sdk

Discussing technical aspects of Yun development products, including IoT Core and other cloud service APIs, data analysis products, etc.


Post Reply
novusdash123
Posts: 5

Hello. We are working on an integration for Home Assistant that connects to tuya energy metering devices. We are using the official tuya-device-sharing-sdk for this: https://github.com/tuya/tuya-device-sharing-sdk.

For now, this sdk offers everything we need except the ability to query rooms. It currently has an option to query homes and query devices by home, but it does not support rooms. Is there a way to query rooms using this same SDK? If not, is it possible for the Tuya team to add this functionality into the SDK?

JamesG
Posts: 75

Re: Accessing rooms using the tuya-device-sharing-sdk

Hello. The home and room hierarchy belongs to the data model of the Tuya app, not Home Assistant. Please use the local configuration within Home Assistant if you need relevant room data models.

novusdash123
Posts: 5

Re: Accessing rooms using the tuya-device-sharing-sdk

Thank you for your reply. The room/home data hierarchy does indeed belong to the tuya smart app. Since we are building an integration that would make use of this data and sync it to home assistant, we need access to them. The home data is already accessible by default using the previously mentioned tuya-device-sharing-sdk, but room is not. What I need is a way to also fetch the room data in the same way so that I can sync them between the tuya smart app and home assistant (the same way it is currently available for home).

novusdash123
Posts: 5

Re: Accessing rooms using the tuya-device-sharing-sdk

I also claim that adding this feature will be very useful for lots of integrations in home assistant as this will allow them to get access to this important data hierarchy, including the official tuya integration as well.

JamesG
Posts: 75

Re: Accessing rooms using the tuya-device-sharing-sdk

Could you elaborate on how you intend to use the room data in Home Assistant?

novusdash123
Posts: 5

Re: Accessing rooms using the tuya-device-sharing-sdk

Sure. Currently the default tuya integration does not group devices into hierarchies the same way they are grouped in the tuya app. For example if I have a 100 devices that are grouped into 2 homes and 5 rooms for each home, they will just be all mixed together in Home Assistant. An option to handle this is to manually group the devices into Floors and Areas (the native way to group devices in Home Assistant). This works, but every time I need to add a device or move it to another home, I will need to manually add the device or move it in Home Assistant. For this reason, it would make sense to sync rooms/homes to Home Assistant (for example homes -> floors and rooms -> areas).

Other ways to utilize this data can be possible, for example grouping devices in the same room into one dashboard, or allowing home assistant to turn on/off all devices in a specific room using a custom integration... The ways this can be utilized by integration developers is countless, these are few ideas that comes to mind. The first use case is what I am personally trying to achieve.

JamesG
Posts: 75

Re: Accessing rooms using the tuya-device-sharing-sdk

Okay, got it. We will discuss this scenario next week and get back to you later.

novusdash123
Posts: 5

Re: Accessing rooms using the tuya-device-sharing-sdk

thanks

Post Reply