Formatted

This commit is contained in:
Indu Prakash
2022-10-14 21:08:38 -05:00
parent 7562fd9049
commit fd4aaeef13
9 changed files with 3541 additions and 3464 deletions

View File

@@ -6,10 +6,10 @@
typedef enum {
ENTITY_RELAY = 0,
ENTITY_LIGHT_PWM = 1,
ENTITY_LIGHT_RGB = 2,
ENTITY_LIGHT_RGBCW = 3,
ENTITY_SENSOR = 4,
ENTITY_LIGHT_PWM = 1,
ENTITY_LIGHT_RGB = 2,
ENTITY_LIGHT_RGBCW = 3,
ENTITY_SENSOR = 4,
} ENTITY_TYPE;
//unique_id is defined in hass_populate_unique_id and is based on CFG_GetDeviceName() whose size is CGF_DEVICE_NAME_SIZE.
@@ -24,18 +24,18 @@ typedef enum {
#define HASS_JSON_SIZE (MQTT_PUBLISH_ITEM_VALUE_LENGTH - 1)
/// @brief HomeAssistant device discovery information
typedef struct HassDeviceInfo_s{
char unique_id[HASS_UNIQUE_ID_SIZE];
char channel[HASS_CHANNEL_SIZE];
char json[HASS_JSON_SIZE];
typedef struct HassDeviceInfo_s {
char unique_id[HASS_UNIQUE_ID_SIZE];
char channel[HASS_CHANNEL_SIZE];
char json[HASS_JSON_SIZE];
cJSON *root;
cJSON *device;
cJSON *ids;
cJSON* root;
cJSON* device;
cJSON* ids;
} HassDeviceInfo;
void hass_print_unique_id(http_request_t *request, const char *fmt, ENTITY_TYPE type, int index);
HassDeviceInfo *hass_init_relay_device_info(int index);
HassDeviceInfo *hass_init_light_device_info(ENTITY_TYPE type, int index);
char *hass_build_discovery_json(HassDeviceInfo *info);
void hass_free_device_info(HassDeviceInfo *info);
void hass_print_unique_id(http_request_t* request, const char* fmt, ENTITY_TYPE type, int index);
HassDeviceInfo* hass_init_relay_device_info(int index);
HassDeviceInfo* hass_init_light_device_info(ENTITY_TYPE type, int index);
char* hass_build_discovery_json(HassDeviceInfo* info);
void hass_free_device_info(HassDeviceInfo* info);