Skip to content

Commit 696f29a

Browse files
authored
Remove advanced option for settings_group (#201)
1 parent 5830ed3 commit 696f29a

File tree

3 files changed

+63
-67
lines changed

3 files changed

+63
-67
lines changed

src/components/knx-configure-entity.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,8 @@ export class KNXConfigureEntity extends LitElement {
7676
}
7777

7878
generateRootGroups(schema: SettingsGroup[], errors?: ErrorDescription[]) {
79-
const regular_items: SettingsGroup[] = [];
80-
const advanced_items: SettingsGroup[] = [];
81-
82-
schema.forEach((item: SettingsGroup) => {
83-
if (item.advanced) {
84-
advanced_items.push(item);
85-
} else {
86-
regular_items.push(item);
87-
}
88-
});
8979
return html`
90-
${regular_items.map((group: SettingsGroup) => this._generateSettingsGroup(group, errors))}
91-
${advanced_items.length
92-
? html` <ha-expansion-panel .header=${"Advanced"} outlined>
93-
${advanced_items.map((group: SettingsGroup) =>
94-
this._generateSettingsGroup(group, errors),
95-
)}
96-
</ha-expansion-panel>`
97-
: nothing}
80+
${schema.map((group: SettingsGroup) => this._generateSettingsGroup(group, errors))}
9881
`;
9982
}
10083

src/components/knx-sync-state-selector-row.ts

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,46 +38,49 @@ export class KnxSyncStateSelectorRow extends LitElement {
3838
}
3939

4040
protected render(): TemplateResult {
41-
return html` <div class="inline">
42-
<ha-selector-select
43-
.hass=${this.hass}
44-
.label=${"Strategy"}
45-
.selector=${{
46-
select: {
47-
multiple: false,
48-
custom_value: false,
49-
mode: "dropdown",
50-
options: [
51-
{ value: true, label: "Default" },
52-
...(this.noneValid ? [{ value: false, label: "Never" }] : []),
53-
{ value: "init", label: "Once when connection established" },
54-
{ value: "expire", label: "Expire after last value update" },
55-
{ value: "every", label: "Scheduled every" },
56-
],
57-
},
58-
}}
59-
.key=${"strategy"}
60-
.value=${this._strategy}
61-
@value-changed=${this._handleChange}
62-
>
63-
</ha-selector-select>
64-
<ha-selector-number
65-
.hass=${this.hass}
66-
.disabled=${!this._hasMinutes(this._strategy)}
67-
.selector=${{
68-
number: {
69-
min: 2,
70-
max: 1440,
71-
step: 1,
72-
unit_of_measurement: "minutes",
73-
},
74-
}}
75-
.key=${"minutes"}
76-
.value=${this._minutes}
77-
@value-changed=${this._handleChange}
78-
>
79-
</ha-selector-number>
80-
</div>`;
41+
return html` <p class="description">
42+
Actively request state updates from KNX bus for state addresses.
43+
</p>
44+
<div class="inline">
45+
<ha-selector-select
46+
.hass=${this.hass}
47+
.label=${"Strategy"}
48+
.selector=${{
49+
select: {
50+
multiple: false,
51+
custom_value: false,
52+
mode: "dropdown",
53+
options: [
54+
{ value: true, label: "Default" },
55+
...(this.noneValid ? [{ value: false, label: "Never" }] : []),
56+
{ value: "init", label: "Once when connection established" },
57+
{ value: "expire", label: "Expire after last value update" },
58+
{ value: "every", label: "Scheduled every" },
59+
],
60+
},
61+
}}
62+
.key=${"strategy"}
63+
.value=${this._strategy}
64+
@value-changed=${this._handleChange}
65+
>
66+
</ha-selector-select>
67+
<ha-selector-number
68+
.hass=${this.hass}
69+
.disabled=${!this._hasMinutes(this._strategy)}
70+
.selector=${{
71+
number: {
72+
min: 2,
73+
max: 1440,
74+
step: 1,
75+
unit_of_measurement: "minutes",
76+
},
77+
}}
78+
.key=${"minutes"}
79+
.value=${this._minutes}
80+
@value-changed=${this._handleChange}
81+
>
82+
</ha-selector-number>
83+
</div>`;
8184
}
8285

8386
private _handleChange(ev) {
@@ -97,14 +100,28 @@ export class KnxSyncStateSelectorRow extends LitElement {
97100

98101
static get styles() {
99102
return css`
103+
.description {
104+
margin: 0;
105+
display: block;
106+
padding-top: 4px;
107+
padding-bottom: 8px;
108+
font-family: var(
109+
--mdc-typography-body2-font-family,
110+
var(--mdc-typography-font-family, Roboto, sans-serif)
111+
);
112+
-webkit-font-smoothing: antialiased;
113+
font-size: var(--mdc-typography-body2-font-size, 0.875rem);
114+
font-weight: var(--mdc-typography-body2-font-weight, 400);
115+
line-height: normal;
116+
color: var(--secondary-text-color);
117+
}
100118
.inline {
101119
width: 100%;
102120
display: inline-flex;
103121
flex-flow: row wrap;
104122
gap: 16px;
105123
justify-content: space-between;
106124
}
107-
108125
.inline > * {
109126
flex: 1;
110127
width: 100%; /* to not overflow when wrapped */

src/utils/schema.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import type { DPT } from "../types/websocket";
44
export type SettingsGroup = {
55
type: "settings_group";
66
heading: string;
7-
description: string;
7+
description?: string;
88
selectors: SelectorSchema[];
9-
advanced?: boolean;
109
collapsible?: boolean;
1110
};
1211

@@ -122,9 +121,8 @@ export const binarySensorSchema: SettingsGroup[] = [
122121
},
123122
{
124123
type: "settings_group",
125-
advanced: true,
124+
collapsible: true,
126125
heading: "State updater",
127-
description: "Actively request state updates from KNX bus for state addresses.",
128126
selectors: [
129127
{
130128
name: "sync_state",
@@ -169,9 +167,8 @@ export const switchSchema: SettingsGroup[] = [
169167
},
170168
{
171169
type: "settings_group",
172-
advanced: true,
170+
collapsible: true,
173171
heading: "State updater",
174-
description: "Actively request state updates from KNX bus for state addresses.",
175172
selectors: [
176173
{
177174
name: "sync_state",
@@ -500,9 +497,8 @@ export const lightSchema: SettingsGroup[] = [
500497
},
501498
{
502499
type: "settings_group",
503-
advanced: true,
500+
collapsible: true,
504501
heading: "State updater",
505-
description: "Actively request state updates from KNX bus for state addresses.",
506502
selectors: [
507503
{
508504
name: "sync_state",

0 commit comments

Comments
 (0)