Show example with states with on_enter
Opened this issue · 0 comments
spuder commented
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.