Alexa Integration Error 500

Hello, i’m trying to add alexa to my HA but i will receive this error:
From HA.log:

Logger: aiohttp.server
First occured: 19:52:18 (1 occurences)
Last logged: 19:52:18

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/alexa/smart_home_http.py", line 120, in post
    hass, self.smart_home_config, message, context=core.Context(user_id=user.id)
  File "/usr/src/homeassistant/homeassistant/components/alexa/smart_home.py", line 41, in async_handle_message
    response = await funct_ref(hass, config, directive, context)
  File "/usr/src/homeassistant/homeassistant/components/alexa/handlers.py", line 82, in async_api_discovery
    for alexa_entity in async_get_entities(hass, config)
  File "/usr/src/homeassistant/homeassistant/components/alexa/handlers.py", line 83, in <listcomp>
    if config.should_expose(alexa_entity.entity_id)
  File "/usr/src/homeassistant/homeassistant/components/alexa/entities.py", line 282, in serialize_discovery
    capabilities.append(i.serialize_discovery())
  File "/usr/src/homeassistant/homeassistant/components/alexa/capabilities.py", line 199, in serialize_discovery
    capability_resources = self.capability_resources()
  File "/usr/src/homeassistant/homeassistant/components/alexa/capabilities.py", line 1471, in capability_resources
    min_value = float(self.entity.attributes[input_number.ATTR_MIN])
KeyError: 'min'

from AWS lambda:

{
  "event": {
    "payload": {
      "type": "INTERNAL_ERROR",
      "message": "500 Internal Server Error\n\nServer got itself in trouble"
    }
  }
}

HA Core is 0.106.6
If i downgrade to 0.100.1 works well.
Integration is Alexa Smart Home
Can someone help me?
Thanks a lot
Stefano.

Solved, thanks to github user from Homeassistant core.
There is an input_number value not correct.

Hi,
I have the same issue but i did not understand how you solved it. Can you please help me?

1 Like

Sorry for the delay… i have read now your message… have you solved?
You can also red from here the solution:

I am having this EXACT same issue, but my error in the log seems to be a little different

2020-09-02 11:25:46 DEBUG (MainThread) [homeassistant.components.alexa.smart_home_http] Received Alexa Smart Home request: {'directive': {'header': {'namespace': 'Alexa.Discovery', 'name': 'Discover', 'payloadVersion': '3', 'messageId': '4a35f6ec-8e27-447b-84bb-7b24c01fd3a6'}, 'payload': {'scope': {'type': 'BearerToken', 'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI4MGM2ZWNhMTFjZjk0M2VkYmRkNDA4NmZjZDMxMTQ2MSIsImlhdCI6MTU5OT'}}}}
2020-09-02 11:25:46 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/alexa/smart_home_http.py", line 113, in post
    response = await async_handle_message(
  File "/usr/src/homeassistant/homeassistant/components/alexa/smart_home.py", line 39, in async_handle_message
    response = await funct_ref(hass, config, directive, context)
  File "/usr/src/homeassistant/homeassistant/components/alexa/handlers.py", line 84, in async_api_discovery
    for alexa_entity in async_get_entities(hass, config)
  File "/usr/src/homeassistant/homeassistant/components/alexa/entities.py", line 307, in async_get_entities
    if not list(alexa_entity.interfaces()):
  File "/usr/src/homeassistant/homeassistant/components/alexa/entities.py", line 538, in interfaces
    inputs = AlexaInputController.get_valid_inputs(
  File "/usr/src/homeassistant/homeassistant/components/alexa/capabilities.py", line 769, in get_valid_inputs
    source.lower().replace("-", "").replace("_", "").replace(" ", "")
AttributeError: 'int' object has no attribute 'lower'

I had a similar problem. I was using a custom media player integration and the source names were integers (literally 1,2,3,4). I changed the source names in my integration to “One”, “Two”, “Three”, “Four”, for home assistant but mapped them back to integers for the back end api to understand. Now my Alexa integration works again :slight_smile:

In which file can I find these?