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] [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"

View File

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

View File

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

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 { try {
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates); await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);

View File

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

View File

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