1use serde::{Deserialize, Serialize};
2
3#[derive(Deserialize, Debug, Clone, Default)]
4pub struct ConfigResponse {
5 pub components: Vec<String>,
6 pub config_dir: String,
7 pub elevation: f64,
8 pub latitude: f64,
9 pub location_name: String,
10 pub longitude: f64,
11 pub time_zone: String,
12 pub unit_system: UnitSystem,
13 pub version: String,
14 pub whitelist_external_dirs: Vec<String>,
15}
16
17#[derive(Deserialize, Debug, Clone, Default)]
18pub struct UnitSystem {
19 pub length: String,
20 pub mass: String,
21 pub temperature: String,
22 pub volume: String,
23}
24
25#[derive(Deserialize, Debug, Clone, Default)]
26pub struct EventResponse {
27 pub event: String,
28 pub listener_count: u16,
29}
30
31#[derive(Deserialize, Debug, Clone, Default)]
32pub struct HistoryResponse {
33 pub entity_id: Option<String>,
34 pub state: String,
35 pub attributes: Option<Attributes>,
36 pub last_changed: String,
37 pub last_updated: Option<String>,
38}
39
40#[derive(Serialize, Deserialize, Debug, Clone, Default)]
41pub struct Attributes {
42 pub friendly_name: Option<String>,
43 pub editable: Option<bool>,
44 pub id: Option<String>,
45 pub source: Option<String>,
46 pub user_id: Option<String>,
47 pub icon: Option<String>,
48 #[serde(flatten)]
49 pub other_fields: serde_json::Value,
50}
51
52#[derive(Deserialize, Debug, Clone, Default)]
53pub struct LogBook {
54 pub name: String,
55 pub message: Option<String>,
56 pub source: Option<String>,
57 pub entity_id: Option<String>,
58 #[serde(alias = "context_id", alias = "context_user_id")]
59 pub context_id: Option<String>,
60 pub domain: Option<String>,
61 pub when: String,
62}
63
64#[derive(Deserialize, Debug, Clone, Default)]
65pub struct StatesResponse {
66 pub entity_id: Option<String>,
67 pub state: String,
68 pub attributes: Option<Attributes>,
69 pub last_changed: Option<String>,
70 pub last_reported: Option<String>,
71 pub last_updated: Option<String>,
72 pub context: Option<Context>,
73}
74
75#[derive(Deserialize, Debug, Clone, Default)]
76pub struct Context {
77 pub id: String,
78 pub parent_id: Option<String>,
79 pub user_id: Option<String>,
80}
81
82#[derive(Deserialize, Debug, Clone, Default)]
83pub struct CalendarResponse {
84 pub entity_id: String,
85 pub name: String,
86}
87
88#[derive(Serialize, Deserialize, Debug, Clone, Default)]
89pub struct StatesRequest {
90 pub state: String,
91 #[serde(flatten)]
92 pub attributes: Option<Attributes>,
93}
94
95#[derive(Deserialize, Debug, Clone, Default)]
96pub struct SimpleResponse {
97 pub message: String,
98}
99
100#[derive(Serialize, Debug, Clone, Default)]
101pub struct TemplateRequest {
102 pub template: String,
103}
104
105#[derive(Deserialize, Debug, Clone, Default)]
106pub struct ConfigCheckResponse {
107 pub errors: Option<String>,
108 pub result: String,
109 pub warnings: Option<String>,
110}
111
112#[derive(Deserialize, Debug, Clone, Default)]
113pub struct ServicesResponse {
114 pub domain: String,
115 pub services: serde_json::Value,
116}