Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,12 @@ import {
subscribeBluetoothScannersDetails,
} from "../../../../../data/bluetooth";
import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import { bluetoothTabs } from "./bluetooth-config-dashboard";
import { showBluetoothDeviceInfoDialog } from "./show-dialog-bluetooth-device-info";

export const bluetoothAdvertisementMonitorTabs: PageNavigation[] = [
{
translationKey: "ui.panel.config.bluetooth.advertisement_monitor",
path: "advertisement-monitor",
},
{
translationKey: "ui.panel.config.bluetooth.visualization",
path: "visualization",
},
];

@customElement("bluetooth-advertisement-monitor")
export class BluetoothAdvertisementMonitorPanel extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
Expand Down Expand Up @@ -232,7 +221,7 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement {
@collapsed-changed=${this._handleCollapseChanged}
filter=${this.address || ""}
clickable
.tabs=${bluetoothAdvertisementMonitorTabs}
.tabs=${bluetoothTabs}
></hass-tabs-subpage-data-table>
`;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { mdiCogOutline } from "@mdi/js";
import {
mdiBroadcast,
mdiCogOutline,
mdiLan,
mdiLinkVariant,
mdiNetwork,
} from "@mdi/js";
import type { CSSResultGroup, TemplateResult } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
Expand All @@ -8,7 +14,6 @@ import "../../../../../components/ha-card";
import "../../../../../components/ha-icon-button";
import "../../../../../components/ha-list";
import "../../../../../components/ha-list-item";

import type {
BluetoothAllocationsData,
BluetoothScannerState,
Expand All @@ -24,16 +29,44 @@ import type { ConfigEntry } from "../../../../../data/config_entries";
import { getConfigEntries } from "../../../../../data/config_entries";
import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry";
import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow";
import "../../../../../layouts/hass-subpage";
import "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant } from "../../../../../types";
import type { HomeAssistant, Route } from "../../../../../types";

export const bluetoothTabs: PageNavigation[] = [
{
translationKey: "ui.panel.config.bluetooth.tabs.overview",
path: `/config/bluetooth/dashboard`,
iconPath: mdiNetwork,
},
{
translationKey: "ui.panel.config.bluetooth.tabs.advertisements",
path: `/config/bluetooth/advertisement-monitor`,
iconPath: mdiBroadcast,
},
{
translationKey: "ui.panel.config.bluetooth.tabs.visualization",
path: `/config/bluetooth/visualization`,
iconPath: mdiLan,
},
{
translationKey: "ui.panel.config.bluetooth.tabs.connections",
path: `/config/bluetooth/connection-monitor`,
iconPath: mdiLinkVariant,
},
];

@customElement("bluetooth-config-dashboard")
export class BluetoothConfigDashboard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property({ attribute: false }) public route!: Route;

@property({ type: Boolean }) public narrow = false;

@property({ attribute: "is-wide", type: Boolean }) public isWide = false;

@state() private _configEntries: ConfigEntry[] = [];

@state() private _connectionAllocationData: BluetoothAllocationsData[] = [];
Expand Down Expand Up @@ -122,10 +155,12 @@ export class BluetoothConfigDashboard extends LitElement {

protected render(): TemplateResult {
return html`
<hass-subpage
<hass-tabs-subpage
header=${this.hass.localize("ui.panel.config.bluetooth.title")}
.narrow=${this.narrow}
.hass=${this.hass}
.route=${this.route}
.tabs=${bluetoothTabs}
>
<div class="content">
<ha-card
Expand All @@ -135,60 +170,8 @@ export class BluetoothConfigDashboard extends LitElement {
>
<ha-list>${this._renderAdaptersList()}</ha-list>
</ha-card>
<ha-card
.header=${this.hass.localize(
"ui.panel.config.bluetooth.advertisement_monitor"
)}
>
<div class="card-content">
<p>
${this.hass.localize(
"ui.panel.config.bluetooth.advertisement_monitor_details"
)}
</p>
</div>
<div class="card-actions">
<ha-button
href="/config/bluetooth/advertisement-monitor"
appearance="plain"
>
${this.hass.localize(
"ui.panel.config.bluetooth.advertisement_monitor"
)}
</ha-button>
<ha-button
href="/config/bluetooth/visualization"
appearance="plain"
>
${this.hass.localize("ui.panel.config.bluetooth.visualization")}
</ha-button>
</div>
</ha-card>
<ha-card
.header=${this.hass.localize(
"ui.panel.config.bluetooth.connection_slot_allocations_monitor"
)}
>
<div class="card-content">
<p>
${this.hass.localize(
"ui.panel.config.bluetooth.connection_slot_allocations_monitor_description"
)}
</p>
</div>
<div class="card-actions">
<ha-button
href="/config/bluetooth/connection-monitor"
appearance="plain"
>
${this.hass.localize(
"ui.panel.config.bluetooth.connection_monitor"
)}
</ha-button>
</div>
</ha-card>
</div>
</hass-subpage>
</hass-tabs-subpage>
`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { DeviceRegistryEntry } from "../../../../../data/device/device_regi
import "../../../../../layouts/hass-tabs-subpage-data-table";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import { bluetoothTabs } from "./bluetooth-config-dashboard";

@customElement("bluetooth-connection-monitor")
export class BluetoothConnectionMonitorPanel extends LitElement {
Expand Down Expand Up @@ -214,6 +215,7 @@ export class BluetoothConnectionMonitorPanel extends LitElement {
.hass=${this.hass}
.narrow=${this.narrow}
.route=${this.route}
.tabs=${bluetoothTabs}
.columns=${this._columns(this.hass.localize)}
.data=${this._dataWithNamedSourceAndIds(this._data)}
.initialGroupColumn=${this._activeGrouping}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
subscribeBluetoothScannersDetails,
} from "../../../../../data/bluetooth";
import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry";
import "../../../../../layouts/hass-subpage";
import "../../../../../layouts/hass-tabs-subpage";
import type { HomeAssistant, Route } from "../../../../../types";
import { bluetoothAdvertisementMonitorTabs } from "./bluetooth-advertisement-monitor";
import { bluetoothTabs } from "./bluetooth-config-dashboard";

const UPDATE_THROTTLE_TIME = 10000;

Expand Down Expand Up @@ -123,8 +123,7 @@ export class BluetoothNetworkVisualization extends LitElement {
.hass=${this.hass}
.narrow=${this.narrow}
.route=${this.route}
header=${this.hass.localize("ui.panel.config.bluetooth.visualization")}
.tabs=${bluetoothAdvertisementMonitorTabs}
.tabs=${bluetoothTabs}
>
<ha-network-graph
.hass=${this.hass}
Expand Down
16 changes: 6 additions & 10 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6011,24 +6011,21 @@
},
"bluetooth": {
"title": "Bluetooth",
"tabs": {
"overview": "Overview",
"advertisements": "Advertisements",
"visualization": "Visualization",
"connections": "Connections"
},
"settings_title": "Bluetooth adapters",
"option_flow": "Configure Bluetooth options",
"advertisement_monitor": "Advertisement monitor",
"advertisement_monitor_details": "The advertisement monitor listens for Bluetooth advertisements and displays the data in a structured format.",
"connection_slot_allocations_monitor": "Connection slot allocations monitor",
"connection_slot_allocations_monitor_description": "The connection slot allocations monitor displays the (GATT) connection slot allocations for each adapter. Each remote Bluetooth device that requires an active connection will use one connection slot while the Bluetooth device is connecting or connected.",
"connection_monitor": "Connection monitor",
"visualization": "Visualization",
"used_connection_slot_allocations": "Used connection slot allocations",
"no_connections": "No active connections",
"active_connections": "connections",
"no_advertisements_found": "No matching Bluetooth advertisements found",
"no_connection_slot_allocations": "No connection slot allocations information available",
"no_connection_slots": "No connection slots",
"no_scanner_state_available": "No scanner state available",
"scanner_state_unknown": "State unknown",
"current_scanning_mode": "Current scanning mode",
"requested_scanning_mode": "Requested scanning mode",
"scanning_mode_none": "none",
"scanning_mode_active": "active",
"scanning_mode_passive": "passive",
Expand All @@ -6053,7 +6050,6 @@
"service_uuids": "Service UUIDs",
"copy_to_clipboard": "[%key:ui::panel::config::automation::editor::copy_to_clipboard%]",
"area": "Area",
"core": "Home Assistant",
"scanners": "Scanners",
"known_devices": "Known devices",
"unknown_devices": "Unknown devices"
Expand Down
Loading