kid
(Alex)
1
Hi,
I don’t get why I get from HA here “Conditions are invalid”:
type: conditional
conditions:
- condition: template
value_template: >-
{% set lc = states.binary_sensor.mailbox_contact.last_changed %} {{ lc
is not none and lc.date() == now().date() }}
card:
type: markdown
content: >
**📬 mailbox opend at {{
states.binary_sensor.mailbox_contact.last_changed.strftime('%H:%M') }}**
That should be pretty straigt forward, I tried already many variances, but with the error message no idea where to exactly find the error.
Template conditions are not supported for cards.
Create a template binary sensor and use it instead.
kid
(Alex)
3
Thank you, working now. The solution:
in configuration file:
binary_sensor:
- platform: template
sensors:
mailbox_today:
unique_id: mailbox_today
value_template: >-
{% set lc = states.binary_sensor.mailbox_contact.last_changed %}
{% if lc is not none and lc.date() == now().date() %}
true
{% else %}
false
{% endif %}
card in dashboard:
type: conditional
conditions:
- condition: state
entity: binary_sensor.mailbox_today
state: "on"
card:
type: markdown
content: >-
**📬 Mailbox opened at {{
states.binary_sensor.mailbox_contact.last_changed.astimezone().strftime('%H:%M') }}**
title: Mailbox