state conditionDescription:
The state condition checks to see if a named state is set and/or contains a specific value.
Parent: all, any, condition, conditions, none, not , wait
Value (simple form): string specifying the name of the state (checks for existence, contents irrelevant)
Value (key/value form):
name: string, required, specifying state namevalue: string, optional, specifying text that must match state value exactly (default: null)contains: string, optional, specifying text that must be contained in state value (default: null)# simple form
global: (string)
# simple example
global: location
# key/value form
global:
name: (string, required)
value: (string, optional)
contains: (string, optional)
# key/value example
global:
name: location
contains: WA
EXAMPLE:
- triggers:
- my favorite {thing} is {what}
execute:
- global: 'favorite.{thing}'
value: '{what}'
- display: "Setting your favorite {thing} to {what}"
- speak: "Setting your favorite {thing} to {what}"
- triggers:
- what is my favorite {thing}
execute:
- display: "Your favorite {thing} is {favorite.{thing}}"
- speak: "Your favorite {thing} is {favorite.{thing}}"
- triggers:
- is {what} my favorite {thing}
- is my favorite {thing} {what}
execute:
- if:
- global: 'favorite.{thing}'
value: '{what}'
then:
- display: "Yes, '{what}' is your favorite '{thing}'"
- speak: "Yes, '{what}' is your favorite '{thing}'"
else:
- display: "No, '{what}' is not your favorite '{thing}'"
- speak: "No, '{what}' is not your favorite '{thing}'"
Additional information:
value nor contains is specified, the condition will check to see that the named state is set, regardless of the valueStatus: ✅ IMPLEMENTED