macaroni

state condition

Description:
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):

# 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:

Status: ✅ IMPLEMENTED