HAMQTT 0.1.0
ESP-IDF component for integrating devices with Home Assistant over MQTT
Loading...
Searching...
No Matches
hamqtt_component.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Ethan Barnes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
30
31#pragma once
32
33#include "common.h"
34
36
37/* ----- Dispatch helpers ----- */
38
54 HAMQTT_Component*component, cJSON *root, const char *device_uid);
55
72 HAMQTT_Component *component, const char *topic, const char *data);
73
86 HAMQTT_Component *component, esp_mqtt_client_handle_t client);
87
99 HAMQTT_Component *component);
100
113 HAMQTT_Component *component, size_t *count);
Common macros and definitions used across the HAMQTT library.
Base struct representing a generic Home Assistant MQTT component.
Definition hamqtt_component_internal.h:68
esp_err_t hamqtt_component_get_discovery_config(HAMQTT_Component *component, cJSON *root, const char *device_uid)
Populates the Home Assistant discovery configuration for the component.
void hamqtt_component_handle_mqtt_message(HAMQTT_Component *component, const char *topic, const char *data)
Dispatches an incoming MQTT message to the specified component.
const char * hamqtt_component_get_unique_id(HAMQTT_Component *component)
Returns the unique ID of the component.
const char *const * hamqtt_component_get_subscribed_topics(HAMQTT_Component *component, size_t *count)
Returns the list of topics the component wants to subscribe to.
void hamqtt_component_update(HAMQTT_Component *component, esp_mqtt_client_handle_t client)
Performs a periodic update for the component.