Compare commits

...

9 Commits

Author SHA1 Message Date
Bram Kragten
593b176ab8 Bump version to 20230802.1 2023-08-18 11:18:24 +02:00
karwosts
1a15c8da8c Fix default precision display in entity settings (#17491) 2023-08-18 11:15:18 +02:00
Bram Kragten
060e67397a Prevent voice settings to override entity registry settings dialog (#17485) 2023-08-18 11:14:42 +02:00
Bram Kragten
d6de29ca8a Change logic to determine if forecast is hourly (#17486) 2023-08-18 11:14:15 +02:00
Bram Kragten
220767b347 Use service translations in logbook (#17461) 2023-08-18 11:13:57 +02:00
karwosts
79e1fbe076 Fix device config dialog when disabled (#17464) 2023-08-18 11:13:38 +02:00
Bram Kragten
7d80eb06b0 20230802.0 (#17457) 2023-08-02 14:12:28 +02:00
Bram Kragten
a181189a49 20230801.0 (#17450) 2023-08-01 11:16:30 +02:00
Franck Nijhof
626b51112f 20230725.0 (#17407) 2023-07-25 18:02:12 +02:00
6 changed files with 95 additions and 63 deletions

View File

@@ -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"

View File

@@ -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" };

View File

@@ -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>
`;

View File

@@ -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);

View File

@@ -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,

View File

@@ -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 ||