Entity_id is deprecated - and what I should do about it isn't clear

Hi,

I’ve been trying to fix a problem with my HAss and all I’m succeeding in doing is making it worse. I have the following sensors

- platform: template
  sensors:
    people_home:
      entity_id:
        - person.steve_thompson
        - person.person2
        - person.person3
        - person.person4
      friendly_name: "People Home"
      unit_of_measurement: 'home'
      value_template: >
        {{ states.person | selectattr('state','eq','home') | list | count }}

- platform: template
  sensors:
    people_away:
      entity_id:
        - person.steve_thompson
        - person.person2
        - person.person3
        - person.person4
      friendly_name: "People Away"
      unit_of_measurement: 'away'
      value_template: >
        {{ states.person | selectattr('state','ne','home') | list | count }}

Now the confusing thing is that “people home” works but people away always shows 0. So I thought I’d have a go at fixing it tonight and started looking through the logs for clues. I found this


* The 'entity_id' option near /config/sensors/occupation_automation.yaml:3 is deprecated, please remove it from your configuration
* The 'entity_id' option near /config/sensors/occupation_automation.yaml:16 is deprecated, please remove it from your configuration

Sounds like a simple fix. So I removed entity_id - and re-aligned the YAML - and restarted HAss. And the logs filled up with errors but it wasn’t very clear what the actual problem was because the errors related to all the things that loaded after this automation no longer being able to load. This is always a classic sign of YAML justification problems but I quadruple checked it and it’s correct. So I put entity_id back and everything’s back how it was.

Google and this forum just found me examples that were all “remove enitity_id” and everything will work. But that isn’t the case for me. Can anyone see if there’s something else I need to do or point me a bit of documentation that I haven’t been able to surface that will explain if there’s subsequent changes I need to make post entity_id removal?

Thanks for any pointers.

Steve

- platform: template
  sensors:
    people_home:
      friendly_name: "People Home"
      unit_of_measurement: 'home'
      value_template: >
        {{ states.person | selectattr('state','eq','home') | list | count }}

- platform: template
  sensors:
    people_away:
      friendly_name: "People Away"
      unit_of_measurement: 'away'
      value_template: >
        {{ states.person | selectattr('state','ne','home') | list | count }}

Thanks - that explains why I can’t figure it out. “person5” is my 25 year old so who doesn’t live here anymore but detecting his presence is useful so he exists in HA but don’t want to count him in this sensor. Does this mean I need to specify each person in the ‘eq’,‘home’ value template? I suppose I can simplify this by making people_away = 4 - people home.