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
Conversation
src/panels/lovelace/hui-root.ts
Outdated
<ha-start-voice-button | ||
.hass="${this.hass}" | ||
></ha-start-voice-button> | ||
<paper-icon-button |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/translations/en.json
Outdated
@@ -554,6 +554,12 @@ | |||
} | |||
}, | |||
"dialogs": { | |||
"voice_command": { | |||
"did_not_hear": "<Home Assistant did not hear anything>", |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
src/panels/lovelace/hui-root.ts
Outdated
@@ -405,6 +411,11 @@ class HUIRoot extends LitElement { | |||
]; | |||
} | |||
|
|||
protected firstUpdated(changedProperties: PropertyValues) { | |||
super.updated(changedProperties); | |||
this._conversation = isComponentLoaded(this.hass, "conversation"); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah of course 🤦♂
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hacky but Smart.
Going to merge this so I can use it in my demo :) |
And add text input to also support browsers that don't support speech to text.