Common macros and definitions used across the HAMQTT library.
Interface definition for Home Assistant MQTT components.
Base struct representing a generic Home Assistant MQTT component.
Definition hamqtt_component_internal.h:68
Configuration parameters for a HAMQTT device.
Definition hamqtt_device.h:41
char * origin_url
URL to documentation or device homepage.
Definition hamqtt_device.h:52
char * hw_version
The hardware version of the device.
Definition hamqtt_device.h:51
char * manufacturer
The manufacturer of the device.
Definition hamqtt_device.h:46
char * sw_version
The software version of the device.
Definition hamqtt_device.h:50
char * model
The model of the device.
Definition hamqtt_device.h:47
char * name
The name of the device shown in Home Assistant.
Definition hamqtt_device.h:53
char * mqtt_password
The MQTT password.
Definition hamqtt_device.h:45
char * mqtt_username
The MQTT username.
Definition hamqtt_device.h:44
char * mqtt_uri
The URI of the MQTT broker (e.g., "mqtt://broker.hivemq.com:1883").
Definition hamqtt_device.h:43
char * serial_number
The serial number of the device.
Definition hamqtt_device.h:48
HAMQTT_Device_Config hamqtt_device_config_default(void)
Returns a default-initialized device configuration.
char * mqtt_config_topic_prefix
The prefix for Home Assistant MQTT discovery topics.
Definition hamqtt_device.h:42
char * unique_id
Unique identifier used for discovery in Home Assistant.
Definition hamqtt_device.h:49
Internal representation of a Home Assistant MQTT device.
esp_err_t hamqtt_device_publish_availability(const HAMQTT_Device *device, bool availability)
Publish an availability message to Home Assistant.
esp_err_t hamqtt_device_add_component(HAMQTT_Device *device, HAMQTT_Component *component)
Add a component (e.g. sensor, switch) to the device.
esp_err_t hamqtt_device_connect(HAMQTT_Device *device)
Connect the device to the MQTT broker and publish its Home Assistant discovery config.
void hamqtt_device_loop(const HAMQTT_Device *device)
Update the state of all components and publish to MQTT.
const HAMQTT_Device_Config * hamqtt_device_get_config(const HAMQTT_Device *device)
Get the configuration used to initialize the device.
HAMQTT_Device * hamqtt_device_create(HAMQTT_Device_Config *config)
Create a new HAMQTT device.
void hamqtt_device_destroy(HAMQTT_Device *device)
Destroy a HAMQTT device and free all resources.