mirror of
https://github.com/home-assistant/frontend.git
synced 2025-10-02 08:19:47 +00:00
Compare commits
9 Commits
allow-to-s
...
20230802.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
593b176ab8 | ||
![]() |
1a15c8da8c | ||
![]() |
060e67397a | ||
![]() |
d6de29ca8a | ||
![]() |
220767b347 | ||
![]() |
79e1fbe076 | ||
![]() |
7d80eb06b0 | ||
![]() |
a181189a49 | ||
![]() |
626b51112f |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "home-assistant-frontend"
|
name = "home-assistant-frontend"
|
||||||
version = "20230802.0"
|
version = "20230802.1"
|
||||||
license = {text = "Apache-2.0"}
|
license = {text = "Apache-2.0"}
|
||||||
description = "The Home Assistant frontend"
|
description = "The Home Assistant frontend"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@@ -525,6 +525,7 @@ export const weatherIcon = (state?: string, nightTime?: boolean): string =>
|
|||||||
? mdiWeatherNightPartlyCloudy
|
? mdiWeatherNightPartlyCloudy
|
||||||
: weatherIcons[state];
|
: weatherIcons[state];
|
||||||
|
|
||||||
|
const EIGHT_HOURS = 28800000;
|
||||||
const DAY_IN_MILLISECONDS = 86400000;
|
const DAY_IN_MILLISECONDS = 86400000;
|
||||||
|
|
||||||
const isForecastHourly = (
|
const isForecastHourly = (
|
||||||
@@ -535,6 +536,20 @@ const isForecastHourly = (
|
|||||||
const date2 = new Date(forecast[2].datetime);
|
const date2 = new Date(forecast[2].datetime);
|
||||||
const timeDiff = date2.getTime() - date1.getTime();
|
const timeDiff = date2.getTime() - date1.getTime();
|
||||||
|
|
||||||
|
return timeDiff < EIGHT_HOURS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const isForecastTwiceDaily = (
|
||||||
|
forecast?: ForecastAttribute[]
|
||||||
|
): boolean | undefined => {
|
||||||
|
if (forecast && forecast?.length && forecast?.length > 2) {
|
||||||
|
const date1 = new Date(forecast[1].datetime);
|
||||||
|
const date2 = new Date(forecast[2].datetime);
|
||||||
|
const timeDiff = date2.getTime() - date1.getTime();
|
||||||
|
|
||||||
return timeDiff < DAY_IN_MILLISECONDS;
|
return timeDiff < DAY_IN_MILLISECONDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,19 +580,16 @@ const getLegacyForecast = (
|
|||||||
}
|
}
|
||||||
| undefined => {
|
| undefined => {
|
||||||
if (weather_attributes?.forecast && weather_attributes.forecast.length > 2) {
|
if (weather_attributes?.forecast && weather_attributes.forecast.length > 2) {
|
||||||
const hourly = isForecastHourly(weather_attributes.forecast);
|
if (isForecastHourly(weather_attributes.forecast)) {
|
||||||
if (hourly === true) {
|
|
||||||
const dateFirst = new Date(weather_attributes.forecast![0].datetime);
|
|
||||||
const datelast = new Date(
|
|
||||||
weather_attributes.forecast![
|
|
||||||
weather_attributes.forecast!.length - 1
|
|
||||||
].datetime
|
|
||||||
);
|
|
||||||
const dayDiff = datelast.getTime() - dateFirst.getTime();
|
|
||||||
const dayNight = dayDiff > DAY_IN_MILLISECONDS;
|
|
||||||
return {
|
return {
|
||||||
forecast: weather_attributes.forecast,
|
forecast: weather_attributes.forecast,
|
||||||
type: dayNight ? "twice_daily" : "hourly",
|
type: "hourly",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (isForecastTwiceDaily(weather_attributes.forecast)) {
|
||||||
|
return {
|
||||||
|
forecast: weather_attributes.forecast,
|
||||||
|
type: "twice_daily",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { forecast: weather_attributes.forecast, type: "daily" };
|
return { forecast: weather_attributes.forecast, type: "daily" };
|
||||||
|
@@ -411,54 +411,54 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
@entity-entry-updated=${this._entryUpdated}
|
@entity-entry-updated=${this._entryUpdated}
|
||||||
@toggle-edit-mode=${this._handleToggleInfoEditModeEvent}
|
@toggle-edit-mode=${this._handleToggleInfoEditModeEvent}
|
||||||
>
|
>
|
||||||
${this._childView
|
${cache(
|
||||||
? html`
|
this._childView
|
||||||
<div class="child-view">
|
? html`
|
||||||
${dynamicElement(this._childView.viewTag, {
|
<div class="child-view">
|
||||||
hass: this.hass,
|
${dynamicElement(this._childView.viewTag, {
|
||||||
entry: this._entry,
|
hass: this.hass,
|
||||||
params: this._childView.viewParams,
|
entry: this._entry,
|
||||||
})}
|
params: this._childView.viewParams,
|
||||||
</div>
|
})}
|
||||||
`
|
</div>
|
||||||
: cache(
|
`
|
||||||
this._currView === "info"
|
: this._currView === "info"
|
||||||
? html`
|
? html`
|
||||||
<ha-more-info-info
|
<ha-more-info-info
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entityId=${this._entityId}
|
.entityId=${this._entityId}
|
||||||
.entry=${this._entry}
|
.entry=${this._entry}
|
||||||
.editMode=${this._infoEditMode}
|
.editMode=${this._infoEditMode}
|
||||||
></ha-more-info-info>
|
></ha-more-info-info>
|
||||||
`
|
`
|
||||||
: this._currView === "history"
|
: this._currView === "history"
|
||||||
? html`
|
? html`
|
||||||
<ha-more-info-history-and-logbook
|
<ha-more-info-history-and-logbook
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entityId=${this._entityId}
|
.entityId=${this._entityId}
|
||||||
></ha-more-info-history-and-logbook>
|
></ha-more-info-history-and-logbook>
|
||||||
`
|
`
|
||||||
: this._currView === "settings"
|
: this._currView === "settings"
|
||||||
? html`
|
? html`
|
||||||
<ha-more-info-settings
|
<ha-more-info-settings
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entityId=${this._entityId}
|
.entityId=${this._entityId}
|
||||||
.entry=${this._entry}
|
.entry=${this._entry}
|
||||||
></ha-more-info-settings>
|
></ha-more-info-settings>
|
||||||
`
|
`
|
||||||
: this._currView === "related"
|
: this._currView === "related"
|
||||||
? html`
|
? html`
|
||||||
<ha-related-items
|
<ha-related-items
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.itemId=${entityId}
|
.itemId=${entityId}
|
||||||
.itemType=${SearchableDomains.has(domain)
|
.itemType=${SearchableDomains.has(domain)
|
||||||
? domain
|
? domain
|
||||||
: "entity"}
|
: "entity"}
|
||||||
></ha-related-items>
|
></ha-related-items>
|
||||||
`
|
`
|
||||||
: nothing
|
: nothing
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`;
|
`;
|
||||||
|
@@ -1295,6 +1295,11 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (
|
||||||
|
updates.disabled_by !== null &&
|
||||||
|
updates.disabled_by !== "user"
|
||||||
|
) {
|
||||||
|
delete updates.disabled_by;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
|
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
|
||||||
|
@@ -186,7 +186,10 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
|
|
||||||
protected willUpdate(changedProperties: PropertyValues) {
|
protected willUpdate(changedProperties: PropertyValues) {
|
||||||
super.willUpdate(changedProperties);
|
super.willUpdate(changedProperties);
|
||||||
if (!changedProperties.has("entry")) {
|
if (
|
||||||
|
!changedProperties.has("entry") ||
|
||||||
|
changedProperties.get("entry")?.id === this.entry.id
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +264,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
|
|
||||||
private precisionLabel(precision?: number, stateValue?: string) {
|
private precisionLabel(precision?: number, stateValue?: string) {
|
||||||
const stateValueNumber = Number(stateValue);
|
const stateValueNumber = Number(stateValue);
|
||||||
const value = !isNaN(stateValueNumber) ? stateValueNumber : 0;
|
const value = !isNaN(stateValueNumber) ? stateValue! : 0;
|
||||||
return formatNumber(value, this.hass.locale, {
|
return formatNumber(value, this.hass.locale, {
|
||||||
minimumFractionDigits: precision,
|
minimumFractionDigits: precision,
|
||||||
maximumFractionDigits: precision,
|
maximumFractionDigits: precision,
|
||||||
|
@@ -38,6 +38,7 @@ import {
|
|||||||
import { loadVirtualizer } from "../../resources/virtualizer";
|
import { loadVirtualizer } from "../../resources/virtualizer";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import { brandsUrl } from "../../util/brands-url";
|
import { brandsUrl } from "../../util/brands-url";
|
||||||
|
import { domainToName } from "../../data/integration";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
@@ -89,6 +90,8 @@ class HaLogbookRenderer extends LitElement {
|
|||||||
(!this.hasUpdated && this.virtualize) ||
|
(!this.hasUpdated && this.virtualize) ||
|
||||||
(changedProps.has("virtualize") && this.virtualize)
|
(changedProps.has("virtualize") && this.virtualize)
|
||||||
) {
|
) {
|
||||||
|
this.hass.loadBackendTranslation("services");
|
||||||
|
this.hass.loadBackendTranslation("title");
|
||||||
loadVirtualizer();
|
loadVirtualizer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +402,16 @@ class HaLogbookRenderer extends LitElement {
|
|||||||
return html`${this.hass.localize(
|
return html`${this.hass.localize(
|
||||||
"ui.components.logbook.triggered_by_service"
|
"ui.components.logbook.triggered_by_service"
|
||||||
)}
|
)}
|
||||||
${item.context_domain}.${item.context_service}`;
|
${item.context_domain && item.context_service
|
||||||
|
? `${domainToName(this.hass.localize, item.context_domain)}:
|
||||||
|
${
|
||||||
|
this.hass.localize(
|
||||||
|
`component.${item.context_domain}.services.${item.context_service}.name`
|
||||||
|
) ||
|
||||||
|
this.hass.services[item.context_domain]?.[item.context_service]?.name ||
|
||||||
|
item.context_service
|
||||||
|
}`
|
||||||
|
: ""}`;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!item.context_message ||
|
!item.context_message ||
|
||||||
|
Reference in New Issue
Block a user