Is there a way to use a secret from the secrets.yaml file in an if-then statement?
For example, I want to use a code/value/phrase passed from Alexa to HA, then compare that code/value/phrase against a value stored in the secrets.yaml file. The if-then statement is used to determine what response Alexa will say as a response.
As an example, the code below is working for me currently. The alarm code (1111) is currently hard-coded in the if-then statement in the intent:
ArmAlarmAwayIntent:
action:
service: alarm_control_panel.alarm_arm_away
entitiy_id: alarm_control_panel.ha_alarm
data:
code: !secret alarm_code
speech:
type: plaintext
text: >
{%- if Code == "1111" -%}
Arming the alarm away, Goodbye
{%- else -%}
Invalid code, please try again
{%- endif -%}
I’d like to replace the “1111” with the !secrets alarm_passcode
value so that I don’t have to hard-code it in all my automations. Is this possible?