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

Migrate voice command dialog #4150

Merged
merged 7 commits into from Oct 29, 2019
Merged

Migrate voice command dialog #4150

merged 7 commits into from Oct 29, 2019

Conversation

bramkragten
Copy link
Member

@bramkragten bramkragten commented Oct 28, 2019

And add text input to also support browsers that don't support speech to text.
image

image

<ha-start-voice-button
.hass="${this.hass}"
></ha-start-voice-button>
<paper-icon-button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure it's only shown when the conversation integration is loaded.

hass="[[hass]]"
can-listen="{{canListen}}"
></ha-start-voice-button>
<paper-icon-button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

@@ -72,7 +72,11 @@ class PartialCards extends EventsMixin(NavigateMixin(PolymerElement)) {
<div main-title="">
[[computeTitle(views, defaultView, locationName)]]
</div>
<ha-start-voice-button hass="[[hass]]"></ha-start-voice-button>
<paper-icon-button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -554,6 +554,12 @@
}
},
"dialogs": {
"voice_command": {
"did_not_hear": "<Home Assistant did not hear anything>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move < and > out of the translations

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Ok to merge when comments addressed.

@@ -405,6 +411,11 @@ class HUIRoot extends LitElement {
];
}

protected firstUpdated(changedProperties: PropertyValues) {
super.updated(changedProperties);
this._conversation = isComponentLoaded(this.hass, "conversation");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. We should check it on every render. If a user installs Almond, we want this icon to show up. You could memoize it though on hass.config.components.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah of course 🤦‍♂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to create a new isComponentLoaded that takes hass.config.components and so is better to memoize.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to optimise it for states and shopping list or is checking it on every change of hass ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just care about Lovelace right now.


private _debouncedConfigChanged: () => void;

private _conversation = memoizeOne((_components) =>
isComponentLoaded(this.hass, "conversation")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hacky but Smart.

@balloob
Copy link
Member

balloob commented Oct 29, 2019

Going to merge this so I can use it in my demo :)

@balloob balloob merged commit 46f5224 into dev Oct 29, 2019
@delete-merged-branch delete-merged-branch bot deleted the voice-command-dialog branch October 29, 2019 21:59
@bramkragten bramkragten mentioned this pull request Nov 8, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants