Skip to main content

homeassistant_cli/api/
types.rs

1use serde::{Deserialize, Serialize};
2use std::collections::BTreeMap;
3
4#[derive(Debug, Deserialize, Serialize, Clone)]
5pub struct EntityState {
6    pub entity_id: String,
7    pub state: String,
8    pub attributes: serde_json::Value,
9    pub last_changed: String,
10    pub last_updated: String,
11}
12
13#[derive(Debug, Deserialize, Serialize)]
14pub struct ServiceDomain {
15    pub domain: String,
16    pub services: BTreeMap<String, ServiceInfo>,
17}
18
19#[derive(Debug, Deserialize, Serialize)]
20pub struct ServiceInfo {
21    pub name: Option<String>,
22    pub description: Option<String>,
23}
24
25#[derive(Debug, Deserialize, Serialize)]
26pub struct HaEvent {
27    pub event_type: String,
28    pub data: serde_json::Value,
29    pub origin: Option<String>,
30    pub time_fired: Option<String>,
31}
32
33#[derive(Debug, Deserialize, Serialize)]
34pub struct StateChangedData {
35    pub entity_id: String,
36    pub new_state: Option<EntityState>,
37    pub old_state: Option<EntityState>,
38}