Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make intents end Snips session without speech #28820

Merged
merged 3 commits into from Nov 18, 2019

Conversation

@Romkabouter
Copy link
Contributor

Romkabouter commented Nov 16, 2019

Description:

The snips component did not end a session when speech was not configured on an intent_script.
This led to session timeout.
I have changed this behaviour to always end the session and add speech if configured

Checklist:

  • [x ] The code change is tested and works locally.
  • [x ] Local tests pass with tox. Your PR cannot be merged unless tests pass
  • [x ] There is no commented out code in this PR.
  • [x ] I have followed the [development checklist][dev-checklist]
@Santobert

This comment has been minimized.

Copy link
Member

Santobert commented Nov 16, 2019

I don't think we should end all sessions. However, I agree that we should be able to end sessions without saying anything. But we should only end those sessions that have been handled successfully before. A session that cannot be handled by HA should not be ended.

@Romkabouter

This comment has been minimized.

Copy link
Contributor Author

Romkabouter commented Nov 17, 2019

Good point, I have move the ending of the session to the try block.
This way, on an UnknownIntent or IntentError no endSession is published. PLease check my latest commit

Copy link
Member

Santobert left a comment

A minor improvement

notification = {"sessionId": request.get("sessionId", "default")}

if snips_response:
notification["text"] = snips_response

This comment has been minimized.

Copy link
@Santobert

Santobert Nov 17, 2019

Member

Can we move this line up into ‘if "plain" in ...‘?

This comment has been minimized.

Copy link
@Romkabouter

Romkabouter Nov 17, 2019

Author Contributor

Yes, but notification should come above it.
Like so:

            notification = {"sessionId": request.get("sessionId", "default")}

            if "plain" in intent_response.speech:
                notification["text"] = intent_response.speech["plain"]["speech"]

This comment has been minimized.

Copy link
@Romkabouter

Romkabouter Nov 17, 2019

Author Contributor

If agreed I can commit it.

This comment has been minimized.

Copy link
@Santobert

Santobert Nov 17, 2019

Member

Agreed. Do we need snips_response at all? Maybe we can remove this dict completely?

This comment has been minimized.

Copy link
@Romkabouter

Romkabouter Nov 17, 2019

Author Contributor

Yes, I already did :)
Committing now and pushing

@MartinHjelmare MartinHjelmare changed the title Intents should also end Snips session without speech Make intents end Snips session without speech Nov 17, 2019
Copy link
Member

Santobert left a comment

Thanks. Looks good now 👍

Dev automation moved this from Needs review to Reviewer approved Nov 17, 2019
@pvizeli pvizeli merged commit 5731f52 into home-assistant:dev Nov 18, 2019
11 checks passed
11 checks passed
CI Build #20191117.5 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing d6e99db...aec43e8
Details
codecov/project 94.44% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Nov 18, 2019
@lock lock bot locked and limited conversation to collaborators Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
4 participants
You can’t perform that action at this time.