Added all as an available entity_id for autocompletion (#364)

This commit is contained in:
Kevin T. Berstene 2020-02-10 22:13:55 -05:00 committed by GitHub
parent 6db3201c24
commit 876914a918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,11 +59,18 @@ class WidgetDynamicFieldAdapter(
// If field is looking for an entity_id,
// populate the autocomplete with the list of entities
if (fieldKey == "entity_id" && entities.isNotEmpty()) {
val domainEntities: ArrayList<String> = ArrayList()
// Only populate with entities for the domain
// or for homeassistant domain, which should be able
// to manipulate entities in any domain
val domain = services[serviceText]!!.domain
val domainEntities: ArrayList<String> = ArrayList()
// Add all as an available entity
// all is a special keyword, so it won't be listed in any
// domains even though it is available for all of them
domainEntities.add("all")
if (domain == ("homeassistant")) {
domainEntities.addAll(entities.keys)
} else {