Hey Everyone.
I’m trying to write an intent for alexa to figure out if a switch is on, or off. I’ve tried using ‘state’, ‘is_state’, and a few others but I keep getting errors. Has anyone done this?
Here’s the code I’ve been messing with:
TestIntent:
speech:
type: plaintext
text: >
{% if state('switch.front_dooropened', 'on') %}
The front door is open.
{% elif state('switch.front_dooropened', 'off') %}
The front door is closed.
{% endif %}
Any suggestions, or help would be greatly appreciated.
QueryGarageDoorIntent:
speech:
type: plaintext
text: >
{% if is_state('switch.garage_door', 'on') %}
the garage door is open
{% else %}
the garage door is closed
{% endif %}
(My garage door is setup to look like a switch, not a cover)
Thanks for the response guys, that’s what I was looking for!
So if I use this, it Works:
TestIntent:
speech:
type: plaintext
text: >
{% if is_state('switch.front_dooropened', 'on') %}
The front door is open.
{% else %}
The front door is closed.
{% endif %}
Also, if i use this, it Works!
TestIntent:
speech:
type: plaintext
text: >
{% if is_state('switch.front_dooropened', 'on') %}
The front door is open.
{% elif is_state('switch.front_dooropened', 'off') %}
The front door is closed.
{% endif %}
i understand that I don’t need to use the ‘elif’ but it will help me make more comprehensive loops.
Thanks again!