Merge pull request #11867 from home-assistant/dev

This commit is contained in:
Paulus Schoutsen 2022-02-26 13:41:41 -08:00 committed by GitHub
commit 8882624618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 49 additions and 45 deletions

View File

@ -2,6 +2,6 @@
from pathlib import Path from pathlib import Path
def where(): def where() -> Path:
"""Return path to the frontend.""" """Return path to the frontend."""
return Path(__file__).parent return Path(__file__).parent

0
public/py.typed Normal file
View File

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = home-assistant-frontend name = home-assistant-frontend
version = 20220224.0 version = 20220226.0
author = The Home Assistant Authors author = The Home Assistant Authors
author_email = hello@home-assistant.io author_email = hello@home-assistant.io
license = Apache-2.0 license = Apache-2.0
@ -19,3 +19,8 @@ python_requires = >= 3.4.0
[options.packages.find] [options.packages.find]
include = include =
hass_frontend* hass_frontend*
[mypy]
python_version = 3.4
show_error_codes = True
strict = True

View File

@ -52,19 +52,21 @@ class MoreInfoMediaPlayer extends LitElement {
return html` return html`
<div class="controls"> <div class="controls">
<div class="basic-controls"> <div class="basic-controls">
${controls!.map( ${!controls
(control) => html` ? ""
<ha-icon-button : controls.map(
action=${control.action} (control) => html`
@click=${this._handleClick} <ha-icon-button
.path=${control.icon} action=${control.action}
.label=${this.hass.localize( @click=${this._handleClick}
`ui.card.media_player.${control.action}` .path=${control.icon}
)} .label=${this.hass.localize(
> `ui.card.media_player.${control.action}`
</ha-icon-button> )}
` >
)} </ha-icon-button>
`
)}
</div> </div>
${supportsFeature(stateObj, SUPPORT_BROWSE_MEDIA) ${supportsFeature(stateObj, SUPPORT_BROWSE_MEDIA)
? html` ? html`

View File

@ -145,7 +145,7 @@ export class HaDeviceAction extends LitElement {
static styles = css` static styles = css`
ha-device-picker { ha-device-picker {
display: block; display: block;
margin-bottom: 24px; margin-bottom: 16px;
} }
ha-device-action-picker { ha-device-action-picker {
display: block; display: block;

View File

@ -50,7 +50,7 @@ export class HaEventAction extends LitElement implements ActionElement {
<ha-yaml-editor <ha-yaml-editor
.hass=${this.hass} .hass=${this.hass}
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.automation.editor.actions.type.event.service_data" "ui.panel.config.automation.editor.actions.type.event.event_data"
)} )}
.name=${"event_data"} .name=${"event_data"}
.defaultValue=${event_data} .defaultValue=${event_data}

View File

@ -162,8 +162,8 @@ export class HaRepeatAction extends LitElement implements ActionElement {
return [ return [
haStyle, haStyle,
css` css`
ha-select { ha-textfield {
margin-top: 8px; margin-top: 16px;
} }
`, `,
]; ];

View File

@ -33,7 +33,6 @@ export class HaWaitForTriggerAction
.value=${timeout || ""} .value=${timeout || ""}
@change=${this._valueChanged} @change=${this._valueChanged}
></ha-textfield> ></ha-textfield>
<br />
<ha-formfield <ha-formfield
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.automation.editor.actions.type.wait_for_trigger.continue_timeout" "ui.panel.config.automation.editor.actions.type.wait_for_trigger.continue_timeout"

View File

@ -117,8 +117,8 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
); );
const data = { const data = {
mode_before: "value", mode_before: inputModeBefore ? "input" : "value",
mode_after: "value", mode_after: inputModeAfter ? "input" : "value",
...this.condition, ...this.condition,
}; };
@ -137,18 +137,11 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
ev.stopPropagation(); ev.stopPropagation();
const newValue = ev.detail.value; const newValue = ev.detail.value;
const newModeAfter = newValue.mode_after === "input"; this._inputModeAfter = newValue.mode_after === "input";
const newModeBefore = newValue.mode_before === "input"; this._inputModeBefore = newValue.mode_before === "input";
if (newModeAfter !== this._inputModeAfter) { delete newValue.mode_after;
this._inputModeAfter = newModeAfter; delete newValue.mode_before;
newValue.after = undefined;
}
if (newModeBefore !== this._inputModeBefore) {
this._inputModeBefore = newModeBefore;
newValue.before = undefined;
}
Object.keys(newValue).forEach((key) => Object.keys(newValue).forEach((key) =>
newValue[key] === undefined || newValue[key] === "" newValue[key] === undefined || newValue[key] === ""

View File

@ -17,7 +17,7 @@ import {
PropertyValues, PropertyValues,
TemplateResult, TemplateResult,
} from "lit"; } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import "../../../components/ha-card"; import "../../../components/ha-card";
import "../../../components/ha-icon-next"; import "../../../components/ha-icon-next";
@ -118,6 +118,8 @@ class HaConfigDashboard extends LitElement {
@property() public showAdvanced!: boolean; @property() public showAdvanced!: boolean;
@state() private _tip?: string;
private _notifyUpdates = false; private _notifyUpdates = false;
protected render(): TemplateResult { protected render(): TemplateResult {
@ -204,7 +206,7 @@ class HaConfigDashboard extends LitElement {
<div class="tips"> <div class="tips">
<ha-svg-icon .path=${mdiLightbulbOutline}></ha-svg-icon> <ha-svg-icon .path=${mdiLightbulbOutline}></ha-svg-icon>
<span class="tip-word">Tip!</span> <span class="tip-word">Tip!</span>
<span class="text">${randomTip(this.hass)}</span> <span class="text">${this._tip}</span>
</div> </div>
</ha-config-section> </ha-config-section>
</ha-app-layout> </ha-app-layout>
@ -214,6 +216,10 @@ class HaConfigDashboard extends LitElement {
protected override updated(changedProps: PropertyValues): void { protected override updated(changedProps: PropertyValues): void {
super.updated(changedProps); super.updated(changedProps);
if (!this._tip && changedProps.has("hass")) {
this._tip = randomTip(this.hass);
}
if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) { if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) {
return; return;
} }

View File

@ -289,6 +289,12 @@ class HaPanelDevTemplate extends LitElement {
.rendered.error { .rendered.error {
color: var(--error-color); color: var(--error-color);
} }
@media all and (max-width: 870px) {
.render-pane {
max-width: 100%;
}
}
`, `,
]; ];
} }

View File

@ -25,6 +25,7 @@ export class BrowserMediaPlayer {
private onChange: () => void private onChange: () => void
) { ) {
const player = new Audio(this.resolved.url); const player = new Audio(this.resolved.url);
player.autoplay = true;
player.volume = volume; player.volume = volume;
player.addEventListener("play", this._handleChange); player.addEventListener("play", this._handleChange);
player.addEventListener("playing", () => { player.addEventListener("playing", () => {
@ -33,15 +34,7 @@ export class BrowserMediaPlayer {
}); });
player.addEventListener("pause", this._handleChange); player.addEventListener("pause", this._handleChange);
player.addEventListener("ended", this._handleChange); player.addEventListener("ended", this._handleChange);
player.addEventListener("canplaythrough", () => { player.addEventListener("canplaythrough", this._handleChange);
if (this._removed) {
return;
}
if (this.buffering) {
player.play();
}
this.onChange();
});
this.player = player; this.player = player;
} }

View File

@ -1863,7 +1863,7 @@
"event": { "event": {
"label": "Fire event", "label": "Fire event",
"event": "[%key:ui::panel::config::automation::editor::triggers::type::event::label%]", "event": "[%key:ui::panel::config::automation::editor::triggers::type::event::label%]",
"service_data": "[%key:ui::components::service-control::service_data%]" "event_data": "[%key:ui::panel::config::automation::editor::triggers::type::event::event_data%]"
}, },
"device_id": { "device_id": {
"label": "Device", "label": "Device",