Page 1 of 1
[Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 29日 17:42
by Tran Manh Duy
I downloaded Get Push Messages by Pulsar (Node.js SDK) : https://developer.tuya.com/en/docs/iot/ ... fmtxp8yscg.
To get the device log,
I follow the steps:
- I run SDK
- When the device status changes (online/offline/change temperature..)
=> I can get real-time device log and show it in the console following the above tutorial.
For now, I'd like to get log data when calling the "homeCreate" event of "Home event" using the above SDK
I follow the steps:
- Run SDK
- Call "add home" API
=> But I cannot see any log after executing API success
Please let me know, How to get log data for "createHome" event using Node.js SDK
Thanks so much
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 30日 12:49
by panda-cat
First, you need to subscribe to the "homeCreate" event in the project "Message Service", and then authorize the project with the uid account source app or uid of the home you want to create. For the authorization process, please refer to: https://developer.tuya.com/en/docs/iot/ ... 71nu1sfmkl. Finally, call the interface to create a home with the corresponding uid and you will receive the home creation message. (There will be a delay in data synchronization during the authorization process, so you need to wait a few minutes after authorization.)
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 30日 19:27
by Tran Manh Duy
Hi Tuya team and panda cat
I follow the steps:
- Step 1: Subscribe to the "homeCreate" event in the project "Message Service"
- Step 2: Authorize the project with the uid account source app
- Step 3: Call the interface to create a home -> execute API success
Then, I checked the result, It's not been received message
Am I doing anything wrong at any step? Please let me know
Thanks
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 31日 09:37
by panda-cat
Since your scenario is not a device-type message, you can only use the production mode for now. In step 1, please use "Production Eviroment" and then subscribe to the "homeCreate" message. To receive messages, please use the server SDK and set the environment to env = MqEnv.PROD. For other information, please refer to: https://developer.tuya.com/en/docs/iot/ ... 09frvx48db and https://developer.tuya.com/en/docs/iot/ ... qcb6jb13rm
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 31日 11:09
by Tran Manh Duy
Hi panda-cat,
With env: TuyaWebsocket.env.TEST
=> I can only get the device log (online, offline, change status)
With env: TuyaWebsocket.env.PROD
=> I can only get home/room/user message log (create, update, delete )
So, I want to get both the device message log and home/room/user message log in an SDK project.
How to do it?
Is there an environment mode to get both?
Do I have to run 2 SDK projects to get 2 types of messages?
Please let me know the solution. Thanks
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 31日 13:51
by panda-cat
In the project's "Message Service -> Messaging Rules", you can turn off the "Test Environment", remove the configured test devices, and then enable only the "Production Environment" and subscribe to all the message types you need in it.
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Jul 31日 18:06
by Tran Manh Duy
I get most of the messages log from the API following your support
But with the "Add a device in the room" API, I cannot get the message log
I follow the steps:
=> After executing API successfully, I cannot see any message log in the console
Are the steps true?
Please let me know how to get the message log of "Add a device in the room" API
Thanks
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Aug 1日 09:47
by panda-cat
Sorry, there is no support for adding devices to the room so far. For specific supported message types, please refer to: https://developer.tuya.com/en/docs/iot/ ... qerli65a1u
Re: [Message Queue Service] How to receive message when call add home API
Posted: 2024年 Aug 1日 10:08
by Tran Manh Duy
I got it.
Thanks so much for supporting me