Proactive reporting for Amazon Alexa

tl;dr: Also report changes to entity-states asynchronously to Alexa, in order to be able to use them to trigger routines.


Right now, using Alexa is a quite synchronous thing - only when one requests Alexa to do something, the smarthome-API will be queried and the current status provided to Alexa.

This can also be seen in alexa/smart_home.py, where 'proactivelyReported': self.properties_proactively_reported(), always returns False. In the same file, there is also an explanation for this:

There are some additional fields allowed but not implemented here since
we've no use case for them yet:
  - proactively_reported

I would like to propose to rethink this as there is indeed a usecase for proactively telling Alexa when the state of things change.

As announced here [0], certain sensors can now be used in Alexa-routines if they follow the[“new Contact and Motion Sensor APIs” [1].

At first glance, it seems like we only need to declare entities with "proactivelyReported": true, report the entities state [2] and (that’s imho the new thing) report the state of endpoints asynchronously by sending Events to the Event Gateway [3].

Having this in place, we could have Alexa make play music when there is movement in a room.

Or - perhaps even more useful - have Alexa say a certain phrase when a (virtual) sensor is triggered. All without having to fiddle with Text to Speech-Gateways that then inject something using AVS.


As I can only post 2 links as a new user, please find all the references links [0] through [3] here: https://gist.github.com/pc-coholic/d1fa20180350bbb518a858bf20764ba3

Oh well - seems like I didn’t search through the PR well enough - there is already someone working on it :slight_smile: