diff --git a/config/dashboards/infrastructure/card_mod/native_button.yaml b/config/dashboards/infrastructure/card_mod/native_button.yaml new file mode 100644 index 00000000..2a00f6c5 --- /dev/null +++ b/config/dashboards/infrastructure/card_mod/native_button.yaml @@ -0,0 +1,23 @@ +###################################################################### +# @CCOSTAN - Follow Me on X +# For more info visit https://www.vcloudinfo.com/click-here +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig +# ------------------------------------------------------------------- +# Native dashboard buttons - large, wrapping controls +# ------------------------------------------------------------------- +# Notes: Home Assistant supplies action handling and accessible names. +###################################################################### + +| + ha-card.type-button { + min-height: 112px; + padding: 12px 10px; + border-radius: 20px; + flex-direction: row; + gap: 8px; + font-size: 18px; + font-weight: 700; + } + ha-card ha-state-icon { width: 28px; flex-shrink: 0; } + ha-card ha-state-icon + span { margin: 0; white-space: normal; overflow-wrap: anywhere; } + ha-card:focus-visible { outline: 3px solid var(--primary-color); outline-offset: -3px; } diff --git a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml index 8666e40c..4497827e 100644 --- a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml +++ b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml @@ -106,9 +106,12 @@ template: bearstone_infra_panel_header name: Host Updates - - type: grid - columns: 3 - square: false + - type: custom:layout-card + layout_type: custom:grid-layout + layout: + grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)) + grid-gap: 8px + margin: 0 cards: - type: custom:button-card template: bearstone_infra_update_tile diff --git a/config/dashboards/infrastructure/partials/home_sections.yaml b/config/dashboards/infrastructure/partials/home_sections.yaml index 934ae903..872bd2ff 100644 --- a/config/dashboards/infrastructure/partials/home_sections.yaml +++ b/config/dashboards/infrastructure/partials/home_sections.yaml @@ -37,14 +37,11 @@ columns: full layout_type: custom:grid-layout layout: - grid-template-columns: repeat(6, minmax(0, 1fr)) + grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)) grid-auto-flow: row grid-auto-rows: min-content grid-gap: 12px margin: 0 - mediaquery: - "(max-width: 900px)": - grid-template-columns: repeat(2, minmax(0, 1fr)) cards: - !include /config/dashboards/infrastructure/partials/informational_notices.yaml - type: custom:button-card @@ -289,14 +286,11 @@ columns: full layout_type: custom:grid-layout layout: - grid-template-columns: repeat(3, minmax(0, 1fr)) + grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)) grid-auto-flow: row grid-auto-rows: min-content grid-gap: 12px margin: 0 - mediaquery: - "(max-width: 900px)": - grid-template-columns: repeat(1, minmax(0, 1fr)) cards: - type: custom:vertical-stack-in-card card_mod: @@ -353,7 +347,7 @@ if ([latency, loss].some((item) => item === null)) issues.push('QUALITY TELEMETRY MISSING'); if (latency !== null && latency > 80) issues.push(`LATENCY ${latency.toFixed(0)} > 80 ms`); if (loss !== null && loss > 5) issues.push(`LOSS ${loss.toFixed(1)}% > 5%`); - return issues.join(' · '); + return issues.join(' \u00b7 '); ]]] state_display: > [[[ @@ -406,7 +400,7 @@ }; const raw = entity?.attributes?.problem_entities; const ids = Array.isArray(raw) ? raw : []; - return ids.map((id) => `${labels[id] || id} ${String(states[id]?.state ?? 'unknown').toUpperCase()}`).join(' · '); + return ids.map((id) => `${labels[id] || id} ${String(states[id]?.state ?? 'unknown').toUpperCase()}`).join(' \u00b7 '); ]]] state_display: '[[[ return "ATTENTION"; ]]]' tap_action: @@ -423,7 +417,7 @@ exception_detail: > [[[ const issues = Array.isArray(entity?.attributes?.issues) ? entity.attributes.issues : []; - return issues.map((issue) => `${issue.name}: ${issue.alarm || issue.status}`).join(' · '); + return issues.map((issue) => `${issue.name}: ${issue.alarm || issue.status}`).join(' \u00b7 '); ]]] state_display: > [[[ return states['binary_sensor.infra_ups_on_battery']?.state === 'on' ? 'ON BATTERY' : 'CHECK'; ]]] @@ -457,7 +451,7 @@ [[[ const value = Number(entity?.state); return Number.isFinite(value) - ? `RUNTIME ${value.toFixed(0)} / 550 H · FILTER CHANGE DUE` + ? `RUNTIME ${value.toFixed(0)} / 550 H \u00b7 FILTER CHANGE DUE` : 'FILTER RUNTIME TELEMETRY UNAVAILABLE'; ]]] state_display: MAINTENANCE @@ -478,7 +472,7 @@ [[[ const value = Number(entity?.state); return Number.isFinite(value) - ? `RUNTIME ${value.toFixed(0)} / 450 H · FILTER CHANGE DUE` + ? `RUNTIME ${value.toFixed(0)} / 450 H \u00b7 FILTER CHANGE DUE` : 'FILTER RUNTIME TELEMETRY UNAVAILABLE'; ]]] state_display: MAINTENANCE @@ -499,7 +493,7 @@ [[[ const value = Number(entity?.state); return Number.isFinite(value) - ? `ELAPSED ${value.toFixed(0)} / 360 DAYS · LINE CLEANING DUE` + ? `ELAPSED ${value.toFixed(0)} / 360 DAYS \u00b7 LINE CLEANING DUE` : 'CONDENSER MAINTENANCE TELEMETRY UNAVAILABLE'; ]]] state_display: MAINTENANCE @@ -541,7 +535,7 @@ if (states['binary_sensor.upstairs_kiosk_needs_attention']?.state === 'on') issues.push(`UPSTAIRS: ${String(upstairs ?? 'ATTENTION').toUpperCase()}`); if (states['binary_sensor.office_kiosk_needs_attention']?.state === 'on') issues.push(`OFFICE: ${String(office ?? 'ATTENTION').toUpperCase()}`); if (states['binary_sensor.living_room_nest_kiosk_needs_attention']?.state === 'on') issues.push(`LIVING ROOM NEST: ${String(states['binary_sensor.living_room_nest_kiosk_needs_attention']?.attributes?.status ?? 'ATTENTION').toUpperCase()}`); - return issues.join(' · ') || 'KIOSK TELEMETRY REQUIRES REVIEW'; + return issues.join(' \u00b7 ') || 'KIOSK TELEMETRY REQUIRES REVIEW'; ]]] state_display: '[[[ return "ATTENTION"; ]]]' tap_action: @@ -685,7 +679,7 @@ issues.push(`${label} ${value.toFixed(1)}% > ${limit}%`); } } - return issues.join(' · '); + return issues.join(' \u00b7 '); ]]] state_display: '[[[ return "ATTENTION"; ]]]' @@ -709,7 +703,7 @@ return items.map((item) => { const [id, state] = String(item).split('='); return `${labels[id] || id} ${String(state || 'down').toUpperCase()}`; - }).join(' · '); + }).join(' \u00b7 '); ]]] state_display: '[[[ return "DOWN"; ]]]' tap_action: @@ -923,7 +917,7 @@ const seconds = Number(states['sensor.garage_ups_battery_runtime']?.state); const battery = Number.isFinite(charge) ? `${charge.toFixed(0)}%` : 'NO BATTERY DATA'; const runtime = Number.isFinite(seconds) ? `${Math.floor(seconds / 60)}m` : 'NO RUNTIME'; - return `${String(entity?.state ?? 'NO DATA').toUpperCase()} · ${battery} · ${runtime}`; + return `${String(entity?.state ?? 'NO DATA').toUpperCase()} \u00b7 ${battery} \u00b7 ${runtime}`; ]]] tap_action: action: navigate @@ -940,7 +934,7 @@ const seconds = Number(states['sensor.office_ups_eaton_550_battery_runtime']?.state); const battery = Number.isFinite(charge) ? `${charge.toFixed(0)}%` : 'NO BATTERY DATA'; const runtime = Number.isFinite(seconds) ? `${Math.floor(seconds / 60)}m` : 'NO RUNTIME'; - return `${String(entity?.state ?? 'NO DATA').toUpperCase()} · ${battery} · ${runtime}`; + return `${String(entity?.state ?? 'NO DATA').toUpperCase()} \u00b7 ${battery} \u00b7 ${runtime}`; ]]] tap_action: action: navigate @@ -957,7 +951,7 @@ const seconds = Number(states['sensor.office_ups_cyberpower_battery_runtime']?.state); const battery = Number.isFinite(charge) ? `${charge.toFixed(0)}%` : 'NO BATTERY DATA'; const runtime = Number.isFinite(seconds) ? `${Math.floor(seconds / 60)}m` : 'NO RUNTIME'; - return `${String(entity?.state ?? 'NO DATA').toUpperCase()} · ${battery} · ${runtime}`; + return `${String(entity?.state ?? 'NO DATA').toUpperCase()} \u00b7 ${battery} \u00b7 ${runtime}`; ]]] tap_action: action: navigate diff --git a/config/dashboards/infrastructure/partials/hvac_sections.yaml b/config/dashboards/infrastructure/partials/hvac_sections.yaml index ba623e60..501aa264 100644 --- a/config/dashboards/infrastructure/partials/hvac_sections.yaml +++ b/config/dashboards/infrastructure/partials/hvac_sections.yaml @@ -381,7 +381,8 @@ {% from 'downstairs_hvac.jinja' import downstairs_policy %} {% set plan = downstairs_policy() | from_json %} {% set labels = {'day schedule': 'Daytime schedule', 'sleep schedule': 'Bedtime schedule', - 'guest mode': 'Guest Mode', 'family away': 'Away Eco', 'manual temperature': 'Manual temperature hold', + 'humidity cycle': 'Drying downstairs air', 'guest mode': 'Guest Mode', + 'family away': 'Away Eco', 'manual temperature': 'Manual temperature hold', 'manual eco': 'Manual Eco hold', 'manual off': 'Manually switched off', 'grid outage': 'Grid outage protection', 'entry open': 'Open-door/window protection'} %} {% set climate_ok = has_value('climate.downstairs') %} @@ -393,6 +394,21 @@ {% endif %} + {% set humidity = states('sensor.downstairs_humidity') %} + **Downstairs humidity** {{ humidity ~ '%' if is_number(humidity) else 'reading unavailable' }}. + {% if climate_ok and plan.reason == 'humidity cycle' %} + {% set deadline = as_timestamp(state_attr('timer.downstairs_humidity_cycle', 'finishes_at'), none) %} + {% if deadline is not none %}This cycle ends by {{ (deadline | timestamp_custom('%I:%M %p')).lstrip('0') }}.{% endif %} + {% elif is_state('automation.humidity_control', 'off') %} + Humidity control is switched off. + {% endif %} + After a full hour above 60%, Home Assistant can set the cooling target to 75°F + if someone is home, the AC is idle, and downstairs is warmer than 75°F. + Drying ends at 58% humidity, at a room temperature of 75°F, or after 20 minutes, + whichever comes first. The current schedule or hold then resumes. + Cycles start at least two hours apart. + + **Next routine change:** {% if plan.phase == 'day' %} 77°F after both beds are occupied for 6 minutes, from sunset until 8:00 a.m. @@ -401,7 +417,7 @@ {% else %} Waiting for the day/bedtime period. {% endif %} - Guest Mode, manual holds, Eco and protections can take priority. + Guest Mode, manual holds, away Eco, and door or power protections take priority over scheduled cooling and drying. - **Daily rhythm:** 80°F from 8:00 a.m. until bedtime; 77°F overnight. diff --git a/config/dashboards/infrastructure/partials/network_sections.yaml b/config/dashboards/infrastructure/partials/network_sections.yaml index e7549598..32514e4e 100644 --- a/config/dashboards/infrastructure/partials/network_sections.yaml +++ b/config/dashboards/infrastructure/partials/network_sections.yaml @@ -108,10 +108,10 @@ grid-gap: 12px margin: 0 mediaquery: - "(max-width: 1200px)": - grid-template-columns: repeat(2, minmax(0, 1fr)) "(max-width: 900px)": grid-template-columns: repeat(1, minmax(0, 1fr)) + "(max-width: 1200px)": + grid-template-columns: repeat(2, minmax(0, 1fr)) cards: - type: custom:vertical-stack-in-card card_mod: @@ -321,13 +321,13 @@ state_display: > [[[ return String(entity?.state ?? 'NO DATA').toUpperCase(); ]]] - - type: custom:button-card - template: bearstone_infra_list_row - entity: binary_sensor.infra_dns_pihole_degraded + # Native navigation button exposes the shortcut to keyboard and VoiceOver. + - type: button name: Open Pi-hole Controls icon: mdi:chart-box-outline - state_display: > - [[[ return 'OPEN'; ]]] + icon_height: 24px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: navigate navigation_path: /dashboard-infrastructure/pihole @@ -404,13 +404,13 @@ return `${next.name.toUpperCase()} | ${Math.round(next.days)} DAYS | ${date}`; ]]] - - type: custom:button-card - template: bearstone_infra_list_row - entity: binary_sensor.infra_website_degraded + # Native navigation button exposes the shortcut to keyboard and VoiceOver. + - type: button name: Open Website Details icon: mdi:chart-box-outline - state_display: > - [[[ return 'OPEN'; ]]] + icon_height: 24px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: navigate navigation_path: /dashboard-infrastructure/website-health diff --git a/config/dashboards/infrastructure/templates/button_card_templates.yaml b/config/dashboards/infrastructure/templates/button_card_templates.yaml index f413a7b2..fa38680d 100644 --- a/config/dashboards/infrastructure/templates/button_card_templates.yaml +++ b/config/dashboards/infrastructure/templates/button_card_templates.yaml @@ -209,6 +209,24 @@ bearstone_infra_tile: - border-color: rgba(229,57,53,0.35) - background: rgba(255,235,238,0.85) +# Album counts and instructions can each take a full line on an iPhone. +bearstone_infra_album_summary: + template: bearstone_infra_tile + styles: + grid: + - grid-template-areas: '"i n" "i s" "i l"' + - grid-template-columns: 28px minmax(0, 1fr) + - grid-template-rows: repeat(3, auto) + - row-gap: 3px + name: + - white-space: normal + state: + - white-space: normal + label: + - white-space: normal + - overflow-wrap: anywhere + - text-align: left + bearstone_infra_reboot: template: bearstone_infra_tile show_state: false @@ -774,6 +792,8 @@ bearstone_infra_panel_header: - letter-spacing: 0.04em - text-transform: uppercase - justify-self: start + - white-space: normal + - text-align: left bearstone_infra_panel_header_icon: template: bearstone_infra_panel_header @@ -838,7 +858,7 @@ bearstone_infra_list_row: - box-sizing: border-box grid: - grid-template-areas: "\"i n s\"" - - grid-template-columns: 24px 1fr auto + - grid-template-columns: 24px minmax(0, 1fr) fit-content(50%) - align-items: center - column-gap: 10px icon: @@ -855,9 +875,9 @@ bearstone_infra_list_row: - justify-self: start - opacity: 0.95 - min-width: 0 - - overflow: hidden - - text-overflow: ellipsis - - white-space: nowrap + - white-space: normal + - overflow-wrap: anywhere + - text-align: left state: - justify-self: end - font-weight: 700 @@ -871,7 +891,9 @@ bearstone_infra_list_row: - opacity: > [[[ return variables?.numeric_warning_active ? 1 : 0.8; ]]] - padding-left: 8px - - white-space: nowrap + - white-space: normal + - overflow-wrap: anywhere + - text-align: right bearstone_infra_alert_row: template: bearstone_infra_list_row @@ -895,7 +917,6 @@ bearstone_infra_alert_row: styles: grid: - grid-template-areas: '"i n s" "i l l"' - - grid-template-columns: 24px 1fr auto - grid-template-rows: min-content min-content card: - border-color: > @@ -1041,7 +1062,7 @@ bearstone_infra_kpi: grid: - grid-template-areas: '"i n" "s s"' - grid-template-columns: 18px minmax(0, auto) - - grid-template-rows: 20px min-content + - grid-template-rows: minmax(20px, min-content) min-content - column-gap: 6px - row-gap: 5px - justify-content: center @@ -1057,11 +1078,15 @@ bearstone_infra_kpi: - text-align: left - letter-spacing: 0.6px - justify-self: start + - white-space: normal + - overflow-wrap: anywhere state: - font-size: 16px - font-weight: 800 - opacity: 0.9 - justify-self: center + - white-space: normal + - overflow-wrap: anywhere bearstone_infra_status_kpi: template: bearstone_infra_kpi @@ -1138,7 +1163,7 @@ bearstone_infra_status_kpi: styles: grid: - grid-template-areas: '[[[ return variables?.show_detail ? `"i n" "s s" "l l"` : `"i n" "s s"`; ]]]' - - grid-template-rows: '[[[ return variables?.show_detail ? "20px min-content min-content" : "20px min-content"; ]]]' + - grid-auto-rows: min-content label: - grid-area: l - white-space: normal @@ -1269,12 +1294,11 @@ bearstone_overview_ribbon_control: return mobile ? 'rgba(183,28,28,0.96)' : 'rgba(255,235,238,0.85)'; ]]] grid: - - grid-template-areas: > - [[[ return variables?.mobile_compact ? '"i n" "s s"' : '"i n" "i s"'; ]]] + - grid-template-areas: '"i n" "s s"' - grid-template-columns: > [[[ return variables?.mobile_compact ? '18px minmax(0, auto)' : '28px 1fr'; ]]] - grid-template-rows: > - [[[ return variables?.mobile_compact ? '18px 12px' : 'min-content min-content'; ]]] + [[[ return variables?.mobile_compact ? 'minmax(18px, min-content) min-content' : 'min-content min-content'; ]]] - column-gap: > [[[ return variables?.mobile_compact ? '5px' : '0'; ]]] - row-gap: > @@ -1313,12 +1337,8 @@ bearstone_overview_ribbon_control: [[[ return variables?.mobile_compact ? '12px' : 'normal'; ]]] - justify-self: > [[[ return 'start'; ]]] - - white-space: > - [[[ return variables?.mobile_compact ? 'normal' : 'nowrap'; ]]] - - overflow: > - [[[ return variables?.mobile_compact ? 'visible' : 'hidden'; ]]] - - text-overflow: > - [[[ return variables?.mobile_compact ? 'clip' : 'ellipsis'; ]]] + - white-space: normal + - overflow-wrap: anywhere - text-align: > [[[ return 'left'; ]]] - opacity: 1 @@ -1339,6 +1359,8 @@ bearstone_overview_ribbon_control: [[[ return variables?.mobile_compact ? '12px' : 'normal'; ]]] - justify-self: > [[[ return variables?.mobile_compact ? 'center' : 'start'; ]]] + - white-space: normal + - overflow-wrap: anywhere - opacity: 1 bearstone_mobile_header: @@ -1462,8 +1484,8 @@ bearstone_health_kpi: - grid-template-rows: > [[[ return variables?.detail_layout - ? '20px min-content minmax(18px, auto)' - : '20px min-content'; + ? 'minmax(20px, max-content) min-content minmax(18px, auto)' + : 'minmax(20px, max-content) min-content'; ]]] - column-gap: 6px - justify-content: center @@ -1614,8 +1636,8 @@ bearstone_infra_update_tile: - padding: 10px grid: - grid-template-areas: '"i n" "s s" "l l"' - - grid-template-columns: 18px minmax(0, auto) - - grid-template-rows: 20px min-content min-content + - grid-template-columns: 18px minmax(0, 1fr) + - grid-template-rows: minmax(20px, max-content) min-content min-content - column-gap: 6px - row-gap: 3px - justify-content: center @@ -1625,6 +1647,7 @@ bearstone_infra_update_tile: name: - justify-self: start - text-align: left + - overflow-wrap: anywhere - white-space: normal state: - justify-self: start diff --git a/config/dashboards/infrastructure/views/05za_nest_album.yaml b/config/dashboards/infrastructure/views/05za_nest_album.yaml index 3e70ac9c..609ca2c7 100644 --- a/config/dashboards/infrastructure/views/05za_nest_album.yaml +++ b/config/dashboards/infrastructure/views/05za_nest_album.yaml @@ -27,7 +27,7 @@ sections: columns: full cards: - type: custom:button-card - template: bearstone_infra_tile + template: bearstone_infra_album_summary entity: sensor.living_room_nest_album name: Nest photo album icon: mdi:image-multiple diff --git a/config/dashboards/infrastructure/views/05za_tv_remote.yaml b/config/dashboards/infrastructure/views/05za_tv_remote.yaml index 8846036b..35a6410b 100644 --- a/config/dashboards/infrastructure/views/05za_tv_remote.yaml +++ b/config/dashboards/infrastructure/views/05za_tv_remote.yaml @@ -7,6 +7,7 @@ # Related Issue: 2030 # Large navigation, input/settings menus, and the Raven app launcher. # ------------------------------------------------------------------- +# Notes: Native action buttons support keyboard navigation and screen readers. # Notes: Open from Living Room TV on the Kiosks page. # Notes: Each tap sends one key; Back and Exit control the TV menu. # Notes: TV Home exposes Sources; Settings opens TV sound and Anynet+ options. @@ -47,16 +48,16 @@ sections: view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: media_player.living_room_ultra name: Raven icon: mdi:view-dashboard-outline show_state: false - variables: - status_severity: healthy view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: rest_command.samsung_living_room_launch_haven @@ -66,16 +67,16 @@ sections: action: none # Samsung menus stay accessible without a physical TV remote. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: TV Home icon: mdi:home-outline show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -88,16 +89,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Settings icon: mdi:cog show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -111,16 +112,16 @@ sections: action: none # Full-width Up and Down keep every touch target large without spacers. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Up icon: mdi:arrow-up-bold show_state: false - variables: - status_severity: active view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -133,16 +134,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Left icon: mdi:arrow-left-bold show_state: false - variables: - status_severity: active view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -155,16 +156,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: OK icon: mdi:check-bold show_state: false - variables: - status_severity: healthy view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -177,16 +178,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Right icon: mdi:arrow-right-bold show_state: false - variables: - status_severity: active view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -199,16 +200,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Down icon: mdi:arrow-down-bold show_state: false - variables: - status_severity: active view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -222,16 +223,16 @@ sections: action: none # These buttons navigate the TV, rather than the Home Assistant screen. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Back icon: mdi:undo show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -244,16 +245,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.samsung_q70_series_65 name: Exit icon: mdi:close-circle-outline show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command diff --git a/config/dashboards/infrastructure/views/05zb_roku_remote.yaml b/config/dashboards/infrastructure/views/05zb_roku_remote.yaml index 9ec69dde..242e2be7 100644 --- a/config/dashboards/infrastructure/views/05zb_roku_remote.yaml +++ b/config/dashboards/infrastructure/views/05zb_roku_remote.yaml @@ -7,6 +7,7 @@ # Related Issue: 2030 # Native Roku navigation, playback, and the Raven app launcher. # ------------------------------------------------------------------- +# Notes: Native action buttons support keyboard navigation and screen readers. # Notes: Open from the Raven card or device panel on Systems > Kiosks. # Notes: Each tap sends one Roku command; Back/Home exit Raven natively. # Notes: TV menus remain on the separate Samsung TV Remote subview. @@ -45,16 +46,16 @@ sections: view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: media_player.living_room_ultra name: Raven icon: mdi:view-dashboard-outline show_state: false - variables: - status_severity: healthy view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: rest_command.samsung_living_room_launch_haven @@ -64,16 +65,16 @@ sections: action: none # Roku controls never send Samsung input or menu commands. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Roku Home icon: mdi:home-outline show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -86,16 +87,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Options icon: mdi:dots-horizontal show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -109,16 +110,16 @@ sections: action: none # Full-width Up and Down keep every touch target large without spacers. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Up icon: mdi:arrow-up-bold show_state: false - variables: - status_severity: active view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -131,16 +132,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Left icon: mdi:arrow-left-bold show_state: false - variables: - status_severity: active view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -153,16 +154,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: OK icon: mdi:check-bold show_state: false - variables: - status_severity: healthy view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -175,16 +176,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Right icon: mdi:arrow-right-bold show_state: false - variables: - status_severity: active view_layout: grid-column: span 2 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -197,16 +198,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Down icon: mdi:arrow-down-bold show_state: false - variables: - status_severity: active view_layout: grid-column: 1 / -1 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -220,16 +221,16 @@ sections: action: none # Back exits Raven; playback controls act on the current Roku app. - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Back icon: mdi:undo show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command @@ -242,16 +243,16 @@ sections: double_tap_action: action: none - - type: custom:button-card - template: bearstone_mobile_control + - type: button entity: remote.living_room_ultra name: Play / Pause icon: mdi:play-pause show_state: false - variables: - status_severity: active view_layout: grid-column: span 3 + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: remote.send_command diff --git a/config/dashboards/overview/partials/home_lighting.yaml b/config/dashboards/overview/partials/home_lighting.yaml index 0e805194..bb6891ba 100644 --- a/config/dashboards/overview/partials/home_lighting.yaml +++ b/config/dashboards/overview/partials/home_lighting.yaml @@ -32,43 +32,43 @@ cards: icon: mdi:lightbulb-group view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: On Now icon: mdi:lightbulb-on-outline show_state: false - variables: - status_severity: active tap_action: action: navigate navigation_path: /lovelace/lights - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: Indoor icon: mdi:home-lightbulb-outline show_state: false - variables: - status_severity: active tap_action: action: navigate navigation_path: /lovelace/lights-indoor - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: Exterior icon: mdi:outdoor-lamp show_state: false - variables: - status_severity: active tap_action: action: navigate navigation_path: /lovelace/lights-exterior - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: All Lights Off icon: mdi:lightbulb-group-off-outline show_state: false - variables: - status_severity: active tap_action: action: perform-action perform_action: script.turn_on diff --git a/config/dashboards/overview/partials/lighting_everyday_cards.yaml b/config/dashboards/overview/partials/lighting_everyday_cards.yaml index a2299890..02b7d9c9 100644 --- a/config/dashboards/overview/partials/lighting_everyday_cards.yaml +++ b/config/dashboards/overview/partials/lighting_everyday_cards.yaml @@ -4,109 +4,79 @@ # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig # ------------------------------------------------------------------- # Lighting - Everyday controls -# Shared Home and Lighting-menu cards; existing mobile templates own the styling. +# Shared Home and Lighting-menu cards; native tiles show the current state and support keyboard activation. # ------------------------------------------------------------------- # Notes: Living Room includes accents; Kitchen includes Sink via existing membership. ###################################################################### -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: light.living_room_lighting name: Living Room icon: mdi:sofa-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: light.kitchen_lights name: Kitchen icon: mdi:ceiling-light-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: group.kitchen_accents name: Kitchen Accents icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: group.master_bathroom_accents name: Bathroom Accents icon: mdi:vanity-light - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: switch.office_lamp_switch name: Office Lamp icon: mdi:desk-lamp - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info -- type: custom:button-card - template: bearstone_mobile_control +- type: tile entity: switch.front_office_lamp name: Front Office Lamp icon: mdi:desk-lamp - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: diff --git a/config/dashboards/overview/partials/lighting_tile_card_mod.yaml b/config/dashboards/overview/partials/lighting_tile_card_mod.yaml new file mode 100644 index 00000000..87990a1f --- /dev/null +++ b/config/dashboards/overview/partials/lighting_tile_card_mod.yaml @@ -0,0 +1,12 @@ +###################################################################### +# @CCOSTAN - Follow Me on X +# For more info visit https://www.vcloudinfo.com/click-here +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig +# ------------------------------------------------------------------- +# Lighting tiles - native state display and keyboard controls +# ------------------------------------------------------------------- +# Notes: The On Now template emits the same settings for its live list. +###################################################################### + +class: lighting-toggle +style: '@import url("/local/lighting-tile.css?v=275608177ba5");' diff --git a/config/dashboards/overview/sections/00_summary.yaml b/config/dashboards/overview/sections/00_summary.yaml index fd2ebc0d..74a848eb 100644 --- a/config/dashboards/overview/sections/00_summary.yaml +++ b/config/dashboards/overview/sections/00_summary.yaml @@ -9,7 +9,7 @@ # ------------------------------------------------------------------- # Notes: Equal-width pills keep the whole ribbon compact and consistent. # Notes: Thermostat pills use the climate cooling helpers for active light-blue shading. -# Notes: Mobile uses high-contrast four-column icon tiles with 64px tap targets. +# Notes: The ribbon fits columns to the available width and keeps 64px mobile tap targets. # Notes: Systems mirrors infrastructure severity: sustained degradation is amber and only critical faults are red. ###################################################################### @@ -23,7 +23,7 @@ cards: columns: full layout_type: custom:grid-layout layout: - grid-template-columns: repeat(7, minmax(0, 1fr)) + grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)) grid-auto-flow: row grid-auto-rows: min-content align-items: center @@ -31,7 +31,6 @@ cards: margin: 0 mediaquery: "(max-width: 600px)": - grid-template-columns: repeat(4, minmax(0, 1fr)) grid-gap: 4px cards: - !include /config/dashboards/infrastructure/partials/informational_notices.yaml diff --git a/config/dashboards/overview/views/02_mobile.yaml b/config/dashboards/overview/views/02_mobile.yaml index a7d7a0f8..9c002d0a 100644 --- a/config/dashboards/overview/views/02_mobile.yaml +++ b/config/dashboards/overview/views/02_mobile.yaml @@ -59,23 +59,23 @@ sections: action: navigate navigation_path: /lovelace/home - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: Lights & Switches icon: mdi:lightbulb-group show_state: false - variables: - status_severity: active tap_action: action: navigate navigation_path: /lovelace/lights - - type: custom:button-card - template: bearstone_mobile_control + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: All Lights Off icon: mdi:lightbulb-group-off-outline show_state: false - variables: - status_severity: active tap_action: action: perform-action perform_action: script.turn_on diff --git a/config/dashboards/overview/views/05_lights.yaml b/config/dashboards/overview/views/05_lights.yaml index d8e9a31e..6a463be4 100644 --- a/config/dashboards/overview/views/05_lights.yaml +++ b/config/dashboards/overview/views/05_lights.yaml @@ -6,6 +6,7 @@ # Overview Subview - Lighting # Shared lights-only All Off, active lights, everyday controls, and room menus. # ------------------------------------------------------------------- +# Notes: Native action buttons support keyboard navigation and screen readers. # Notes: Native Back returns to the Home or Mobile view used to enter. # Notes: On Now and All Off share custom_templates/lighting.jinja. ###################################################################### @@ -46,13 +47,13 @@ sections: icon: mdi:lightbulb-group view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: button name: All Lights Off icon: mdi:lightbulb-group-off-outline show_state: false - variables: - status_severity: active + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: perform-action perform_action: script.turn_on @@ -62,23 +63,23 @@ sections: action: none view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: button name: Indoor icon: mdi:home-lightbulb-outline show_state: false - variables: - status_severity: active + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: navigate navigation_path: /lovelace/lights-indoor - - type: custom:button-card - template: bearstone_mobile_control + - type: button name: Exterior icon: mdi:outdoor-lamp show_state: false - variables: - status_severity: active + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml tap_action: action: navigate navigation_path: /lovelace/lights-exterior @@ -117,9 +118,9 @@ sections: {% from 'lighting.jinja' import lighting_targets %} {% set cards = namespace(items=[]) %} {% for id in (lighting_targets | as_function)(true) %} - {% set cards.items = cards.items + [dict(type='custom:button-card', - template='bearstone_mobile_control', entity=id, - variables=dict(ok_states=['off'], active_states=['on']), + {% set cards.items = cards.items + [dict(type='tile', entity=id, state_content='state', + icon_tap_action=dict(action='none'), + card_mod={'class': 'lighting-toggle', 'style': '@import url("/local/lighting-tile.css?v=275608177ba5");'}, tap_action=dict(action='toggle'), hold_action=dict(action='more-info'))] %} {% endfor %} {{ cards.items | to_json }} diff --git a/config/dashboards/overview/views/05_lights_exterior.yaml b/config/dashboards/overview/views/05_lights_exterior.yaml index 413f8ded..8830a9bb 100644 --- a/config/dashboards/overview/views/05_lights_exterior.yaml +++ b/config/dashboards/overview/views/05_lights_exterior.yaml @@ -8,7 +8,7 @@ # ------------------------------------------------------------------- # Notes: Lighting scope follows the indoor/exterior groups and bedtime routines. # Notes: Tap a named light/group to toggle; hold for brightness/color/details. -# Notes: Reuses existing mobile templates; offline controls remain visible. +# Notes: Native tiles keep offline controls visible and expose the name and state together. ###################################################################### path: lights-exterior @@ -47,8 +47,10 @@ sections: icon: mdi:outdoor-lamp view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_nav_back + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: Back to Lighting icon: mdi:arrow-left show_state: false @@ -83,206 +85,146 @@ sections: icon: mdi:outdoor-lamp view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_front_lights name: All Front Lights icon: mdi:lightbulb-group - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_foyer name: Outdoor Foyer icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_sconce_1 name: Sconce 1 icon: mdi:wall-sconce-flat-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_sconce_2 name: Sconce 2 icon: mdi:wall-sconce-flat-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_sconce_3 name: Sconce 3 icon: mdi:wall-sconce-flat-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.led_garage_large name: Large Garage LEDs icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.led_garage_small name: Small Garage LEDs icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.led_garage_snip name: Garage Accent LEDs icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.led_outdoor_den name: Outdoor Den LEDs icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.treeflood name: Tree Flood icon: mdi:spotlight-beam - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.flood_2 name: Flood 2 icon: mdi:spotlight-beam - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.outdoor_bathroom name: Pool Bathroom icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -313,55 +255,40 @@ sections: icon: mdi:palm-tree view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: group.landscaping name: All Landscaping icon: mdi:palm-tree - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.front_landscaping name: Front Landscaping icon: mdi:palm-tree - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.back_landscaping view_layout: grid-column: span 2 name: Back Landscaping icon: mdi:palm-tree - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -392,123 +319,88 @@ sections: icon: mdi:string-lights view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: group.outdoor_seasonal name: All Seasonal Lights icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.xmas_dual_outlet_switch_1 name: Seasonal Dual Outlet 1 icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.xmas_dual_outlet_switch_2 name: Seasonal Dual Outlet 2 icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.outdoor_xmas_right_socket name: Seasonal Right Outlet icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.outdoor_xmas_2_socket_1 name: Seasonal Outlet 1 icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.outdoor_xmas_2_socket_2 name: Seasonal Outlet 2 icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.outdoor_xmas_2_socket_3 view_layout: grid-column: span 2 name: Seasonal Outlet 3 icon: mdi:string-lights - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: diff --git a/config/dashboards/overview/views/05_lights_indoor.yaml b/config/dashboards/overview/views/05_lights_indoor.yaml index 074d364f..24436aa0 100644 --- a/config/dashboards/overview/views/05_lights_indoor.yaml +++ b/config/dashboards/overview/views/05_lights_indoor.yaml @@ -8,7 +8,7 @@ # ------------------------------------------------------------------- # Notes: Lighting scope follows the indoor/exterior groups and bedtime routines. # Notes: Tap a named light/group to toggle; hold for brightness/color/details. -# Notes: Reuses existing mobile templates; offline controls remain visible. +# Notes: Native tiles keep offline controls visible and expose the name and state together. ###################################################################### path: lights-indoor @@ -47,8 +47,10 @@ sections: icon: mdi:home-lightbulb-outline view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_nav_back + - type: button + icon_height: 28px + card_mod: + style: !include /config/dashboards/infrastructure/card_mod/native_button.yaml name: Back to Lighting icon: mdi:arrow-left show_state: false @@ -83,89 +85,64 @@ sections: icon: mdi:sofa-outline view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.living_room_lights name: Living Room Lights icon: mdi:ceiling-light-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.living_room_accents name: Living Room Accents icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.main_slider name: Main Slider icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.living_room_outlet name: Living Room Outlet icon: mdi:power-socket-us - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.den_outlet view_layout: grid-column: span 2 name: Den Outlet icon: mdi:lamp-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -196,89 +173,64 @@ sections: icon: mdi:countertop-outline view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.kitchen_lights name: Kitchen Lights icon: mdi:ceiling-light-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.sink name: Sink icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: group.kitchen_accents name: Kitchen Accents icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.kitchen_accent_1 name: Kitchen Accent 1 icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.kitchen_accent_2 view_layout: grid-column: span 2 name: Kitchen Accent 2 icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -309,89 +261,64 @@ sections: icon: mdi:ceiling-light-outline view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.foyer name: Foyer Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.foyer_outlet name: Foyer Outlet icon: mdi:lamp-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.front_door_outlet name: Front Door Outlet icon: mdi:outdoor-lamp - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.dining_room_lights name: Dining Room icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.dinette_lights view_layout: grid-column: span 2 name: Dinette icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -422,123 +349,88 @@ sections: icon: mdi:desk-lamp view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.office_lights name: Office Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.office_lamp_switch name: Office Lamp icon: mdi:desk-lamp - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.front_office_lamp name: Front Office Lamp icon: mdi:desk-lamp - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.office_accent name: Office Accent icon: mdi:led-strip-variant - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: group.master_bathroom_accents name: Bathroom Accents icon: mdi:vanity-light - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.master_bathroom_accent_1 name: Bath Accent 1 icon: mdi:vanity-light - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: switch.master_bathroom_accent_2 view_layout: grid-column: span 2 name: Bath Accent 2 icon: mdi:vanity-light - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -569,138 +461,98 @@ sections: icon: mdi:bed-outline view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.bedroom_lights name: Bedroom Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.upstairs_lights name: Upstairs Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.upstairs_lamp name: Upstairs Lamp icon: mdi:lamp-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.ikea_1 name: Hallway Outlet icon: mdi:power-socket-us - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.hallway_lights name: Hallway Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.justin_go name: Justin's Room icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.paige_go name: Paige's Room icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.echo_glow name: Echo Glow icon: mdi:lamp-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: @@ -731,55 +583,40 @@ sections: icon: mdi:garage view_layout: grid-column: 1 / -1 - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.garage name: Garage Hallway icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.garage_2 name: Garage Attic icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: action: more-info - - type: custom:button-card - template: bearstone_mobile_control + - type: tile entity: light.garage_lights view_layout: grid-column: span 2 name: All Garage Lights icon: mdi:lightbulb-outline - variables: - ok_states: - - 'off' - active_states: - - 'on' - state_labels: - unavailable: OFFLINE - unknown: UNKNOWN + state_content: state + icon_tap_action: + action: none + card_mod: !include /config/dashboards/overview/partials/lighting_tile_card_mod.yaml tap_action: action: toggle hold_action: diff --git a/config/dashboards/resources.yaml b/config/dashboards/resources.yaml index d75e2af2..b8d93b20 100644 --- a/config/dashboards/resources.yaml +++ b/config/dashboards/resources.yaml @@ -56,6 +56,8 @@ - type: module # Loads the versioned HACS card with signed timeline media for Clips. url: /local/frigate-events-navigation.js?v=14 +- type: module + url: /local/lighting-tile-keyboard.js?v=8417cb66a9a6 - type: module url: /local/ookla_speedtest/ookla-speedtest-card.js?v=3.0.5 - type: module diff --git a/config/www/lighting-tile-keyboard.js b/config/www/lighting-tile-keyboard.js new file mode 100644 index 00000000..1f53393e --- /dev/null +++ b/config/www/lighting-tile-keyboard.js @@ -0,0 +1,91 @@ +// The native gesture handler can retain its hold state on the next keyboard activation. +// Send keyboard gestures directly to the opt-in tile's configured action handler. +let pressedSpace; + +function lightingButton(event) { + const button = event.composedPath()[0]; + if (button?.getAttribute?.("role") !== "button") return; + const container = button.getRootNode().host; + if (container?.localName === "ha-tile-container" && container.closest("ha-card.lighting-toggle")) { + return button; + } +} + +// Auto-entities rebuilds the grid when an On Now light turns off. +function followOnNowRemoval(button, path) { + const list = path.find(node => node.localName === "auto-entities"); + if (!list) return; + const tiles = () => list.querySelector("layout-card")?.shadowRoot + ?.querySelector("grid-layout")?.shadowRoot?.querySelectorAll("hui-tile-card"); + const index = Array.from(tiles() ?? []).findIndex(tile => path.includes(tile)); + if (index < 0) return; + + const observer = new MutationObserver(() => { + if (button.isConnected) return; + observer.disconnect(); + clearTimeout(timeout); + requestAnimationFrame(() => { + if (!list.isConnected || document.activeElement !== document.body) return; + const remaining = tiles(); + const tile = remaining?.length ? remaining[Math.min(index, remaining.length - 1)] : null; + const next = tile?.shadowRoot?.querySelector("ha-tile-container")?.shadowRoot?.querySelector('[role="button"]'); + if (next) { + next.focus(); + } else { + list.tabIndex = -1; + list.setAttribute("role", "region"); + list.setAttribute("aria-label", "On Now"); + list.focus(); + } + }); + }); + // A failed toggle leaves the original tile in place. + const timeout = setTimeout(() => observer.disconnect(), 5000); + // The old grid can be replaced in the same frame as the keyboard action. + for (const node of path) { + if (node === list || node instanceof ShadowRoot) observer.observe(node, { childList: true, subtree: true }); + if (node === list) break; + } +} + +function activate(button, action, event) { + if (action === "tap") followOnNowRemoval(button, event.composedPath()); + button.dispatchEvent(new CustomEvent("action", { + bubbles: true, + composed: true, + detail: { action }, + })); +} + +window.addEventListener("keydown", (event) => { + if (event.defaultPrevented || event.isComposing || event.ctrlKey || event.altKey || event.metaKey) return; + const details = event.key === "ContextMenu" || (event.shiftKey && event.key === "F10"); + if (!details && (event.shiftKey || !["Enter", " "].includes(event.key))) return; + const button = lightingButton(event); + if (!button) return; + + event.preventDefault(); + event.stopPropagation(); + if (event.repeat) return; + if (event.key === " ") { + pressedSpace = button; + } else { + activate(button, details ? "hold" : "tap", event); + } +}, true); + +window.addEventListener("keyup", (event) => { + if (event.key !== " " || !pressedSpace) return; + const button = pressedSpace; + pressedSpace = undefined; + if (lightingButton(event) !== button) return; + event.preventDefault(); + event.stopPropagation(); + activate(button, "tap", event); +}, true); + +window.addEventListener("focusout", (event) => { + if (pressedSpace && event.composedPath()[0] === pressedSpace) pressedSpace = undefined; +}, true); + +window.addEventListener("blur", () => { pressedSpace = undefined; }); diff --git a/config/www/lighting-tile.css b/config/www/lighting-tile.css new file mode 100644 index 00000000..e4a5ca9d --- /dev/null +++ b/config/www/lighting-tile.css @@ -0,0 +1,31 @@ +/* Shared by the fixed room tiles and the live On Now list. */ +ha-card.type-tile { + min-height: 112px; + border-radius: 20px; + --ha-tile-info-primary-font-size: 18px; + --ha-tile-info-primary-font-weight: 700; + --ha-tile-info-secondary-font-size: 15px; + --ha-tile-info-secondary-font-weight: 700; +} +ha-card.type-tile:has(ha-tile-icon[data-state="on"]) { + background: color-mix(in srgb, var(--info-color) 12%, var(--card-background-color)); + border-color: color-mix(in srgb, var(--info-color) 45%, var(--divider-color)); +} +ha-card.type-tile:has(ha-tile-icon[data-state="off"]) { + background: color-mix(in srgb, var(--success-color) 10%, var(--card-background-color)); + border-color: color-mix(in srgb, var(--success-color) 45%, var(--divider-color)); +} +ha-card.type-tile:has(ha-tile-icon:is([data-state="unavailable"], [data-state="unknown"])) { + border-color: var(--error-color); +} +ha-card.type-tile [slot="primary"], +ha-card.type-tile [slot="secondary"] { + white-space: normal; + overflow-wrap: anywhere; + text-overflow: clip; +} +ha-card.type-tile [slot="secondary"] { text-transform: uppercase; } +ha-card.type-tile:has(ha-tile-container[focused]) { + outline: 3px solid var(--primary-color); + outline-offset: -3px; +}