lambda_master_handler module

class lambda_master_handler.MasterHandler[source]
docstring create a master handler project, create a logger as well as an mqtt manager for mqtt related task
param self:the instance of MasterHandler class
_expectedTopic = ''

the topic that the master handler is expecting to receive from, the _replyReceived flag is only set if the expected topic mateched the received topic

_logger = None

Instance of logger used for logging purpose

_mqttManager = None

Instance of an mqtt manager, used by the master handler for communicating with aws mqtt

_replyMessage = ''

message received by mqtt callback function

_replyReceived = False

flags used for signalling if the correct reply has been received by mqtt callback function

getApplicanceByMessage(message)[source]
Parse the message sent by Alexa for the target endpoint ID and then look for that endpoint in the database list in the mqtt manager
param self:instance of master handler
param message:the message received by lambda handler from Alexa
handleDiscoveryV3(request)[source]
Used to handle discovery request, which lets Alexa know the list of devices that is available and what they can do
param self:the instance of master hander
param request:the request received by the lambda handler
handleErrorResponse(request, errorType, errorMessage)[source]
Used for creating a response to Amazon that indicates something wrong has happened
param self:instance of master handler
param request:the request received by lambda handler
param errorType:
 type of error encountered, limited number of types supported
param errorMessage:
 error message to be included in the payload
handleNonDiscoveryV3(request, context)[source]
Most requests are handled here, the handler will parse the necessary detail, forward it to the correct devices(using endpoint-ID to identify who to send to), wait for repy and then either timeout or tranlsate the reply of the IoT device into something that Alexa can understand and then hand it to the original lambda_handler in lambda_main
param self:instance of master handler
param request:the request received by lambda handler
param context:execution contex, not used
static subCallBack(client, userdata, message)[source]
The mqtt subscribe callback function, used for receiving messages from the IoT devices
param client:derpecated param
param userdata:deperated param
param message:an object that contains the main payload as well as the topic that payload comes from