mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +00:00
Remove trailing commas and spaces from entity_id for button widgets (#2314)
This commit is contained in:
parent
abadab61a7
commit
1736efc82e
|
@ -402,8 +402,14 @@ class ButtonWidgetConfigureActivity : BaseActivity(), IconDialog.Callback {
|
|||
// Analyze and send service data
|
||||
val serviceDataMap = HashMap<String, Any>()
|
||||
dynamicFields.forEach {
|
||||
if (it.value != null) {
|
||||
serviceDataMap[it.field] = it.value!!
|
||||
var value = it.value
|
||||
if (value != null) {
|
||||
if (it.field == "entity_id" && value is String) {
|
||||
// Remove trailing commas and spaces
|
||||
val trailingRegex = "[, ]+$".toRegex()
|
||||
value = value.replace(trailingRegex, "")
|
||||
}
|
||||
serviceDataMap[it.field] = value
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue