Add a way to get diagnostics for issue reports.

This commit is contained in:
Dermot Duffy
2022-06-06 20:18:47 -07:00
parent 7b902b604c
commit 9358ae103a
6 changed files with 84 additions and 6 deletions
+22
View File
@@ -0,0 +1,22 @@
import { HomeAssistant } from 'custom-card-helpers';
import { z } from 'zod';
import { homeAssistantWSRequest } from '.';
const deviceSchema = z.object({
model: z.string().nullable(),
config_entries: z.string().array(),
manufacturer: z.string().nullable(),
})
export const deviceListSchema = deviceSchema.array();
export type DeviceList = z.infer<typeof deviceListSchema>;
/**
* Get a list of all entities from the entity registry. May throw.
* @param hass The Home Assistant object.
* @returns An entity list object.
*/
export const getAllDevices = async (hass: HomeAssistant): Promise<DeviceList> => {
return await homeAssistantWSRequest<DeviceList>(hass, deviceListSchema, {
type: 'config/device_registry/list',
});
};