Compare commits

..

3 Commits

Author SHA1 Message Date
Bram Kragten 5c52ace115 remove show_advanced_options from API 2026-05-26 13:56:54 +02:00
Bram Kragten 20d46a009a Update ha-profile-section-general.ts 2026-05-26 12:45:14 +02:00
Bram Kragten cf85038888 Remove advanced mode completly 2026-05-26 11:38:35 +02:00
49 changed files with 348 additions and 690 deletions
@@ -75,17 +75,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
<div class="condition">
<span>
${this._condition
? describeCondition(
this._condition,
this.hass.localize,
this.hass.locale,
[],
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)
? describeCondition(this._condition, this.hass, [])
: "<invalid YAML>"}
</span>
<ha-yaml-editor
@@ -98,19 +88,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
${conditions.map(
(conf) => html`
<div class="condition">
<span
>${describeCondition(
conf as any,
this.hass.localize,
this.hass.locale,
[],
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)}</span
>
<span>${describeCondition(conf as any, this.hass, [])}</span>
<pre>${dump(conf)}</pre>
</div>
`
@@ -99,17 +99,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
<div class="trigger">
<span>
${this._trigger
? describeTrigger(
this._trigger,
this.hass.localize,
this.hass.locale,
[],
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)
? describeTrigger(this._trigger, this.hass, [])
: "<invalid YAML>"}
</span>
<ha-yaml-editor
@@ -121,19 +111,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
${triggers.map(
(conf) => html`
<div class="trigger">
<span
>${describeTrigger(
conf as any,
this.hass.localize,
this.hass.locale,
[],
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)}</span
>
<span>${describeTrigger(conf as any, this.hass, [])}</span>
<pre>${dump(conf)}</pre>
</div>
`
+7 -14
View File
@@ -1,4 +1,3 @@
import { consume, type ContextType } from "@lit/context";
import {
mdiAmpersand,
mdiClockOutline,
@@ -13,11 +12,11 @@ import {
mdiWeatherSunny,
} from "@mdi/js";
import { html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { customElement, property } from "lit/decorators";
import { until } from "lit/directives/until";
import { computeDomain } from "../common/entity/compute_domain";
import { configContext, connectionContext } from "../data/context";
import { conditionIcon, FALLBACK_DOMAIN_ICONS } from "../data/icons";
import type { HomeAssistant } from "../types";
import "./ha-icon";
import "./ha-svg-icon";
@@ -37,18 +36,12 @@ export const CONDITION_ICONS = {
@customElement("ha-condition-icon")
export class HaConditionIcon extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public condition?: string;
@property() public icon?: string;
@state()
@consume({ context: connectionContext, subscribe: true })
protected _connection?: ContextType<typeof connectionContext>;
@state()
@consume({ context: configContext, subscribe: true })
protected _config?: ContextType<typeof configContext>;
protected render() {
if (this.icon) {
return html`<ha-icon .icon=${this.icon}></ha-icon>`;
@@ -58,13 +51,13 @@ export class HaConditionIcon extends LitElement {
return nothing;
}
if (!this._connection || !this._config) {
if (!this.hass) {
return this._renderFallback();
}
const icon = conditionIcon(
this._connection.connection,
this._config.config,
this.hass.connection,
this.hass.config,
this.condition
).then((icn) => {
if (icn) {
+4 -14
View File
@@ -1,4 +1,3 @@
import { consume, type ContextType } from "@lit/context";
import {
mdiAvTimer,
mdiCalendar,
@@ -19,10 +18,9 @@ import {
mdiWebhook,
} from "@mdi/js";
import { html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { customElement, property } from "lit/decorators";
import { until } from "lit/directives/until";
import { computeDomain } from "../common/entity/compute_domain";
import { configContext, connectionContext } from "../data/context";
import { FALLBACK_DOMAIN_ICONS, triggerIcon } from "../data/icons";
import { mdiHomeAssistant } from "../resources/home-assistant-logo-svg";
import type { HomeAssistant } from "../types";
@@ -58,14 +56,6 @@ export class HaTriggerIcon extends LitElement {
@property() public icon?: string;
@state()
@consume({ context: connectionContext, subscribe: true })
protected _connection?: ContextType<typeof connectionContext>;
@state()
@consume({ context: configContext, subscribe: true })
protected _config?: ContextType<typeof configContext>;
protected render() {
if (this.icon) {
return html`<ha-icon .icon=${this.icon}></ha-icon>`;
@@ -75,13 +65,13 @@ export class HaTriggerIcon extends LitElement {
return nothing;
}
if (!this._connection || !this._config) {
if (!this.hass) {
return this._renderFallback();
}
const icon = triggerIcon(
this._connection.connection,
this._config.config,
this.hass.connection,
this.hass.config,
this.trigger
).then((icn) => {
if (icn) {
+6 -24
View File
@@ -171,28 +171,16 @@ export class HaTracePathDetails extends LitElement {
migrateAutomationTrigger({
...currentDetail,
}) as Trigger,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
this.hass,
this._entityReg
)}
</h2>`
: selectedType === "condition"
? html`<h2>
${describeCondition(
currentDetail,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
this.hass,
this._entityReg
)}
</h2>`
: selectedType === "action"
@@ -227,14 +215,8 @@ export class HaTracePathDetails extends LitElement {
.includes("condition")
? html`[${describeCondition(
currentDetail,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
this.hass,
this._entityReg
)}]<br />`
: nothing}
${this.hass!.localize(
+3 -3
View File
@@ -10,7 +10,7 @@ import type { WeekdayShort } from "../common/datetime/weekday";
import { navigate } from "../common/navigate";
import type { LocalizeKeys } from "../common/translations/localize";
import { createSearchParam } from "../common/url/search-params";
import type { CallWS, Context, HomeAssistant } from "../types";
import type { Context, HomeAssistant } from "../types";
import type { BlueprintInput } from "./blueprint";
import type { ConditionDescription } from "./condition";
import { CONDITION_BUILDING_BLOCKS } from "./condition";
@@ -578,11 +578,11 @@ export const subscribeTrigger = (
});
export const testCondition = (
callWS: CallWS,
hass: HomeAssistant,
condition: Condition | Condition[],
variables?: Record<string, unknown>
) =>
callWS<{ result: boolean }>({
hass.callWS<{ result: boolean }>({
type: "test_condition",
condition,
variables,
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,4 +1,4 @@
import type { CallWS } from "../types";
import type { HomeAssistant } from "../types";
export interface ValidConfig {
valid: true;
@@ -13,10 +13,10 @@ export interface InvalidConfig {
type ValidKeys = "triggers" | "actions" | "conditions";
export const validateConfig = <T extends Partial<Record<ValidKeys, unknown>>>(
callWS: CallWS,
hass: HomeAssistant,
config: T
): Promise<Record<keyof T, ValidConfig | InvalidConfig>> =>
callWS({
hass.callWS({
type: "validate_config",
...config,
});
-1
View File
@@ -40,7 +40,6 @@ export const createConfigFlow = (
"config/config_entries/flow",
{
handler,
show_advanced_options: Boolean(hass.userData?.showAdvanced),
entry_id,
},
HEADERS
-1
View File
@@ -2,7 +2,6 @@ import type { Connection } from "home-assistant-js-websocket";
import type { ShortcutItem } from "./home_shortcuts";
export interface CoreFrontendUserData {
showAdvanced?: boolean;
showEntityIdPicker?: boolean;
default_panel?: string;
apps_info_dismissed?: boolean;
-1
View File
@@ -7,7 +7,6 @@ export const createOptionsFlow = (hass: HomeAssistant, handler: string) =>
"config/config_entries/options/flow",
{
handler,
show_advanced_options: Boolean(hass.userData?.showAdvanced),
}
);
+2 -12
View File
@@ -9,8 +9,8 @@ import type { Condition } from "./automation";
import { describeCondition } from "./automation_i18n";
import { localizeDeviceAutomationAction } from "./device/device_automation";
import type { EntityRegistryEntry } from "./entity/entity_registry";
import type { DomainManifestLookup } from "./integration";
import { domainToName } from "./integration";
import type { DomainManifestLookup } from "./integration";
import type {
ActionType,
ActionTypes,
@@ -322,17 +322,7 @@ const tryDescribeAction = <T extends ActionType>(
return hass.localize(
`${actionTranslationBaseKey}.check_condition.description.full`,
{
condition: describeCondition(
action as Condition,
hass.localize,
hass.locale,
entityRegistry,
hass.states,
hass.entities,
hass.config,
hass.formatEntityState,
hass.formatEntityAttributeValue
),
condition: describeCondition(action as Condition, hass, entityRegistry),
}
);
}
-1
View File
@@ -16,7 +16,6 @@ export const createSubConfigFlow = (
"config/config_entries/subentries/flow",
{
handler: [configEntryId, subFlowType],
show_advanced_options: Boolean(hass.userData?.showAdvanced),
subentry_id,
},
HEADERS
@@ -167,7 +167,6 @@ export interface DataEntryFlowDialogParams {
entryId?: string;
}) => void;
flowConfig: FlowConfig;
showAdvanced?: boolean;
dialogParentElement?: HTMLElement;
navigateToResult?: boolean;
carryOverDevices?: string[];
@@ -48,7 +48,6 @@ class StepFlowAbort extends LitElement {
showConfigFlowDialog(this.params.dialogParentElement!, {
dialogClosedCallback: this.params.dialogClosedCallback,
startFlowHandler: this.handler,
showAdvanced: this.hass.userData?.showAdvanced,
navigateToResult: this.params.navigateToResult,
});
},
-1
View File
@@ -342,7 +342,6 @@ class PanelCalendar extends SubscribeMixin(LitElement) {
private _addCalendar = async (): Promise<void> => {
showConfigFlowDialog(this, {
startFlowHandler: "local_calendar",
showAdvanced: this.hass.userData?.showAdvanced,
manifest: await fetchIntegrationManifest(this.hass, "local_calendar"),
dialogClosedCallback: ({ flowFinished }) => {
if (flowFinished) {
@@ -145,8 +145,6 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@state()
@consume({ context: fullEntitiesContext, subscribe: true })
_entityReg: EntityRegistryEntry[] = [];
@@ -13,8 +13,6 @@ class HaConfigAreas extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
protected routerOptions: RouterOptions = {
defaultPage: "dashboard",
routes: {
@@ -37,7 +35,6 @@ class HaConfigAreas extends HassRouterPage {
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.showAdvanced = this.showAdvanced;
pageEl.route = this.routeTail;
}
}
@@ -801,7 +801,7 @@ export default class HaAutomationActionRow extends LitElement {
this._running = false;
this._runResult = undefined;
const validated = await validateConfig(this.hass.callWS, {
const validated = await validateConfig(this.hass, {
actions: this.action,
});
@@ -156,6 +156,7 @@ export class HaConditionAction
return html`<ha-condition-icon
slot="start"
.hass=${this.hass}
.condition=${condition}
></ha-condition-icon
><span slot="headline">${label}</span>`;
@@ -165,6 +166,7 @@ export class HaConditionAction
<ha-combo-box-item type="button">
<ha-condition-icon
slot="start"
.hass=${this.hass}
.condition=${item.search_labels!.condition || undefined}
></ha-condition-icon>
<span slot="headline">${item.primary}</span>
@@ -1897,7 +1897,12 @@ class DialogAddAutomationElement
): AddAutomationElementListItem {
const triggerName = getTriggerObjectId(trigger);
return {
icon: html` <ha-trigger-icon .trigger=${trigger}></ha-trigger-icon> `,
icon: html`
<ha-trigger-icon
.hass=${this.hass}
.trigger=${trigger}
></ha-trigger-icon>
`,
key: `${DYNAMIC_PREFIX}${trigger}`,
name:
localize(`component.${domain}.triggers.${triggerName}.name`) || trigger,
@@ -1915,7 +1920,10 @@ class DialogAddAutomationElement
const conditionName = getConditionObjectId(condition);
return {
icon: html`
<ha-condition-icon .condition=${condition}></ha-condition-icon>
<ha-condition-icon
.hass=${this.hass}
.condition=${condition}
></ha-condition-icon>
`,
key: `${DYNAMIC_PREFIX}${condition}`,
name:
@@ -233,17 +233,7 @@ export default class HaAutomationConditionRow extends LitElement {
this.condition as TriggerCondition
)
: capitalizeFirstLetter(
describeCondition(
this.condition,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)
describeCondition(this.condition, this.hass, this._entityReg)
)}
${target !== undefined || (descriptionHasTarget && !this._isNew)
? this._renderTargets(
@@ -620,14 +610,8 @@ export default class HaAutomationConditionRow extends LitElement {
const triggerInfos = this._getTriggerInfos(
ensureArray(this._automationConfig?.triggers || []),
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
this.hass,
this._entityReg
);
const infoById = new Map(triggerInfos.map((info) => [info.id, info]));
return html`${prefix}
@@ -874,7 +858,7 @@ export default class HaAutomationConditionRow extends LitElement {
let validateResult: Record<"conditions", InvalidConfig | ValidConfig>;
try {
validateResult = await validateConfig(this.hass.callWS, {
validateResult = await validateConfig(this.hass, {
conditions: condition,
});
} catch (err: any) {
@@ -905,7 +889,7 @@ export default class HaAutomationConditionRow extends LitElement {
let result: { result: boolean };
try {
result = await testCondition(this.hass.callWS, condition);
result = await testCondition(this.hass, condition);
} catch (err: any) {
if (this.condition !== condition) {
return;
@@ -937,18 +921,7 @@ export default class HaAutomationConditionRow extends LitElement {
),
inputType: "string",
placeholder: capitalizeFirstLetter(
describeCondition(
this.condition,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue,
true
)
describeCondition(this.condition, this.hass, this._entityReg, true)
),
defaultValue: this.condition.alias,
confirmText: this.hass.localize("ui.common.submit"),
@@ -1,4 +1,4 @@
import { consume, type ContextType } from "@lit/context";
import { consume } from "@lit/context";
import { mdiAlert } from "@mdi/js";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
@@ -22,19 +22,15 @@ import {
getTriggerInfos,
type TriggerInfo,
} from "../../../../../data/automation_i18n";
import {
configContext,
entitiesContext,
formattersContext,
fullEntitiesContext,
internationalizationContext,
statesContext,
} from "../../../../../data/context";
import { fullEntitiesContext } from "../../../../../data/context";
import type { EntityRegistryEntry } from "../../../../../data/entity/entity_registry";
import type { HomeAssistant } from "../../../../../types";
import "../../ha-trigger-id-chip";
@customElement("ha-automation-condition-trigger")
export class HaTriggerCondition extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public condition!: TriggerCondition;
@property({ type: Boolean }) public disabled = false;
@@ -47,22 +43,6 @@ export class HaTriggerCondition extends LitElement {
@consume({ context: fullEntitiesContext, subscribe: true })
private _entityReg: EntityRegistryEntry[] = [];
@state()
@consume({ context: internationalizationContext, subscribe: true })
protected _i18n!: ContextType<typeof internationalizationContext>;
@consume({ context: statesContext, subscribe: true })
protected _states!: ContextType<typeof statesContext>;
@consume({ context: entitiesContext, subscribe: true })
protected _entities!: ContextType<typeof entitiesContext>;
@consume({ context: configContext, subscribe: true })
protected _config!: ContextType<typeof configContext>;
@consume({ context: formattersContext, subscribe: true })
protected _formatters!: ContextType<typeof formattersContext>;
private _triggerInfos = memoizeOne(
(
triggers: AutomationConfig["triggers"] | undefined,
@@ -70,14 +50,8 @@ export class HaTriggerCondition extends LitElement {
): TriggerInfo[] =>
getTriggerInfos(
triggers ? ensureArray(triggers) : undefined,
this._i18n?.localize,
this._i18n?.locale,
entityReg,
this._states,
this._entities,
this._config?.config,
this._formatters?.formatEntityState,
this._formatters?.formatEntityAttributeValue
this.hass,
entityReg
)
);
@@ -101,7 +75,7 @@ export class HaTriggerCondition extends LitElement {
if (!triggerInfos.length && !selectedIds.length) {
return html`
<ha-alert alert-type="info">
${this._i18n.localize(
${this.hass.localize(
"ui.panel.config.automation.editor.conditions.type.trigger.no_triggers"
)}
</ha-alert>
@@ -141,9 +115,9 @@ export class HaTriggerCondition extends LitElement {
>
${alertIcon}
</ha-trigger-id-chip>
${this._i18n.localize("state.default.unavailable")}
${this.hass.localize("state.default.unavailable")}
<ha-tooltip .for=${`trigger-${id}`}>
${this._i18n.localize(
${this.hass.localize(
"ui.panel.config.automation.editor.conditions.type.trigger.unavailable_info",
{ id: html`<b>${id}</b>` }
)}
@@ -169,7 +143,7 @@ export class HaTriggerCondition extends LitElement {
</ha-trigger-id-chip>
${info.label}${info.count > 1
? html`<ha-tooltip .for=${`trigger-${info.id}`}
>${this._i18n.localize(
>${this.hass.localize(
"ui.panel.config.automation.editor.conditions.type.trigger.duplicated_info"
)}</ha-tooltip
>`
@@ -647,7 +647,7 @@ export class HaAutomationEditor extends AutomationScriptEditorMixin<AutomationCo
if (stateObj?.state !== UNAVAILABLE) {
return;
}
const validation = await validateConfig(this.hass.callWS, {
const validation = await validateConfig(this.hass, {
triggers: this.config.triggers,
conditions: this.config.conditions,
actions: this.config.actions,
@@ -27,8 +27,6 @@ class HaConfigAutomation extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public cloudStatus?: CloudStatus;
@property({ attribute: false }) public automations: AutomationEntity[] = [];
@@ -79,7 +77,6 @@ class HaConfigAutomation extends HassRouterPage {
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.route = this.routeTail;
pageEl.showAdvanced = this.showAdvanced;
pageEl.cloudStatus = this.cloudStatus;
if (this.hass) {
@@ -117,18 +117,7 @@ export default class HaAutomationOptionRow extends LitElement {
if (typeof conditions[0] === "string") {
str += conditions[0];
} else {
str += describeCondition(
conditions[0],
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue,
true
);
str += describeCondition(conditions[0], this.hass, this._entityReg);
}
if (conditions.length > 1) {
str += this.hass.localize(
@@ -273,6 +273,7 @@ export default class HaAutomationTriggerRow extends LitElement {
></ha-svg-icon>`
: html`<ha-trigger-icon
slot="leading-icon"
.hass=${this.hass}
.trigger=${(this.trigger as Exclude<Trigger, TriggerList>).trigger}
></ha-trigger-icon>`}
<h3 slot="header">
@@ -298,17 +299,7 @@ export default class HaAutomationTriggerRow extends LitElement {
</ha-tooltip>`
: nothing} `
: nothing}
${describeTrigger(
this.trigger,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue
)}
${describeTrigger(this.trigger, this.hass, this._entityReg)}
${target !== undefined || (descriptionHasTarget && !this._isNew)
? this._renderTargets(
target,
@@ -684,7 +675,7 @@ export default class HaAutomationTriggerRow extends LitElement {
this._triggerUnsub = undefined;
}
const validateResult = await validateConfig(this.hass.callWS, {
const validateResult = await validateConfig(this.hass, {
triggers: trigger,
});
@@ -880,18 +871,7 @@ export default class HaAutomationTriggerRow extends LitElement {
),
inputType: "string",
placeholder: capitalizeFirstLetter(
describeTrigger(
this.trigger,
this.hass.localize,
this.hass.locale,
this._entityReg,
this.hass.states,
this.hass.entities,
this.hass.config,
this.hass.formatEntityState,
this.hass.formatEntityAttributeValue,
true
)
describeTrigger(this.trigger, this.hass, this._entityReg, true)
),
defaultValue: this.trigger.alias,
confirmText: this.hass.localize("ui.common.submit"),
@@ -22,8 +22,6 @@ class HaConfigBlueprint extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false })
public blueprints: Record<string, Blueprints> = {};
@@ -61,7 +59,6 @@ class HaConfigBlueprint extends HassRouterPage {
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.route = this.routeTail;
pageEl.showAdvanced = this.showAdvanced;
pageEl.blueprints = this.blueprints;
if (
@@ -42,8 +42,6 @@ class HaConfigSystemNavigation extends LitElement {
@property({ attribute: false }) public cloudStatus?: CloudStatus;
@property({ attribute: false }) public showAdvanced = false;
@state() private _latestBackupDate?: Date;
@state() private _boardName?: string;
@@ -35,8 +35,6 @@ export class DeveloperYamlConfig extends LitElement {
@property({ attribute: false }) public route!: Route;
@property({ attribute: false }) public showAdvanced = false;
@state() private _validating = false;
@state() private _reloadableDomains: TranslatedReloadableDomain[] = [];
@@ -188,8 +188,6 @@ export class HaConfigDevicePage extends LitElement {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@state() private _related?: RelatedResult;
@state() private _diagnosticDownloadLinks: DeviceAction[] = [];
@@ -18,8 +18,6 @@ class HaConfigDevices extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
protected routerOptions: RouterOptions = {
defaultPage: "dashboard",
routes: {
@@ -53,7 +51,6 @@ class HaConfigDevices extends HassRouterPage {
pageEl.manifests = this._manifests;
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.showAdvanced = this.showAdvanced;
pageEl.route = this.routeTail;
}
@@ -68,8 +68,6 @@ class HaConfigEnergy extends LitElement {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public route!: Route;
@state() private _searchParms = new URLSearchParams(window.location.search);
-1
View File
@@ -819,7 +819,6 @@ class HaPanelConfig extends HassRouterPage {
el.route = this.routeTail;
el.hass = this.hass;
el.showAdvanced = Boolean(this.hass.userData?.showAdvanced);
el.isWide = isWide;
el.narrow = this.narrow;
el.cloudStatus = this._cloudStatus;
@@ -1214,7 +1214,6 @@ ${rejected
showConfigFlowDialog(this, {
startFlowHandler: domain,
manifest: await fetchIntegrationManifest(this.hass, domain),
showAdvanced: this.hass.userData?.showAdvanced,
});
}
-2
View File
@@ -92,8 +92,6 @@ class HaConfigInfo extends LitElement {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public route!: Route;
@state() private _osInfo?: HassioHassOSInfo;
@@ -761,7 +761,6 @@ class AddIntegrationDialog extends LitElement {
showConfigFlowDialog(this, {
startFlowHandler: domain,
showAdvanced: this.hass.userData?.showAdvanced,
manifest,
navigateToResult: this._navigateToResult,
});
@@ -626,7 +626,6 @@ export class HaConfigEntryRow extends LitElement {
private _handleReconfigure = async () => {
showConfigFlowDialog(this, {
startFlowHandler: this.data.entry.domain,
showAdvanced: this.hass.userData?.showAdvanced,
manifest: await fetchIntegrationManifest(
this.hass,
this.data.entry.domain
@@ -138,8 +138,6 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public configEntries?: ConfigEntry[];
@property({ attribute: false })
@@ -129,8 +129,6 @@ class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public route!: Route;
@property({ attribute: false }) public configEntries?: ConfigEntryExtended[];
@@ -989,7 +987,6 @@ class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
this.hass,
integration.supported_by!
),
showAdvanced: this.hass.userData?.showAdvanced,
});
},
});
@@ -51,8 +51,6 @@ class HaConfigIntegrations extends SubscribeMixin(HassRouterPage) {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
protected routerOptions: RouterOptions = {
defaultPage: "dashboard",
routes: {
@@ -207,7 +205,6 @@ class HaConfigIntegrations extends SubscribeMixin(HassRouterPage) {
pageEl.configEntriesInProgress = this._configEntriesInProgress;
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.showAdvanced = this.showAdvanced;
}
}
@@ -318,7 +318,6 @@ class HaDomainIntegrations extends LitElement {
root instanceof ShadowRoot ? (root.host as HTMLElement) : this,
{
startFlowHandler: domain,
showAdvanced: this.hass.userData?.showAdvanced,
navigateToResult: this.navigateToResult,
manifest: await fetchIntegrationManifest(this.hass, domain),
}
@@ -337,7 +336,6 @@ class HaDomainIntegrations extends LitElement {
{
continueFlowId: flow.flow_id,
navigateToResult: this.navigateToResult,
showAdvanced: this.hass.userData?.showAdvanced,
manifest: await fetchIntegrationManifest(this.hass, flow.handler),
}
);
@@ -506,7 +506,6 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
this._refresh();
},
startFlowHandler: "otbr",
showAdvanced: this.hass.userData?.showAdvanced,
});
}
@@ -27,8 +27,6 @@ class HaConfigScript extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public cloudStatus?: CloudStatus;
@property({ attribute: false }) public scripts: ScriptEntity[] = [];
@@ -78,7 +76,6 @@ class HaConfigScript extends HassRouterPage {
pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide;
pageEl.route = this.routeTail;
pageEl.showAdvanced = this.showAdvanced;
pageEl.cloudStatus = this.cloudStatus;
if (this.hass) {
+1 -1
View File
@@ -560,7 +560,7 @@ export class HaScriptEditor extends SubscribeMixin(
if (stateObj?.state !== UNAVAILABLE) {
return;
}
const validation = await validateConfig(this.hass.callWS, {
const validation = await validateConfig(this.hass, {
actions: this.config.sequence,
});
this.validationErrors = (
@@ -1,78 +0,0 @@
import type { TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import "../../components/ha-alert";
import "../../components/ha-card";
import "../../components/ha-switch";
import "../../components/item/ha-row-item";
import type { CoreFrontendUserData } from "../../data/frontend";
import { saveFrontendUserData } from "../../data/frontend";
import type { HomeAssistant } from "../../types";
import { documentationUrl } from "../../util/documentation-url";
@customElement("ha-advanced-mode-row")
class AdvancedModeRow extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public coreUserData?: CoreFrontendUserData;
@state() private _error?: string;
protected render(): TemplateResult {
return html`
${this._error
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
: nothing}
<ha-row-item>
<span slot="headline"
>${this.hass.localize("ui.panel.profile.advanced_mode.title")}</span
>
<span slot="supporting-text"
>${this.hass.localize("ui.panel.profile.advanced_mode.description")}
<a
href=${documentationUrl(
this.hass,
"/blog/2019/07/17/release-96/#advanced-mode"
)}
target="_blank"
rel="noreferrer"
>${this.hass.localize("ui.panel.profile.advanced_mode.link_promo")}
</a></span
>
<ha-switch
slot="end"
.checked=${!!this.coreUserData && !!this.coreUserData.showAdvanced}
.disabled=${this.coreUserData === undefined}
@change=${this._advancedToggled}
></ha-switch>
</ha-row-item>
`;
}
private async _advancedToggled(ev) {
try {
saveFrontendUserData(this.hass.connection, "core", {
...this.coreUserData,
showAdvanced: ev.currentTarget.checked,
});
} catch (err: any) {
this._error = err.message || err;
}
}
static styles = css`
a {
color: var(--primary-color);
}
ha-alert {
margin: 0 16px;
display: block;
}
`;
}
declare global {
interface HTMLElementTagNameMap {
"ha-advanced-mode-row": AdvancedModeRow;
}
}
@@ -17,7 +17,6 @@ import "../../layouts/hass-tabs-subpage";
import { haStyle } from "../../resources/styles";
import type { HomeAssistant, Route } from "../../types";
import { isMobileClient } from "../../util/is_mobile";
import "./ha-advanced-mode-row";
import "./ha-enable-shortcuts-row";
import "./ha-entity-id-picker-row";
import "./ha-force-narrow-row";
@@ -166,14 +165,6 @@ class HaProfileSectionGeneral extends LitElement {
)}
</ha-button>
</ha-row-item>
${this.hass.user!.is_admin
? html`
<ha-advanced-mode-row
.hass=${this.hass}
.coreUserData=${this._coreUserData}
></ha-advanced-mode-row>
`
: nothing}
${this.hass.user!.is_admin
? html`
<ha-entity-id-picker-row
@@ -289,11 +280,6 @@ class HaProfileSectionGeneral extends LitElement {
display: block;
margin: 24px 0;
}
.promo-advanced {
text-align: center;
color: var(--secondary-text-color);
}
`,
];
}
-1
View File
@@ -285,7 +285,6 @@ class PanelTodo extends LitElement {
private async _addList(): Promise<void> {
showConfigFlowDialog(this, {
startFlowHandler: "local_todo",
showAdvanced: this.hass.userData?.showAdvanced,
manifest: await fetchIntegrationManifest(this.hass, "local_todo"),
});
}
-5
View File
@@ -10703,11 +10703,6 @@
"close": "Close",
"submit": "Submit"
},
"advanced_mode": {
"title": "Advanced mode",
"description": "Unlocks advanced features.",
"link_promo": "Learn more"
},
"entity_id_picker": {
"title": "Display entity IDs in picker",
"description": "Shows the full entity IDs when selecting entities from a menu list."