Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/panels/config/areas/ha-config-area-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { afterNextRender } from "../../../common/util/render-status";
import "../../../components/ha-card";
import "../../../components/ha-icon-button";
import "../../../components/ha-icon-next";
import "../../logbook/ha-logbook";
import {
AreaRegistryEntry,
deleteAreaRegistryEntry,
Expand All @@ -43,15 +42,16 @@ import { SceneEntity } from "../../../data/scene";
import { ScriptEntity } from "../../../data/script";
import { findRelated, RelatedResult } from "../../../data/search";
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
import { haStyle } from "../../../resources/styles";
import { HomeAssistant, Route } from "../../../types";
import "../../logbook/ha-logbook";
import { showEntityEditorDialog } from "../entities/show-dialog-entity-editor";
import { configSections } from "../ha-panel-config";
import {
loadAreaRegistryDetailDialog,
showAreaRegistryDetailDialog,
} from "./show-dialog-area-registry-detail";
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";

declare type NameAndEntity<EntityType extends HassEntity> = {
name: string;
Expand Down Expand Up @@ -761,10 +761,10 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) {
border-radius: 50%;
}
ha-logbook {
height: 800px;
height: 400px;
}
:host([narrow]) ha-logbook {
height: 400px;
height: 235px;
overflow: auto;
}
`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { DeviceRegistryEntry } from "../../../../../../data/device_registry";
import type { DeviceAction } from "../../../ha-config-device-page";
import { showMQTTDeviceDebugInfoDialog } from "./show-dialog-mqtt-device-debug-info";

export const getMQTTDeviceActions = (
el: HTMLElement,
device: DeviceRegistryEntry
): DeviceAction[] => [
{
label: "MQTT Info",
action: async () => showMQTTDeviceDebugInfoDialog(el, { device }),
},
];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { navigate } from "../../../../../../common/navigate";
import type { DeviceRegistryEntry } from "../../../../../../data/device_registry";
import { fetchZHADevice } from "../../../../../../data/zha";
import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box";
import type { HomeAssistant } from "../../../../../../types";
import { showZHAClusterDialog } from "../../../../integrations/integration-panels/zha/show-dialog-zha-cluster";
import { showZHADeviceChildrenDialog } from "../../../../integrations/integration-panels/zha/show-dialog-zha-device-children";
import { showZHADeviceZigbeeInfoDialog } from "../../../../integrations/integration-panels/zha/show-dialog-zha-device-zigbee-info";
import { showZHAReconfigureDeviceDialog } from "../../../../integrations/integration-panels/zha/show-dialog-zha-reconfigure-device";
import type { DeviceAction } from "../../../ha-config-device-page";

export const getZHADeviceActions = async (
el: HTMLElement,
hass: HomeAssistant,
device: DeviceRegistryEntry
): Promise<DeviceAction[]> => {
const zigbeeConnection = device.connections.find(
(conn) => conn[0] === "zigbee"
);

if (!zigbeeConnection) {
return [];
}

const zhaDevice = await fetchZHADevice(hass, zigbeeConnection[1]);

if (!zhaDevice) {
return [];
}

const actions: DeviceAction[] = [];

if (zhaDevice.device_type !== "Coordinator") {
actions.push({
label: hass.localize("ui.dialogs.zha_device_info.buttons.reconfigure"),
action: () => showZHAReconfigureDeviceDialog(el, { device: zhaDevice }),
});
}

if (
zhaDevice.power_source === "Mains" &&
(zhaDevice.device_type === "Router" ||
zhaDevice.device_type === "Coordinator")
) {
actions.push(
...[
{
label: hass.localize("ui.dialogs.zha_device_info.buttons.add"),
action: () => navigate(`/config/zha/add/${zhaDevice!.ieee}`),
},
{
label: hass.localize(
"ui.dialogs.zha_device_info.buttons.device_children"
),
action: () => showZHADeviceChildrenDialog(el, { device: zhaDevice! }),
},
]
);
}

if (zhaDevice.device_type !== "Coordinator") {
actions.push(
...[
{
label: hass.localize(
"ui.dialogs.zha_device_info.buttons.zigbee_information"
),
action: () =>
showZHADeviceZigbeeInfoDialog(el, { device: zhaDevice }),
},
{
label: hass.localize("ui.dialogs.zha_device_info.buttons.clusters"),
action: () => showZHAClusterDialog(el, { device: zhaDevice }),
},
{
label: hass.localize(
"ui.dialogs.zha_device_info.buttons.view_in_visualization"
),
action: () =>
navigate(`/config/zha/visualization/${zhaDevice!.device_reg_id}`),
},
{
label: hass.localize("ui.dialogs.zha_device_info.buttons.remove"),
classes: "warning",
action: async () => {
const confirmed = await showConfirmationDialog(el, {
text: hass.localize(
"ui.dialogs.zha_device_info.confirmations.remove"
),
});

if (!confirmed) {
return;
}

await hass.callService("zha", "remove", {
ieee: zhaDevice.ieee,
});

history.back();
},
},
]
);
}

return actions;
};

This file was deleted.

Loading