# homeassistant
This is a basic component for MQTT-based autodiscovery with HomeAssistant.
It handles generating the config messages HomeAssistant needs to autodiscover your device.
```
#include "homeassistant.h"
void app_main(void)
{
ha_autodiscovery_config_t ha_temperature_cfg = {
.name = "office Temperature",
.unique_id = "office-temperature",
.stat_topic = "office/climate",
.value_template = "{{value_json.temperature}}",
.unit_of_measurement = "C",
.device_class = "temperature",
.stat_class = "measurement",
.device_id = "esp-climate",
};
send_ha_config(mqtt_conn, "homeassistant/sensor/office-temperature/config", &ha_temperature_cfg);
}
```
idf.py add-dependency "sethcurry/homeassistant^0.0.1"