use hamqtt::payload::{Component, Device};
fn main() {
let device = Device {
identifiers: vec!["livingroom_sensor_001"],
name: "Living Room Sensor",
model: Some("DHT22"),
manufacturer: Some("Generic"),
};
let component = Component {
name: "Living Room Temperature",
state_topic: "home/livingroom/temperature1",
unit_of_measurement: Some("°C"),
device_class: Some("temperature"),
unique_id: "livingroom_temp_12",
value_template: None,
device: Some(device),
};
println!(
"Component discovery topic {}",
component.get_discovery_topic()
);
println!(
"Device discovery payload to be send to component discovery topic {}",
serde_json::to_string(&component).unwrap()
)
}