Skip to content

Commit

Permalink
20230928.0 (#18052)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Sep 28, 2023
2 parents 60345f3 + d732bd4 commit 47022d3
Show file tree
Hide file tree
Showing 49 changed files with 720 additions and 524 deletions.
Binary file modified gallery/public/images/brand/logo-exclusion-zone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/public/images/brand/logo-layout-variants.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/public/images/brand/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"@types/luxon": "3.3.2",
"@types/mocha": "10.0.1",
"@types/qrcode": "1.5.2",
"@types/serve-handler": "6.1.1",
"@types/serve-handler": "6.1.2",
"@types/sortablejs": "1.15.2",
"@types/tar": "6.1.6",
"@types/ua-parser-js": "0.7.37",
Expand Down
Binary file modified public/static/icons/favicon-1024x1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/favicon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/favicon-apple-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-384x384.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/maskable_icon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/tile-win-310x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/icons/tile-win-310x310.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/images/color_wheel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/static/images/notification-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "home-assistant-frontend"
version = "20230926.0"
version = "20230928.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
119 changes: 76 additions & 43 deletions src/data/automation_i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,41 +138,54 @@ const tryDescribeTrigger = (

// Numeric State Trigger
if (trigger.platform === "numeric_state" && trigger.entity_id) {
let base = "When";
const stateObj = hass.states[trigger.entity_id];
const entity = stateObj ? computeStateName(stateObj) : trigger.entity_id;

if (trigger.attribute) {
base += ` ${computeAttributeNameDisplay(
hass.localize,
stateObj,
hass.entities,
trigger.attribute
)} from`;
}

base += ` ${entity} is`;
const attribute = trigger.attribute
? computeAttributeNameDisplay(
hass.localize,
stateObj,
hass.entities,
trigger.attribute
)
: undefined;

if (trigger.above !== undefined) {
base += ` above ${trigger.above}`;
}
const duration = trigger.for ? describeDuration(trigger.for) : undefined;

if (trigger.below !== undefined && trigger.above !== undefined) {
base += " and";
if (trigger.above && trigger.below) {
return hass.localize(
`${triggerTranslationBaseKey}.numeric_state.description.above-below`,
{
attribute: attribute,
entity: entity,
above: trigger.above,
below: trigger.below,
duration: duration,
}
);
}

if (trigger.below !== undefined) {
base += ` below ${trigger.below}`;
if (trigger.above) {
return hass.localize(
`${triggerTranslationBaseKey}.numeric_state.description.above`,
{
attribute: attribute,
entity: entity,
above: trigger.above,
duration: duration,
}
);
}

if (trigger.for) {
const duration = describeDuration(trigger.for);
if (duration) {
base += ` for ${duration}`;
}
if (trigger.below) {
return hass.localize(
`${triggerTranslationBaseKey}.numeric_state.description.below`,
{
attribute: attribute,
entity: entity,
below: trigger.below,
duration: duration,
}
);
}

return base;
}

// State Trigger
Expand Down Expand Up @@ -825,29 +838,49 @@ const tryDescribeCondition = (

// Numeric State Condition
if (condition.condition === "numeric_state" && condition.entity_id) {
let base = "Confirm";
const stateObj = hass.states[condition.entity_id];
const entity = stateObj ? computeStateName(stateObj) : condition.entity_id;

if ("attribute" in condition) {
base += ` ${condition.attribute} from`;
}

base += ` ${entity} is`;
const attribute = condition.attribute
? computeAttributeNameDisplay(
hass.localize,
stateObj,
hass.entities,
condition.attribute
)
: undefined;

if ("above" in condition) {
base += ` above ${condition.above}`;
if (condition.above && condition.below) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.above-below`,
{
attribute: attribute,
entity: entity,
above: condition.above,
below: condition.below,
}
);
}

if ("below" in condition && "above" in condition) {
base += " and";
if (condition.above) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.above`,
{
attribute: attribute,
entity: entity,
above: condition.above,
}
);
}

if ("below" in condition) {
base += ` below ${condition.below}`;
if (condition.below) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.below`,
{
attribute: attribute,
entity: entity,
below: condition.below,
}
);
}

return base;
}

// Time condition
Expand Down
24 changes: 12 additions & 12 deletions src/data/zwave_js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export interface ZWaveJSController {
supported_function_types: number[];
suc_node_id: number;
supports_timers: boolean;
is_heal_network_active: boolean;
is_rebuilding_routes: boolean;
inclusion_state: InclusionState;
nodes: ZWaveJSNodeStatus[];
}
Expand Down Expand Up @@ -278,9 +278,9 @@ export interface ZWaveJSRefreshNodeStatusMessage {
stage?: string;
}

export interface ZWaveJSHealNetworkStatusMessage {
export interface ZWaveJSRebuildRoutesStatusMessage {
event: string;
heal_node_status: { [key: number]: string };
rebuild_routes_status: { [key: number]: string };
}

export interface ZWaveJSControllerStatisticsUpdatedMessage {
Expand Down Expand Up @@ -651,12 +651,12 @@ export const reinterviewZwaveNode = (
}
);

export const healZwaveNode = (
export const rebuildZwaveNodeRoutes = (
hass: HomeAssistant,
device_id: string
): Promise<boolean> =>
hass.callWS({
type: "zwave_js/heal_node",
type: "zwave_js/rebuild_node_routes",
device_id,
});

Expand All @@ -673,33 +673,33 @@ export const removeFailedZwaveNode = (
}
);

export const healZwaveNetwork = (
export const rebuildZwaveNetworkRoutes = (
hass: HomeAssistant,
entry_id: string
): Promise<UnsubscribeFunc> =>
hass.callWS({
type: "zwave_js/begin_healing_network",
type: "zwave_js/begin_rebuilding_routes",
entry_id,
});

export const stopHealZwaveNetwork = (
export const stopRebuildingZwaveNetworkRoutes = (
hass: HomeAssistant,
entry_id: string
): Promise<UnsubscribeFunc> =>
hass.callWS({
type: "zwave_js/stop_healing_network",
type: "zwave_js/stop_rebuilding_routes",
entry_id,
});

export const subscribeHealZwaveNetworkProgress = (
export const subscribeRebuildZwaveNetworkRoutesProgress = (
hass: HomeAssistant,
entry_id: string,
callbackFunction: (message: ZWaveJSHealNetworkStatusMessage) => void
callbackFunction: (message: ZWaveJSRebuildRoutesStatusMessage) => void
): Promise<UnsubscribeFunc> =>
hass.connection.subscribeMessage(
(message: any) => callbackFunction(message),
{
type: "zwave_js/subscribe_heal_network_progress",
type: "zwave_js/subscribe_rebuild_routes_progress",
entry_id,
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ class DialogLightColorFavorite extends LitElement {
): Promise<void> {
this._entry = dialogParams.entry;
this._dialogParams = dialogParams;
this._color = dialogParams.initialColor ?? this._computeCurrentColor();
this._updateModes();
this._loadCurrentColorAndMode(dialogParams.add, dialogParams.defaultMode);
await this.updateComplete;
}

public closeDialog(): void {
Expand All @@ -82,19 +81,20 @@ class DialogLightColorFavorite extends LitElement {
}

this._modes = modes;

if (this._color) {
this._mode = "color_temp_kelvin" in this._color ? "color_temp" : "color";
} else {
this._mode = this._modes[0];
}
}

private _loadCurrentColorAndMode(
add?: boolean,
defaultMode?: LightPickerMode
) {
private _computeCurrentColor() {
const attributes = this.stateObj!.attributes;
const color_mode = attributes.color_mode;

let currentColor: LightColor | undefined;
let currentMode: LightPickerMode | undefined;
if (color_mode === LightColorMode.XY) {
currentMode = "color";
// XY color not supported for favorites. Try to grab the hs or rgb instead.
if (attributes.hs_color) {
currentColor = { hs_color: attributes.hs_color };
Expand All @@ -105,21 +105,16 @@ class DialogLightColorFavorite extends LitElement {
color_mode === LightColorMode.COLOR_TEMP &&
attributes.color_temp_kelvin
) {
currentMode = LightColorMode.COLOR_TEMP;
currentColor = {
color_temp_kelvin: attributes.color_temp_kelvin,
};
} else if (attributes[color_mode + "_color"]) {
currentMode = "color";
currentColor = {
[color_mode + "_color"]: attributes[color_mode + "_color"],
} as LightColor;
}

if (add) {
this._color = currentColor;
}
this._mode = defaultMode ?? currentMode ?? this._modes[0];
return currentColor;
}

private _colorChanged(ev: CustomEvent) {
Expand Down Expand Up @@ -230,7 +225,10 @@ class DialogLightColorFavorite extends LitElement {
<ha-button slot="secondaryAction" dialogAction="cancel">
${this.hass.localize("ui.common.cancel")}
</ha-button>
<ha-button slot="primaryAction" @click=${this._save}
<ha-button
slot="primaryAction"
@click=${this._save}
.disabled=${!this._color}
>${this.hass.localize("ui.common.save")}</ha-button
>
</ha-dialog>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { mdiCheck, mdiMinus, mdiPlus } from "@mdi/js";
import {
css,
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
css,
html,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
Expand All @@ -19,18 +19,17 @@ import {
updateEntityRegistryEntry,
} from "../../../../data/entity_registry";
import {
computeDefaultFavoriteColors,
LightColor,
LightEntity,
computeDefaultFavoriteColors,
} from "../../../../data/light";
import { actionHandler } from "../../../../panels/lovelace/common/directives/action-handler-directive";
import {
loadSortable,
SortableInstance,
loadSortable,
} from "../../../../resources/sortable.ondemand";
import { HomeAssistant } from "../../../../types";
import { showConfirmationDialog } from "../../../generic/show-dialog-box";
import type { LightPickerMode } from "./dialog-light-color-favorite";
import "./ha-favorite-color-button";
import { showLightColorFavoriteDialog } from "./show-dialog-light-color-favorite";

Expand Down Expand Up @@ -141,7 +140,6 @@ export class HaMoreInfoLightFavoriteColors extends LitElement {
private _add = async () => {
const color = await showLightColorFavoriteDialog(this, {
entry: this.entry!,
add: true,
title: this.hass.localize(
"ui.dialogs.more_info_control.light.favorite_color.add_title"
),
Expand All @@ -156,13 +154,9 @@ export class HaMoreInfoLightFavoriteColors extends LitElement {
// Make sure the current favorite color is set
fireEvent(this, "favorite-color-edit-started");
await this._apply(index);
const defaultMode: LightPickerMode =
"color_temp_kelvin" in this._favoriteColors[index]
? "color_temp"
: "color";
const color = await showLightColorFavoriteDialog(this, {
entry: this.entry!,
defaultMode,
initialColor: this._favoriteColors[index],
title: this.hass.localize(
"ui.dialogs.more_info_control.light.favorite_color.edit_title"
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { fireEvent } from "../../../../common/dom/fire_event";
import { ExtEntityRegistryEntry } from "../../../../data/entity_registry";
import { LightColor } from "../../../../data/light";
import type { LightPickerMode } from "./dialog-light-color-favorite";

export interface LightColorFavoriteDialogParams {
entry: ExtEntityRegistryEntry;
title: string;
defaultMode?: LightPickerMode;
add?: boolean;
initialColor?: LightColor;
submit?: (color?: LightColor) => void;
cancel?: () => void;
}
Expand Down
1 change: 1 addition & 0 deletions src/fake_data/provide_hass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export const provideHass = (
},
dockedSidebar: "auto",
vibrate: true,
debugConnection: false,
suspendWhenHidden: false,
moreInfoEntityId: null as any,
// @ts-ignore
Expand Down
Loading

0 comments on commit 47022d3

Please sign in to comment.