mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-10 00:45:23 +00:00
whitespaces in name fix?
This commit is contained in:
@ -90,6 +90,9 @@ void hass_populate_unique_id(ENTITY_TYPE type, int index, char* uniq_id) {
|
||||
sprintf(uniq_id, "%s_%s_%d", longDeviceName, "sensor", index);
|
||||
break;
|
||||
}
|
||||
// There can be no spaces in this name!
|
||||
// See: https://www.elektroda.com/rtvforum/topic4000620.html
|
||||
STR_ReplaceWhiteSpacesWithUnderscore(uniq_id);
|
||||
}
|
||||
|
||||
/// @brief Prints HomeAssistant unique id for the entity.
|
||||
@ -136,6 +139,9 @@ void hass_populate_device_config_channel(ENTITY_TYPE type, char* uniq_id, HassDe
|
||||
sprintf(info->channel, "sensor/%s/config", uniq_id);
|
||||
break;
|
||||
}
|
||||
// There can be no spaces in this name!
|
||||
// See: https://www.elektroda.com/rtvforum/topic4000620.html
|
||||
STR_ReplaceWhiteSpacesWithUnderscore(uniq_id);
|
||||
}
|
||||
|
||||
/// @brief Builds HomeAssistant device discovery info. The caller needs to free the returned pointer.
|
||||
|
||||
@ -1269,7 +1269,6 @@ int http_fn_cfg_wifi(http_request_t* request) {
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_fn_cfg_name(http_request_t* request) {
|
||||
// for a test, show password as well...
|
||||
char tmpA[128];
|
||||
@ -1279,6 +1278,9 @@ int http_fn_cfg_name(http_request_t* request) {
|
||||
|
||||
poststr_h2(request, "Change device names for display");
|
||||
if (http_getArg(request->url, "shortName", tmpA, sizeof(tmpA))) {
|
||||
if (STR_ReplaceWhiteSpacesWithUnderscore(tmpA)) {
|
||||
poststr_h2(request, "You cannot have whitespaces in short name!");
|
||||
}
|
||||
CFG_SetShortDeviceName(tmpA);
|
||||
}
|
||||
if (http_getArg(request->url, "name", tmpA, sizeof(tmpA))) {
|
||||
|
||||
Reference in New Issue
Block a user