the event and content are this:
`[DEBUG] 2017-12-18T16:13:10.667Z 577c52e0-e40e-11e7-80f8-71ef51a2c9f6
! event {'directive': {'header': {'namespace': 'Alexa.Discovery', 'name': 'Discover', 'payloadVersion': '3', 'messageId': 'ee7e2153-b454-4418-a149-aa5d760c229c'}, 'payload': {'scope': {'type': 'BearerToken', 'token': 'Atza|IwEBIAQ5ViB_uNAEFNtwozmc718lWgQl0916gkht215doUyO28IXyyeSyYbYYwk7-LBvRisgpteSOsoPPyz9d-HRTY0CnBYcHwDAGMeXZrghrgS_QHyQ-AhwsN9-W0z3L7vn8RNSQIfTeh3hsdSVRA46uVXFffqYHoEOtyijW2HoacJqMVeETNWrcF0_CRI1lqtTN-3XNeR_fQqjppaBGdXJbMiCkIALVFosFu-3nboOU1jOBgmIj-dybVH4RC2dvtCYCnFkGDSQdtFoK39xioObvaJXzEY81BKj7gxAj0EJqtSVu63IpfI5FiuFO0c5IA1Xz30CjVLhu6e5vm2VqW09Om8Dovfok1-xdTtQ5ZOMVJux7ROLHh--ECHU_Y0zykbLPjvnLpUvsYmlF5UjKISyKVHtJNe4byol9Q5b-B7GpuwW047G4e4_lv8s5KfYDaLGYPU4K7wuxL8hOq4iKMrs3F4QF_blDp7oWf9rt9Oy0UQ-me-JWKWhC41cs2k0dX1xXms'}}}}
[DEBUG] 2017-12-18T16:13:10.667Z 577c52e0-e40e-11e7-80f8-71ef51a2c9f6
! context <main.LambdaContext object at 0x7fab538ba630>
The Json seems to have an outer extra bracket 'directive', which is not intended in the program.
i added this line
event = event['directive']name = event['header']['name']payload = event['payload']
and got a new error from invoke(namespace, name, ha, context)
type object 'Alexa' has no attribute 'Discovery': AttributeError
Traceback (most recent call last):
File "/var/task/haaska.py", line 673, in event_handler
ha, payload)
File "/var/task/haaska.py", line 294, in invoke
obj = make_class(allowed)(namespace, name, ha, context)
AttributeError: type object 'Alexa' has no attribute 'Discovery'
Hallo
i get an KeyError: 'header' in the haaska event_handler when alexa discover new devices and i hav no ideas whats wrong.
'header': KeyError Traceback (most recent call last): File "/var/task/haaska.py", line 664, in event_handler name = event['header']['name'] KeyError: 'header'`
def event_handler(event, context):
. . . .
logger.debug('\n')
logger.debug('\n! event %s', event)
logger.debug('\n! context %s', context)
`
name = event['header']['name']the event and content are this: `[DEBUG] 2017-12-18T16:13:10.667Z 577c52e0-e40e-11e7-80f8-71ef51a2c9f6 ! event {'directive': {'header': {'namespace': 'Alexa.Discovery', 'name': 'Discover', 'payloadVersion': '3', 'messageId': 'ee7e2153-b454-4418-a149-aa5d760c229c'}, 'payload': {'scope': {'type': 'BearerToken', 'token': 'Atza|IwEBIAQ5ViB_uNAEFNtwozmc718lWgQl0916gkht215doUyO28IXyyeSyYbYYwk7-LBvRisgpteSOsoPPyz9d-HRTY0CnBYcHwDAGMeXZrghrgS_QHyQ-AhwsN9-W0z3L7vn8RNSQIfTeh3hsdSVRA46uVXFffqYHoEOtyijW2HoacJqMVeETNWrcF0_CRI1lqtTN-3XNeR_fQqjppaBGdXJbMiCkIALVFosFu-3nboOU1jOBgmIj-dybVH4RC2dvtCYCnFkGDSQdtFoK39xioObvaJXzEY81BKj7gxAj0EJqtSVu63IpfI5FiuFO0c5IA1Xz30CjVLhu6e5vm2VqW09Om8Dovfok1-xdTtQ5ZOMVJux7ROLHh--ECHU_Y0zykbLPjvnLpUvsYmlF5UjKISyKVHtJNe4byol9Q5b-B7GpuwW047G4e4_lv8s5KfYDaLGYPU4K7wuxL8hOq4iKMrs3F4QF_blDp7oWf9rt9Oy0UQ-me-JWKWhC41cs2k0dX1xXms'}}}} [DEBUG] 2017-12-18T16:13:10.667Z 577c52e0-e40e-11e7-80f8-71ef51a2c9f6 ! context <main.LambdaContext object at 0x7fab538ba630>
The Json seems to have an outer extra bracket 'directive', which is not intended in the program.
i added this line
event = event['directive']
name = event['header']['name']
payload = event['payload']
and got a new error from invoke(namespace, name, ha, context)
type object 'Alexa' has no attribute 'Discovery': AttributeError Traceback (most recent call last): File "/var/task/haaska.py", line 673, in event_handler ha, payload) File "/var/task/haaska.py", line 294, in invoke obj = make_class(allowed)(namespace, name, ha, context) AttributeError: type object 'Alexa' has no attribute 'Discovery'