diff --git a/src/editor/StrategyEditor.ts b/src/editor/StrategyEditor.ts index 24d3b1f0..61be00ba 100644 --- a/src/editor/StrategyEditor.ts +++ b/src/editor/StrategyEditor.ts @@ -1421,6 +1421,9 @@ class Simon42DashboardStrategyEditor extends LitElement { const showLocksInRooms = this._config.show_locks_in_rooms === true; const showAutomationsInRooms = this._config.show_automations_in_rooms === true; const showScriptsInRooms = this._config.show_scripts_in_rooms === true; + // Window / door contact badges default to visible — read as opt-out (!== false). + const showWindowContactsInRooms = this._config.show_window_contacts_in_rooms !== false; + const showDoorContactsInRooms = this._config.show_door_contacts_in_rooms !== false; const useDefaultAreaSort = this._config.use_default_area_sort === true; const allAreas = Object.values(this._hass!.areas).sort((a, b) => a.name.localeCompare(b.name)); @@ -1455,6 +1458,14 @@ class Simon42DashboardStrategyEditor extends LitElement { (checked) => this._toggleChanged('show_scripts_in_rooms', checked, false))}
${localize('editor.show_scripts_in_rooms_desc')}
+ ${this._renderCheckbox('show-window-contacts-in-rooms', localize('editor.show_window_contacts_in_rooms'), showWindowContactsInRooms, + (checked) => this._toggleChanged('show_window_contacts_in_rooms', checked, true))} +
${localize('editor.show_window_contacts_in_rooms_desc')}
+ + ${this._renderCheckbox('show-door-contacts-in-rooms', localize('editor.show_door_contacts_in_rooms'), showDoorContactsInRooms, + (checked) => this._toggleChanged('show_door_contacts_in_rooms', checked, true))} +
${localize('editor.show_door_contacts_in_rooms_desc')}
+ ${this._renderCheckbox('use-default-area-sort', localize('editor.use_default_area_sort'), useDefaultAreaSort, (checked) => this._toggleChanged('use_default_area_sort', checked, false))}
${localize('editor.use_default_area_sort_desc')}
diff --git a/src/types/strategy.ts b/src/types/strategy.ts index f8696f4a..75310d40 100644 --- a/src/types/strategy.ts +++ b/src/types/strategy.ts @@ -43,8 +43,8 @@ export interface Simon42StrategyConfig { show_locks_in_rooms?: boolean; // default: false show_automations_in_rooms?: boolean; // default: false show_scripts_in_rooms?: boolean; // default: false - show_window_contacts_in_rooms?: boolean; // default: false - show_door_contacts_in_rooms?: boolean; // default: false + show_window_contacts_in_rooms?: boolean; // default: true (opt-out — set false to hide window contact badges) + show_door_contacts_in_rooms?: boolean; // default: true (opt-out — set false to hide door contact badges) show_switches_on_areas?: boolean; // default: false show_alerts_on_areas?: boolean; // default: false energy_link_dashboard?: boolean; // default: true diff --git a/src/views/RoomViewStrategy.ts b/src/views/RoomViewStrategy.ts index 45788e3f..6f772484 100644 --- a/src/views/RoomViewStrategy.ts +++ b/src/views/RoomViewStrategy.ts @@ -295,8 +295,14 @@ class Simon42ViewRoomStrategy extends HTMLElement { } // Window/door: show ALL matches (not just first), users control via per-area hidden[] - for (const id of sensorEntities.window) addCandidate(id, 'window', 'window'); - for (const id of sensorEntities.door) addCandidate(id, 'door', 'door'); + // Per-domain opt-out via show_window_contacts_in_rooms / show_door_contacts_in_rooms + // (default true — preserves prior behavior; set false to silence the badge type). + if (dashboardConfig.show_window_contacts_in_rooms !== false) { + for (const id of sensorEntities.window) addCandidate(id, 'window', 'window'); + } + if (dashboardConfig.show_door_contacts_in_rooms !== false) { + for (const id of sensorEntities.door) addCandidate(id, 'door', 'door'); + } // Apply per-area badge config: filter hidden, append additional let filteredCandidates = candidates;