I managed to integrate home assistant and Alexa successfully following the guide available in Amazon Alexa Smart Home Skill - Home Assistant, after i connected the skill to Alexa, all devices were found as it is supposed to, but when i tried to turn on of off in the app, there was no option. After trying for a long time i noticed that all the SWITCHES (maybe LIGHTs too) were not coming with PowerController capability, as you can see bellow (“capabilities”: []).
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"messageId": "bbb8241c-34c5-4fb8-89f9-d2b332597b72",
"payloadVersion": "3"
},
"payload": {
"endpoints": [
{
"displayCategories": [
"SWITCH"
],
"cookie": {},
"endpointId": "switch#luz_da_entrada",
"friendlyName": "Luz da Entrada",
"description": "switch.luz_da_entrada via Home Assistant",
"manufacturerName": "Home Assistant",
"additionalAttributes": {
"manufacturer": "Home Assistant",
"model": "switch",
"softwareVersion": "2021.10.6",
"customIdentifier": "-switch.luz_da_entrada"
},
"capabilities": []
},
...
Does anyone have the same problem?
I made a workaround in the lambda function adding the code below at the end, but i don’t think its the best option, but its working.
Does anyone know why could it be happening? has any definitive solution?
resposta = json.loads(response.data.decode('utf-8'))
powerController = {'interface': 'Alexa.PowerController',
'properties': {'proactivelyReported': True,
'retrievable': True,
'supported': [{'name': 'powerState'}]},
'type': 'AlexaInterface',
'version': '3'}
endpointHealth = {'interface': 'Alexa.EndpointHealth',
'properties': {'proactivelyReported': True,
'retrievable': True,
'supported': [{'name': 'connectivity'}]},
'type': 'AlexaInterface',
'version': '3'}
for endpoint in resposta.get('event', {}).get('payload', {}).get('endpoints',{}): #['additionalAttributes']['model']
if endpoint.get('additionalAttributes',{}).get('model',{})=='switch':
if 'capabilities' in endpoint:
if type(endpoint['capabilities']) is list:
endpoint['capabilities'].append(powerController)
endpoint['capabilities'].append(endpointHealth)
return resposta