mirror of
https://github.com/home-assistant/frontend.git
synced 2025-09-27 22:09:42 +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]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20230802.0"
|
||||
version = "20230802.1"
|
||||
license = {text = "Apache-2.0"}
|
||||
description = "The Home Assistant frontend"
|
||||
readme = "README.md"
|
||||
|
@@ -525,6 +525,7 @@ export const weatherIcon = (state?: string, nightTime?: boolean): string =>
|
||||
? mdiWeatherNightPartlyCloudy
|
||||
: weatherIcons[state];
|
||||
|
||||
const EIGHT_HOURS = 28800000;
|
||||
const DAY_IN_MILLISECONDS = 86400000;
|
||||
|
||||
const isForecastHourly = (
|
||||
@@ -535,6 +536,20 @@ const isForecastHourly = (
|
||||
const date2 = new Date(forecast[2].datetime);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -565,19 +580,16 @@ const getLegacyForecast = (
|
||||
}
|
||||
| undefined => {
|
||||
if (weather_attributes?.forecast && weather_attributes.forecast.length > 2) {
|
||||
const hourly = 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;
|
||||
if (isForecastHourly(weather_attributes.forecast)) {
|
||||
return {
|
||||
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" };
|
||||
|
@@ -411,54 +411,54 @@ export class MoreInfoDialog extends LitElement {
|
||||
@entity-entry-updated=${this._entryUpdated}
|
||||
@toggle-edit-mode=${this._handleToggleInfoEditModeEvent}
|
||||
>
|
||||
${this._childView
|
||||
? html`
|
||||
<div class="child-view">
|
||||
${dynamicElement(this._childView.viewTag, {
|
||||
hass: this.hass,
|
||||
entry: this._entry,
|
||||
params: this._childView.viewParams,
|
||||
})}
|
||||
</div>
|
||||
`
|
||||
: cache(
|
||||
this._currView === "info"
|
||||
? html`
|
||||
<ha-more-info-info
|
||||
dialogInitialFocus
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
.entry=${this._entry}
|
||||
.editMode=${this._infoEditMode}
|
||||
></ha-more-info-info>
|
||||
`
|
||||
: this._currView === "history"
|
||||
? html`
|
||||
<ha-more-info-history-and-logbook
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
></ha-more-info-history-and-logbook>
|
||||
`
|
||||
: this._currView === "settings"
|
||||
? html`
|
||||
<ha-more-info-settings
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
.entry=${this._entry}
|
||||
></ha-more-info-settings>
|
||||
`
|
||||
: this._currView === "related"
|
||||
? html`
|
||||
<ha-related-items
|
||||
.hass=${this.hass}
|
||||
.itemId=${entityId}
|
||||
.itemType=${SearchableDomains.has(domain)
|
||||
? domain
|
||||
: "entity"}
|
||||
></ha-related-items>
|
||||
`
|
||||
: nothing
|
||||
)}
|
||||
${cache(
|
||||
this._childView
|
||||
? html`
|
||||
<div class="child-view">
|
||||
${dynamicElement(this._childView.viewTag, {
|
||||
hass: this.hass,
|
||||
entry: this._entry,
|
||||
params: this._childView.viewParams,
|
||||
})}
|
||||
</div>
|
||||
`
|
||||
: this._currView === "info"
|
||||
? html`
|
||||
<ha-more-info-info
|
||||
dialogInitialFocus
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
.entry=${this._entry}
|
||||
.editMode=${this._infoEditMode}
|
||||
></ha-more-info-info>
|
||||
`
|
||||
: this._currView === "history"
|
||||
? html`
|
||||
<ha-more-info-history-and-logbook
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
></ha-more-info-history-and-logbook>
|
||||
`
|
||||
: this._currView === "settings"
|
||||
? html`
|
||||
<ha-more-info-settings
|
||||
.hass=${this.hass}
|
||||
.entityId=${this._entityId}
|
||||
.entry=${this._entry}
|
||||
></ha-more-info-settings>
|
||||
`
|
||||
: this._currView === "related"
|
||||
? html`
|
||||
<ha-related-items
|
||||
.hass=${this.hass}
|
||||
.itemId=${entityId}
|
||||
.itemType=${SearchableDomains.has(domain)
|
||||
? domain
|
||||
: "entity"}
|
||||
></ha-related-items>
|
||||
`
|
||||
: nothing
|
||||
)}
|
||||
</div>
|
||||
</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 {
|
||||
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
|
||||
|
@@ -186,7 +186,10 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
|
||||
protected willUpdate(changedProperties: PropertyValues) {
|
||||
super.willUpdate(changedProperties);
|
||||
if (!changedProperties.has("entry")) {
|
||||
if (
|
||||
!changedProperties.has("entry") ||
|
||||
changedProperties.get("entry")?.id === this.entry.id
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,7 +264,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
|
||||
private precisionLabel(precision?: number, stateValue?: string) {
|
||||
const stateValueNumber = Number(stateValue);
|
||||
const value = !isNaN(stateValueNumber) ? stateValueNumber : 0;
|
||||
const value = !isNaN(stateValueNumber) ? stateValue! : 0;
|
||||
return formatNumber(value, this.hass.locale, {
|
||||
minimumFractionDigits: precision,
|
||||
maximumFractionDigits: precision,
|
||||
|
@@ -38,6 +38,7 @@ import {
|
||||
import { loadVirtualizer } from "../../resources/virtualizer";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { brandsUrl } from "../../util/brands-url";
|
||||
import { domainToName } from "../../data/integration";
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
@@ -89,6 +90,8 @@ class HaLogbookRenderer extends LitElement {
|
||||
(!this.hasUpdated && this.virtualize) ||
|
||||
(changedProps.has("virtualize") && this.virtualize)
|
||||
) {
|
||||
this.hass.loadBackendTranslation("services");
|
||||
this.hass.loadBackendTranslation("title");
|
||||
loadVirtualizer();
|
||||
}
|
||||
}
|
||||
@@ -399,7 +402,16 @@ class HaLogbookRenderer extends LitElement {
|
||||
return html`${this.hass.localize(
|
||||
"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 (
|
||||
!item.context_message ||
|
||||
|
Reference in New Issue
Block a user