mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-10 07:05:36 +00:00
hass rssi discovery
This commit is contained in:
@ -245,6 +245,9 @@ HassDeviceInfo* hass_init_device_info(ENTITY_TYPE type, int index, char* payload
|
||||
case ILLUMINANCE_SENSOR:
|
||||
sprintf(g_hassBuffer, "Illuminance");
|
||||
break;
|
||||
case HASS_RSSI:
|
||||
sprintf(g_hassBuffer, "RSSI");
|
||||
break;
|
||||
default:
|
||||
sprintf(g_hassBuffer, "%s", CHANNEL_GetLabel(index));
|
||||
break;
|
||||
@ -582,6 +585,13 @@ HassDeviceInfo* hass_init_sensor_device_info(ENTITY_TYPE type, int channel, int
|
||||
cJSON_AddStringToObject(info->root, "stat_t", g_hassBuffer);
|
||||
cJSON_AddStringToObject(info->root, "val_tpl", g_template_lowMidHigh);
|
||||
|
||||
break;
|
||||
case HASS_RSSI:
|
||||
cJSON_AddStringToObject(info->root, "dev_cla", "signal_strength");
|
||||
cJSON_AddStringToObject(info->root, "stat_t", "~/rssi");
|
||||
cJSON_AddStringToObject(info->root, "unit_of_meas", "dBm");
|
||||
//cJSON_AddStringToObject(info->root, "icon_template", "mdi:access-point");
|
||||
|
||||
break;
|
||||
default:
|
||||
sprintf(g_hassBuffer, "~/%d/get", channel);
|
||||
@ -589,7 +599,7 @@ HassDeviceInfo* hass_init_sensor_device_info(ENTITY_TYPE type, int channel, int
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (type != READONLYLOWMIDHIGH_SENSOR && type != ENERGY_SENSOR) {
|
||||
if (type != READONLYLOWMIDHIGH_SENSOR && type != ENERGY_SENSOR && type != HASS_RSSI) {
|
||||
cJSON_AddStringToObject(info->root, "stat_cla", "measurement");
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +65,8 @@ typedef enum {
|
||||
ILLUMINANCE_SENSOR,
|
||||
|
||||
ENERGY_SENSOR,
|
||||
|
||||
HASS_RSSI,
|
||||
} ENTITY_TYPE;
|
||||
|
||||
//unique_id is defined in hass_populate_unique_id and is based on CFG_GetDeviceName() whose size is CGF_DEVICE_NAME_SIZE.
|
||||
|
||||
Reference in New Issue
Block a user