Do not select all entities when omitting entity ID in service call#29178
Conversation
amelchio
left a comment
There was a problem hiding this comment.
entity_idhas not been set to required because it is allowed to just specifyarea_idto select entities.
So we now fail silently?
It would be quite useful to have the constraint (need one or the other) encoded in the schemas.
| if ATTR_ENTITY_ID in call.data: | ||
| target_all_entities = call.data[ATTR_ENTITY_ID] == ENTITY_MATCH_ALL | ||
| else: | ||
| # Remove the service_name parameter along with this warning |
There was a problem hiding this comment.
This comments says that further changes are needed if it is deleted :)
| service_name, | ||
| ENTITY_MATCH_ALL, | ||
| ) | ||
| target_all_entities = True |
There was a problem hiding this comment.
We should remove the auto target and convert the warning into error and fail on this service call
9f68c31 to
73a6d52
Compare
|
I've updated the code to always require either |
Breaking Change:
It is no longer possible to target all entities by not passing both
entity_idandarea_idto your service data. This feature was previously deprecated and has been printing warnings. The correct way to target all entities is to setentity_id: allDescription:
Remove the feature to automatically target all entities if you did not specify an entity.
Previously attempted in #25715.
entity_idhas not been set to required because it is allowed to just specifyarea_idto select entities.Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: