question

SpiderKenny avatar image
SpiderKenny asked ·

The right way to do MQTT?

I have started work on an Smart Home Skill that will allow control of my Client's smart home lighting products. The products connect to my client's cloud and can be discovered by sending MQTT messages to their cloud server. Also the devices are controlled by sending messages to their MQTT server.

So my question - what is the right way to include MQTT into my lambda function?

Do I just find a suitable JS implementation for MQTT and include it in my lambda, or is there a better way? (I dunno, like has Amazon already provided an MQTT module I can link into?)

I am very comfortable with MQTT and have many IoT implementations on other platforms, but I am new to AWS / Alexa / Lambda.

alexa smart homesmart home
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

roy-1 avatar image
roy-1 answered ·

Hi SpiderKenny,

Thanks for posting! From the set-up that you've described, the Lambda function for your Smart Home skill would be communicating with the device cloud in order to process directives/requests from Alexa. The device cloud would continue communicating with the endpoints via MQTT and however you've currently got that configured.

2 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello,
I'm new here and also try to create a skill to control smart home device at home. This should also work with MQTT, but for this i need to insert an ID, which should be used as topic for the messages in the skill. Is there any posibility to give this ID or any data in general, while aktivating the skill / while account linking?


0 Likes 0 ·
roy-1 avatar image roy-1 newuser-41675ba5-65a7-492f-be36-3de2c44d44fa ·

Hello,

Is the purpose of the ID to uniquely identify the device? If so, you'd set this as the 'endpointId' property, along with the endpoints other details, during device discovery. If it is just for reference, you can include it in the 'cookie' section:

https://developer.amazon.com/docs/device-apis/alexa-discovery.html

0 Likes 0 ·