–Edit-- Fixed it. See current action section. leaving this here for posterity (or can be deleted if Mods so require –
Struggling with a certain message that I’m trying to have Slack send for us. Can anybody point out what mistake I’m making in my template that causes an unknown error rendering template in the below code?
- id: dailychoresalerttime
alias: 'Daily Chores Alert - Time'
trigger:
- platform: time
at: '20:00:00'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.chore_clean_kitchen
state: 'off'
- condition: state
entity_id: input_boolean.chore_sweep_kitchen
state: 'off'
- condition: state
entity_id: input_boolean.chore_dishes_away
state: 'off'
- condition: state
entity_id: input_select.family_status
state: 'Home'
action:
- service: notify.slack
data_template:
message: >
{% set include_entity = ['input_boolean.chore_sweep_kitchen', 'input_boolean.chore_clean_kitchen', 'input_boolean.chore_dishes_away'] %}
{%- for entity in states.input_boolean|selectattr('entity_id','in',include_entity) if entity.state == 'off' -%}
{%- if loop.first -%}Remember to {%- elif loop.last -%}, and, {%- else -%},{% endif %} {{ entity.attributes.friendly_name }}
{%- endfor -%}
My goal is to have Slack send a message that says, “Remember to [Friendly Name of various input_booleans which are currently “off”]”
Mucking around with this in Developer Tools --> Template, I can get the message template to work if I remove the {% if states(entity == “off”) %} and the followup {% endif %}, but currently this results in an “Unknown error rendering template”.
Any assistance would be greatly appreciated. Thanks as always.