newuser-7766e5f4-705e-4ebe-8087-5d6a37e54b14 avatar image

How to receive update message without starting mobile app?


I have created an Skill based on Alexa Smart Home Skill API and try to update my blinds (range controll) using AWSIoTPythonSDK. The devices will be discovered via Alexa.Discovery export method and can be activated on my mobile app. So I can use my echo .dot device to change the values via voice control and can see the changed value on the mobile app.

I have created the corresponding thing and update the rangeValue of the shadow with iotData.updateThingShadow inside of handleSetRangeValue function on Lambda service. I was able to successfully change the shadow values, get subscribed mqtt messages on my linux device and see the corresponding log entries.

The problem is that it only works if the mobile app is activated and i'm showing the discovered device on my mobile phone. It is not working when my mobile phone is not showing the alexa app. In that case I only see, that the handleSetRangeValue will be executed in the logs but the shadow document will not be updated and I do not see any subscribed mqtt message. So I tryed many time to change the value via echo .dot and get the changed value via asking amazon echo to get the current opening value but the shadow object is still not updated.

After I open the device on my mobile phone, everything will be synchronized, the shadow object will be updated and I get the mqtt message...

I just want to use the amazon dot without to need to use my mobile phone... Please help, I already seat 3 days on this problem seen many tutorials and there are no hints...

function handleSetRangeValue(request, context) {
var payloadObj= { "state": { "desired": {"rangeValue": newrange} } };        
//Prepare the parameters of the update call        
var paramsUpdate = { "thingName": thingName,  "payload": JSON.stringify(payloadObj)};      iotData.updateThingShadow(paramsUpdate, function(err, data) {          
  log("DEBUG", "Alexa.RangeController handleSetRangeValue execdata:", data);
  if (err) {           
    log("DEBUG", "Alexa.RangeController handleSetRangeValue error update Think shadow", err);         
  else {            
    log("DEBUG", "Alexa.RangeController handleSetRangeValue succ update shadow", data);      }          

mobile adsdevicessmart homedevice discoveryskill connections
10 |5000

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

1 Answer

Jason@Amazon avatar image
Jason@Amazon answered

The smart home skill API generally works with Alexa sending a directive to your Lambda function. Once your Lambda function receives this directive, it controls the device (using whatever device cloud you use to control the device) and then sends a response back to Alexa to confirm whether or not the directive succeeded.

If the device cloud cannot respond to the API calls whenever your Lambda function receives a directive, in this case if your device cloud/mobile app needs to be open in order to respond and control the device, this is something you need to figure out on your backend. Usually a device cloud should be able to be accessed using the cloud and controlled with APIs - as this is the Alexa Developer Forum, we focus on the Alexa side of skill building, but if you are having issues with the AWS IoT side then I would recommend reaching out to AWS for more details there.

10 |5000

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