Count persons at home and show on icon badge

You shouldn’t need that |int bit anymore.

1 Like

Nice.
The message is gone but I still get the notification sound, even though I hashtagged it.

action:
  service: notify.ios_notify_group
  data:
    message: delete_alert
    data:
      push:
        badge: 0
#            sound: "solemn.mp3"

You’re getting the default sound still?

yes, I guess it is the default sound.

You might be able to disable it by doing sound: "".

no change. I still get the sound.
I tried to update notification settings in the app and restarted the iPhone.

Finding the same problem with sound.

Any solution to this yet?

any news regarding this sound issue?

Hi. Did you had any change to look at this sound issue yet?

Sound is nothing by default in 2.0 now. So this should be working for you.

great… I will try it out. Thanks :slight_smile:

try this

{{ states | selectattr("entity_id","in", ["device_tracker.person_1", "device_tracker.person_2", "device_tracker.person_3", "device_tracker.person_4"] ) |selectattr("state","eq","home") | list | count | int }}

thanks :slight_smile:

Is the use of “delete_alert” not allowed any more? I just want an icon badge without any message, but after the latest updates I get a push “delete_alert”

Pretty sure it’s delete_badge…

I tried this but then I just get a push notification “delete_alert”

  • service: notify.notify_group
    data_template:
    message: “delete_badge”

I tried with emty quotation marks “” and then no message is sent but I get the following error:

ERROR (Thread-9) [homeassistant.components.ios.notify] No message parameter was found in the notification payload.

As mentioned earlier in this post I only want the number on the icon badge without any message.

Sorry the message to send is “clear_badge” not delete_badge.

You can even further simplify. I would also recommend to use entity ‘person’ with 1-to-n device trackers. This avoids double counting if you have several devices trackers per person.

  people_at_home:
    entity_id:
      - person.01
      - person.02
      - person.03
    friendly_name: "How many people are at home?"
    value_template: >-
      {{ states.person | selectattr('state', 'eq', 'home') | list | count | int }}

thanks. I will try it out