Not passing an entity ID to a service to target all entities is deprecated. Update your call to vacuum.return_to_base to be instead: entity_id: all

Hi all,

I have an automation that looks like this:

- alias: Xiaomi støvsuger timer 
  trigger:
    platform: state
    entity_id: vacuum.xiaomi_vacuum_cleaner
    from: 'docked'
    to: 'cleaning'
    for:
      hours: 1
  action:
    service: vacuum.return_to_base

It did not return to base after one hour. But i found this error message:
Not passing an entity ID to a service to target all entities is deprecated. Update your call to vacuum.return_to_base to be instead: entity_id: all

What does this mean and what is wrong?

It means you should change the action to either this:

  action:
    service: vacuum.return_to_base
    entity_id: vacuum.xiaomi_vacuum_cleaner

or this:

  action:
    service: vacuum.return_to_base
    entity_id: all

Thanks a lot for such a quick reply @pnbruckner :slight_smile:

So it just meant I need to add the entity_id under the service. I got confused of this because it tells me "Update your call to vacuum.return_to_base to be instead : entity__id: all. So since it says instead. For me this meant something like this:

vacum.return_to_base changed out to entity_id: all which of course does not make any sence.

Not all, but most service calls take parameters, the most common of which is entity_id. The documentation for most service calls will list what parameters can be sent, and whether each parameter is required or optional. The doc for this service shows that entity_id is optional. If you do not specify it, then it defaults to all vacuum entities.

However, the fact that the entity_id is optional is deprecated, meaning that in a future release you will always need to specify it. And if you want it to perform the service for all vacuum entities, you will need to specify that explicitly by using entity_id: all.

I’ll grant you that the wording of the message could be better. Would it be more understandable if it said the following?

“Update your call to vacuum.return_to_base by adding: entity_id: all.”

It was a breaking change a few releases ago. What it basically means is that if you do not specify an entity_id it will try to pass it to all entities. (I had this problem with input_select, in which it would give me errors as it would try to pass the command to all input_select switches). You already have the solution, but now you know why :stuck_out_tongue:

Thanks again for your explanation:slight_smile:
It makes all sense to me now.

I guess by changing the error message to:

“Update your call to vacuum.return_to_base by adding: entity_id: all.” 

will be less confusing. Not sure why they used the word instead.

Thanks for the tip about this warning. I also got this today but for the light.turn_on service.

“Update your call to light.turn_on to be instead: entity_id: all” was also confusing to me :slight_smile: