question

Ofir avatar image
Ofir asked

Can't make ChangeReport work

Hi,

I'm developing V3 smart home skill. I've developed the ReportState->StateReport, and in the discovery response, I've set proactivelyReported=false and retrievable=true.

With that configuration, everything works fine. I can see that when I'm observing some device in my Alexa app, my lambda getting lots of ReportState requests.

I tried to move to proactive reporting. In the discovery, I've changed proactivelyReported=true, and started to send ChangeReport to the Alexa gateway. I'm getting 202 response from Amazon, so it seems like my request passed credentials validations. I've also validated my response using the Validation Schema. I don't see any problem here.

My first question is, even when I'm sending proactive ChangeReport, my lambda still getting lots of ReportState request when I'm using the Alexa app. I've expected to have much less requests of that kind. Why do I get so many?

Another question, when I'm setting proactivelyReported=true and retrievable=false, my Alexa app says that there is a problem with the device, and my ChangeReport not changing the status of my devices in the Alexa app, so it seems like my proactive report have no affect.

Anyone know what might be wrong with my implementation?

Example of my ChangeReport:

{
   "context":{
      "properties":[
         {
            "value":"ON",
            "namespace":"Alexa.PowerController",
            "name":"powerState",
            "timeOfSample":"2017-11-24T19:24:42.2003916Z",
            "uncertaintyInMilliseconds":1000
         },
         {
            "value":{
               "value":"OK"
            },
            "namespace":"Alexa.EndpointHealth",
            "name":"connectivity",
            "timeOfSample":"2017-11-24T19:24:42.2003916Z",
            "uncertaintyInMilliseconds":1000
         }
      ]
   },
   "event":{
      "header":{
         "messageId":"cd26732c-0084-45ac-860d-f96192aedfa3",
         "name":"ChangeReport",
         "namespace":"Alexa",
         "payloadVersion":"3"
      },
      "endpoint":{
         "scope":{
            "token":"xxxxx",
            "type":"BearerToken"
         },
         "endpointId":"2058"
      },
      "payload":{
         "change":{
            "cause":{
               "type":"PERIODIC_POLL"
            },
            "properties":[


            ]
         }
      }
   }
}
alexa smart home
1 comment
10 |5000

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

ping... anyone?

0 Likes 0 ·
Bjoern avatar image
Bjoern answered

(1)

You have to send "ChangeReport" only proactive (but they do not seem to habe any effect right now). As answer to a "ReportState" request you need to respond with a "StateReport" response.

See example here: https://github.com/alexa/alexa-smarthome/tree/master/sample_messages/StateReport

(2)

"Another question, when I'm setting proactivelyReported=true and retrievable=false"

I can confirm this here. Once retrievable is set to false (or not set) the app reports an error. So I guess proactivelyReported=true is not even implemented by today...

1 comment
10 |5000

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

Thanks Bjoern.

I guess that my question is actually about the affect of the proactive reporting. Why should I bother implement proactive reporting mechanism? What's the actual effect? If it's not implemented, why all the docs and explanations how to implement it?

1 Like 1 ·
Andreas Richiger avatar image
Andreas Richiger answered

Make the same observation.Same behavior until today. ChangeReports sent to alexa event gateway have no effect.

Is this still under development? Is there a road map?

10 |5000

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

Daniel P. avatar image
Daniel P. answered

We are facing the same problems.

The back end responds with a 201 Status Code when receiving a ChangeReport, but the app simply shows an error (if retrievable is set to false).

We also filed an issue on Github. because there is even some confusion as to how the json property is actually called:

https://github.com/alexa/alexa-smarthome/issues/34#issuecomment-357740366

1 comment
10 |5000

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

Hi,I met the same error. When I set retrievable=false then Alexa app will show "There was a problem" and I also using the Validation Schema to verify my ChangeReport response it's no error. When I sent the ChangeReport to the Alexa gateway I received an 202 response from Alexa but the device status doesn't change. Have you solved it

0 Likes 0 ·
merossdeveloper avatar image
merossdeveloper answered

Hi guys we encounter the exactly same problem as you described, is there any new progress?? Do you solve it already??

10 |5000

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

chuckc192000 avatar image
chuckc192000 answered

I want to use proactive reporting exclusively -- with the current architecture of my smart home device, it would be very difficult to implement state report responses. But even with proactivelyReport=true and retrievable=false, Alexa still sends reportState messages when asked about the state of the device via voice questions, and reports the device as unreachable if stateReport replies are not sent in response. The proactive change reports are working because I get a 202 response for them and the values sent by change reports are correctly shown using Amazon's state reporting tool. It appears that sending proactive change reports is useless because they are ignored -- reportState messages are ALWAYS sent no matter what.

10 |5000

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

newuser-f1bfb778-2438-4a60-910b-dcb223e3011c avatar image
newuser-f1bfb778-2438-4a60-910b-dcb223e3011c answered
Can someone from Amazon confirm what is the status of ChangeReport events in Alexa Smart Home? Is it really working? I have same observations as mentioned above. Tons of documents, but nothing is working around ChangeReport event. Please respond.
1 comment
10 |5000

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

We are using change reports, but not in production, yet, with

"proactivelyReported" : true, 
"retrievable" : true,

FWIW: A HTTP 202 response code does mean your ChangeReport payload is well formed. It seems to be little more than an ACK.


0 Likes 0 ·
Chris Bannan avatar image
Chris Bannan answered

Below is a correctly formatted ChangeReport for a Contact Sensor. It is used in an Alexa App routine that makes Alexa talk, so I can hear it working


 "event": {
    "header": {
      "messageId": "557f8c38-a36e-428b-b3d6-db6678cf8db6",
      "namespace": "Alexa",
      "name": "ChangeReport",
      "payloadVersion": "3"
    },
    "payload": {
      "change": {
        "cause": {
          "type": "PHYSICAL_INTERACTION"
        },
        "properties": [
          {
            "namespace": "Alexa.ContactSensor",
            "name": "detectionState",
            "timeOfSample": "2019-03-21T16:40:03Z",
            "uncertaintyInMilliseconds": 100,
            "value": "DETECTED"
          }
        ]
      }
    },
    "endpoint": {
      "endpointId": "204506798:1:s",
      "scope": {
        "type": "BearerToken",
        "token": "your-token-here"
      }
    }
  }
}


Here is a doorbell change report. Note the difference in the "namespace"

I know this works because the Alexa app verbally announces the doorbell press

{
  "event": {
    "header": {
      "messageId": "afc62aa7-85bc-4565-bac5-cd49748931c5",
      "namespace": "Alexa.DoorbellEventSource",
      "name": "DoorbellPress",
      "payloadVersion": "3"
    },
    "payload": {
      "cause": {
        "type": "PHYSICAL_INTERACTION"
      },
      "timestamp": "2019-03-21T16:56:32Z"
    },
    "endpoint": {
      "endpointId": "204506798:0:c",
      "scope": {
        "type": "BearerToken",
        "token": "your-token-here"
      }
    }
  }
}
10 |5000

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

dmcamens avatar image
dmcamens answered

I have run into the same problem. Does proactive state reporting work in Alexa?

10 |5000

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

newuser-c8fb7afa-6d33-4998-9a86-c65da13e21a0 avatar image
newuser-c8fb7afa-6d33-4998-9a86-c65da13e21a0 answered

I was having exactly the same issues, I solved them by implementing endpointHealth interface and sending this state in the context.

10 |5000

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

debugging avatar image
debugging answered

Encountering the same problems with retrievable set to yes (I will receive reportState request) or no (not getting reportState Request unless I press the On/off icon in the app), the Gateway responses with a 202. but the state in the App does not change. Report send is:

{"event": {"header": {"messageId": "123456", "namespace": "Alexa", "name": "ChangeReport", "payloadVersion": "3"}, "endpoint": {"endpointId": "demo_id2", "cookie": {}, "scope": {"type": "BearerToken", "token": "Atza|IXXXXXXXXIG9TtllOb3uE1TF......RI7BEvqroDwsztQTg"}}, "payload": {"change": {"cause": {"type": "PHYSICAL_INTERACTION"}, "properties": [{"namespace": "Alexa.PowerController", "name": "powerState", "value": "ON", "timeOfSample": "2019-08-13T16:20:50Z", "uncertaintyInMilliseconds": 500}]}}, "context": {"properties": [{"namespace": "Alexa.EndpointHealth", "name": "connectivity", "value": {"value": "OK"}, "timeOfSample": "2019-08-13T16:20:50Z", "uncertaintyInMilliseconds": 0}]}}}

when sending the change, Alexa does not immediately call back my API cloud's endpoint to confirm the state . In the screen with the list of all controler, Alexa calles about every 10 seconds whil in the individual switch screen around every 5secs. This is working because whenI manuall change the state in StateReport, the app updates the state correctly. I added the endpointHealh as mentioned above but that did not have any effect. I am sure the AccessToken in the Change request is correct because it sometimes expires (and I refresh it) and the region endpoint is correct as well otherwise the Gateway will return an error.

Update: As I noticed in the github issue, it could be due to "whitelisting" I also tried to call it from the cloud service server itself (domain) instead of a client PC, but it is still not working.

As a side note: when retrievable is set to "no" but proactivelyReports is "yes" and thus the device can report state through the gateway then why is there no status icon in the app ,either "ON" , "OFF" or disabled status icon ? It would really be helpful and logical to have that to see the status (change) having effect.


1 comment
10 |5000

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

Hello and thank you for your message.

Can you please share the discovery response that your skill is sending back to Alexa, so I can help you further?

Regards,
Barry

-1 Like -1 ·