To ensure the current state of a capability is reflected in the "Alice Home" app and can be answered by Alice, you must define a state source. While omitting a state source won't prevent control, the device state will not be reported correctly.
Ways to define the state source:
state_entity_id: The entity whose state represents the capability state.state_entity_id + state_attribute: The value of a specific attribute within the state_entity_id entity.state_template: A Jinja2 template that evaluates to the capability state.
Note: state_entity_id can be omitted if it is the same entity being configured, but it is recommended to specify it explicitly to avoid confusion.
# Example: Using state_entity_id
yandex_smart_home:
entity_config:
fan.air_purifier:
custom_toggles:
controls_locked:
state_entity_id: switch.air_purifier_child_lock
turn_on: ...
turn_off: ...
# Example: Using state_entity_id + state_attribute
yandex_smart_home:
entity_config:
vacuum.mop:
modes:
work_speed:
eco: 'V1'
medium: 'V2'
custom_modes:
work_speed:
state_entity_id: vacuum.mop
state_attribute: water_level
set_mode: ...
# Example: Using state_template
yandex_smart_home:
entity_config:
water_heater.kettle:
custom_toggles:
mute:
state_template: '{{ is_state("switch.kettle_beeper", "off") }}'
turn_on: ...
turn_off: ...