#REQUEST: When List is updated — send notification to X

1 messages · Page 1 of 1 (latest)

solar saddle
#

That could be game changer.

floral oriole
#

What do you mean by "list"?

solar saddle
# floral oriole What do you mean by "list"?

I managed to do it.

Like, there've been shopping lists on HA for a while now. Just wanted to make an automation that notifies ONE when something is added to the list, it notifies.

The problem is, it notifies me even when I remove stuff from the list, and it notifies every single time attribute changes, so that’s kinda annoying.

#

alias: List automation test
description: ""
triggers:

  • trigger: state
    entity_id:
    • todo.ron
      conditions: []
      actions:
  • device_id: b4e541f27a11a81e4a35314abea66d51
    domain: mobile_app
    type: notify
    message: Test
    title: Test
    mode: single
floral oriole
#

You can probably get it to notify on add only if you can figure out what the event for that looks like.

unkempt nimbus
#

So the todo list state is the current length of the list

#

You can quite easily create a condition to filter out removing items - a template condition is probably easiest:

condition: template
value_template: "{{ trigger.to_state.state | int(1) > trigger.from_state.state | int(0) }}"
#

As for not messaging you on every update.. that's somewhat trickier and it depends exactly on what you want to do

If you change your trigger to use the "for" modifier, you can set it to send a message only if the number of items hasn't changed in (for example) a minute - so you can add a number of things quickly and it won't send a notification until a minute after you added your last one - however, this has the downside of meaning if you add 20 items but then decide to remove the last one - you won't get a notification at all

A more robust solution would be to not use the condition i just gave you and instead to have a copy of your todo list in some format (honestly, probably just a second todo list) that when the automation runs it looks at the contents of the "working list" and sees if there are any entries in it that are not in the "stored list" - if there are, send a notification, and either way copy the working list contents into the stored list for the next comparison. You'd still use the "for" condition to prevent multiple triggerings while you are adding things though

solar saddle
#

like, when I click the notification, it’ll direct me right to the specific view (list1) in the specific dashboard (adaptive-dash).

unkempt nimbus
unkempt nimbus
#

you can delete one of those data lines depending on your phone OS