#REQUEST: When List is updated — send notification to X
1 messages · Page 1 of 1 (latest)
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:
- todo.ron
- device_id: b4e541f27a11a81e4a35314abea66d51
domain: mobile_app
type: notify
message: Test
title: Test
mode: single
You can probably get it to notify on add only if you can figure out what the event for that looks like.
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
alright, I’ll figure this out.
do u know how I can set a path of that notification to the specific view?
Inside my dashboard, there’s a view of lists. that’s the path, but I can’t figure how I can do it.
/config/ui_lovelace_minimalist/dashboard/adaptive-dash/views1/list1
like, when I click the notification, it’ll direct me right to the specific view (list1) in the specific dashboard (adaptive-dash).
i am not sure how you can send a "click me to go to X" message like that in the companion app... there's almost certainly a way, but IDK how
ok, it is doable - something like:
action:
- action: notify.mobile_app_<your_device_id_here>
data:
title: "To-Do Items Added"
message: "To-Do Items Added"
data:
# iOS URL
url: "/config/ui_lovelace_minimalist/dashboard/adaptive-dash/views1/list1"
# Android URL
clickAction: "/config/ui_lovelace_minimalist/dashboard/adaptive-dash/views1/list1"
you can delete one of those data lines depending on your phone OS