Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show example with states with on_enter #41

Open
spuder opened this issue Apr 19, 2023 · 0 comments
Open

Show example with states with on_enter #41

spuder opened this issue Apr 19, 2023 · 0 comments

Comments

@spuder
Copy link

spuder commented Apr 19, 2023

Thank you so much for this esphome component.

As a new user, I've been struggling to get a basic example working. I continued to get this error:

      Must be string, got <class 'esphome.helpers.OrderedDict'>. did you forget putting quotes around the value?.

The reasoning wasn't clear to me until I found this gist for a garage door opener.

Basically the states can be either

state_machine:
  - name: Fan Mode
    states:
      - NORMAL
      - SILENCED

or

state_machine:
  - name: Fan Mode
    states:
      - name: NORMAL
        on_enter:
          - logger.log: "Fan is turned off"
      - name: SILENCED
        on_enter:
          - logger.log: "Fan is turned on"

However, you can not do the following (which is what I was mistakenly doing)

state_machine:
  - name: Fan Mode
    states:
      - id: NORMAL
        on_enter:
          - logger.log: "Fan is turned off"
      - id: SILENCED
        on_enter:
          - logger.log: "Fan is turned on"

It may be obvious to others, but It wasn't clear to me that states needs either a list of strings, or a list of dictionaries with key 'name'. An additional example in the readme may be helpful for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant