Haaska implements the deprecated v2 Smart Home API, which can no longer be selected for new skills without some hackery.
Home Assistant Cloud is an alternative, but it's only available in the US.
Fortunately, the Home Assistant developers are awesome and all the logic is in Home Assistant, not hidden in the cloud. It's pretty easy to expose it via an HTTP POST interface which is easily integrated with a Lambda function.
Add to homeassistant/components/alexa/smart_home.py
@ha.callback
def async_setup(hass, config):
hass.http.register_view(SmartHomeView)
class SmartHomeView(http.HomeAssistantView):
url = '/api/alexa_smart_home'
name = 'wtf:isthis'
@asyncio.coroutine
def post(self, request):
"""Handle Alexa."""
hass = request.app['hass']
message = yield from request.json()
_LOGGER.debug("Received Alexa request: %s", message)
response = yield from async_handle_message(hass, Config(lambda entity_id: True), message)
return b'' if response is None else self.json(response)
And in async_setup in homeassistant/components/alexa/__init__.py
, call the setup function for the view above:
smart_home.async_setup(hass, None)
Restart hass
and you should be able to post to http://YOUR_HASS_IP/api/alexa_smart_home
.
Try a discovery message.
If you've already set up haaska, a quick and dirty solution is to replace the event handler with:
def event_handler(event, context):
config = Configuration('config.json')
if config.debug:
logger.setLevel(logging.DEBUG)
ha = HomeAssistant(config)
return ha.post('alexa_smart_home', event, wait=True).json()
I'll be making PRs for these things as soon as I learn enough about home-assistant to remove some of the hacks.