I have the following conditional template in an automation:
value_template: >-
"{{(state_attr('automation.waste_collection_yellow_bin_collected',"last_triggered")
== none) or not
(state_attr('automation.waste_collection_yellow_bin_collected',"last_triggered")|
as_datetime|as_local()).day==now().day }}"
That is always evaluating to false, but if I copy paste the same template into the dev tools, it evaluates to true as expected.
Does anyone have any ideas why I am getting different behavior between the automation engine and dev tools?
You shouldn’t use quotes around the template when using the multiline string operator:
value_template: >-
{{(state_attr('automation.waste_collection_yellow_bin_collected',"last_triggered")
== none) or not
(state_attr('automation.waste_collection_yellow_bin_collected',"last_triggered")|
as_datetime|as_local()).day==now().day }}