Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | import { z } from "zod";
export const DomainSchema = z.enum([
"light",
"climate",
"alarm_control_panel",
"cover",
"switch",
"contact",
"media_player",
"fan",
"lock",
"vacuum",
"scene",
"script",
"camera"
]);
// Generic list request schema
export const ListRequestSchema = z.object({
domain: DomainSchema,
area: z.string().optional(),
floor: z.string().optional(),
});
// Areas
export const AreaSchema = z.object({
id: z.string(),
name: z.string(),
floor: z.string(),
});
export const FloorSchema = z.object({
id: z.string(),
name: z.string(),
});
export const ListFloorsResponseSchema = z.object({
floors: z.array(FloorSchema),
});
// Alarm
export const AlarmAttributesSchema = z.object({
code_format: z.string().optional(),
changed_by: z.string().optional(),
code_arm_required: z.boolean().optional(),
friendly_name: z.string().optional(),
supported_features: z.number().optional(),
});
export const AlarmSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: AlarmAttributesSchema,
});
export const ListAlarmsResponseSchema = z.object({
alarms: z.array(AlarmSchema),
});
// Devices
export const DeviceSchema = z.object({
id: z.string(),
name: z.string(),
name_by_user: z.string().optional(),
model: z.string(),
model_id: z.string().nullable(),
manufacturer: z.string(),
area_id: z.string().nullable(),
config_entries: z.array(z.string()),
primary_config_entry: z.string(),
connections: z.array(z.tuple([z.string(), z.string()])),
configuration_url: z.string().nullable(),
disabled_by: z.string().nullable(),
entry_type: z.string().nullable(),
hw_version: z.string().nullable(),
sw_version: z.string().nullable(),
via_device_id: z.string().nullable(),
created_at: z.number(),
modified_at: z.number(),
identifiers: z.array(z.any()),
labels: z.array(z.string()),
serial_number: z.string().optional()
});
export const ListDevicesResponseSchema = z.object({
_meta: z.object({}).optional(),
devices: z.array(DeviceSchema)
});
// Media Player
export const MediaPlayerAttributesSchema = z.object({
volume_level: z.number().optional(),
is_volume_muted: z.boolean().optional(),
media_content_id: z.string().optional(),
media_content_type: z.string().optional(),
media_duration: z.number().optional(),
media_position: z.number().optional(),
media_title: z.string().optional(),
source: z.string().optional(),
source_list: z.array(z.string()).optional(),
supported_features: z.number().optional(),
});
export const MediaPlayerSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: MediaPlayerAttributesSchema,
});
// Fan
export const FanAttributesSchema = z.object({
percentage: z.number().optional(),
preset_mode: z.string().optional(),
preset_modes: z.array(z.string()).optional(),
oscillating: z.boolean().optional(),
direction: z.string().optional(),
supported_features: z.number().optional(),
});
export const FanSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: FanAttributesSchema,
});
// Lock
export const LockAttributesSchema = z.object({
code_format: z.string().optional(),
changed_by: z.string().optional(),
locked: z.boolean(),
supported_features: z.number().optional(),
});
export const LockSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: LockAttributesSchema,
});
// Vacuum
export const VacuumAttributesSchema = z.object({
battery_level: z.number().optional(),
fan_speed: z.string().optional(),
fan_speed_list: z.array(z.string()).optional(),
status: z.string().optional(),
supported_features: z.number().optional(),
});
export const VacuumSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: VacuumAttributesSchema,
});
// Scene
export const SceneAttributesSchema = z.object({
entity_id: z.array(z.string()).optional(),
supported_features: z.number().optional(),
});
export const SceneSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: SceneAttributesSchema,
});
// Script
export const ScriptAttributesSchema = z.object({
last_triggered: z.string().optional(),
mode: z.string().optional(),
variables: z.record(z.any()).optional(),
supported_features: z.number().optional(),
});
export const ScriptSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: ScriptAttributesSchema,
});
// Camera
export const CameraAttributesSchema = z.object({
motion_detection: z.boolean().optional(),
frontend_stream_type: z.string().optional(),
supported_features: z.number().optional(),
});
export const CameraSchema = z.object({
entity_id: z.string(),
state: z.string(),
state_attributes: CameraAttributesSchema,
});
// Response schemas for new devices
export const ListMediaPlayersResponseSchema = z.object({
media_players: z.array(MediaPlayerSchema),
});
export const ListFansResponseSchema = z.object({
fans: z.array(FanSchema),
});
export const ListLocksResponseSchema = z.object({
locks: z.array(LockSchema),
});
export const ListVacuumsResponseSchema = z.object({
vacuums: z.array(VacuumSchema),
});
export const ListScenesResponseSchema = z.object({
scenes: z.array(SceneSchema),
});
export const ListScriptsResponseSchema = z.object({
scripts: z.array(ScriptSchema),
});
export const ListCamerasResponseSchema = z.object({
cameras: z.array(CameraSchema),
}); |