Weepwar
(Ben Chatain)
February 24, 2024, 1:03am
1
i have the following automation that when i enter a zone i get sent a notification of my to do list but i want the condition to be only send if the list has items. if empty dont send.
alias: Bens Woolies Shopping List
description: “”
trigger:
platform: zone
entity_id: person.ben_cown
zone: zone.wollies
event: enter
condition:
condition: numeric_state
entity_id: todo.woolies_shopping_list
above: 0
action:
service: notify.mobile_app_iphone
data:
data:
clickAction: /To-do_lists
url: /todo?entity_id=todo.woolies_shopping_list
message: Don’t forget these items!
title: Woolworths Shopping List
mode: single
when i test the condition and the list is empty the condition does not pass however the notification still gets sent.
when i check the logbook i get the following on the condition:
This step was not executed and so no further trace information is available.
any ideas on how to make this work?
ljane
February 24, 2024, 1:13am
2
I’m not very experienced but did notice:
in the first bullet. Should wollies be woolies?
Weepwar
(Ben Chatain)
February 24, 2024, 1:19am
3
no, it looks like I misspelled my zone when I set it up. I have renamed the zone woolies and updated the code. same result,
jeffcrum
(Jeff Crum)
February 24, 2024, 1:20am
4
Please paste the code correctly.
There is a pinned post that tells how to do it.
Weepwar
(Ben Chatain)
February 24, 2024, 1:34am
5
sorry new here.Hope this is correct.
alias: Bens Woolies Shopping List
description: ""
trigger:
- platform: zone
entity_id: person.ben_chatain
zone: zone.woolies
event: enter
condition:
- condition: state
entity_id: todo.woolies_shopping_list
state: ">0"
attribute: supported_features
action:
- service: notify.mobile_app_iphone
data:
data:
clickAction: /To-do_lists
url: /todo?entity_id=todo.woolies_shopping_list
message: Don't forget these items!
title: Woolworths Shopping List
mode: single
jeffcrum
(Jeff Crum)
February 24, 2024, 12:19pm
6
You are actually looking at the attribute called supported_features instead of the state.
Paste the following into Developer Tools | Template to see the difference.
{{ states.todo.woolies_shopping_list.attributes }}
{{ states.todo.woolies_shopping_list.attributes.supported_features }}
{{ states.todo.woolies_shopping_list.attributes.supported_features > 0 }}
{{ states.todo.woolies_shopping_list.state }}
{{ states.todo.woolies_shopping_list.state | int > 0 }}
Weepwar
(Ben Chatain)
February 25, 2024, 5:31am
7
thank you for the response. as mentioned i am new to this. would you be able to give advise on what i need to change on the code to make this work?
jeffcrum
(Jeff Crum)
February 25, 2024, 1:23pm
8
I think your first post should work using the numeric_state condition of above 0.
You say when you test it, the condition fails and the notification still happens. Do you mean you run the automation? If so, conditions are ignored when you do that.
You need to actually enter the zone for a test.
Or, set your zone to woolies in Developer Tools | State
Weepwar
(Ben Chatain)
February 26, 2024, 6:28am
9
thanks for your help. I tried it in the zone and it worked. I didn’t realise conditions are ignored when you run automations.