Skip to main content

homeassistant_agent/model/
component.rs

1use std::fmt::Formatter;
2
3#[derive(Copy, Clone, Eq, PartialEq, Debug)]
4pub enum Component {
5    Button,
6    Switch,
7    BinarySensor,
8    Sensor,
9}
10
11impl AsRef<str> for Component {
12    fn as_ref(&self) -> &str {
13        match self {
14            Self::BinarySensor => "binary_sensor",
15            Self::Button => "button",
16            Self::Sensor => "sensor",
17            Self::Switch => "switch",
18        }
19    }
20}
21
22impl std::fmt::Display for Component {
23    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
24        f.write_str(self.as_ref())
25    }
26}