Hello,
I try to change an Input select according to a sensor value.
It will be used in an automation but I want to test it using develloper tools.
I select the service ‘Input Select: Select’ and use the following yaml:
service: input_select.select_option
target:
entity_id: input_select.mode_radiator
data:
option: >
{% if is_state('sensor.mqtt_radmode_command', '3') %}
'Eco'
{%- else -%}
'Arret'
{%- endif %}
It doesn’t work, I have the following error in the log:
2021-04-05 17:24:31 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: {% if is_state('sensor.mqtt_radmode_command', '3') %}
'Eco'
{%- else -%}
'Arret'
{%- endif %}
(possible options: Arret, Hors-gel, Eco, Confort -2, Confort -1, Confort)
Can someone help me on that ?
Thank you,
Maxime.
tom_l
2
What does this return in the developer tools template editor?
{% if is_state('sensor.mqtt_radmode_command', '3') %}
'Eco'
{%- else -%}
'Arret'
{%- endif %}
And this?
{% if is_state('sensor.mqtt_radmode_command', '3') %}
'Eco'
{% else %}
'Arret'
{% endif %}
I red that data_template used to be used but I can’t used it in the developer tools.
When using it, the “call Service” buton turns grey.
tom_l
6
Hold on, you testing this in the developer tools services menu.
That does not currently support templating.
The current beta version has just introduced this.
Either try the beta, wait till 2021.4 is released or just try it in your automation. From the template editor results it should work.
This is the answer !
I always use the developers tools menu to test things. I didn’t know this limitation.
Thank you !
tom_l
8
It won’t be a limitation later this month.
Hi ! I Have a Problem with this template …
Can someone help me ? lot of thanks !
>
> service: input_select.select_option
> target:
> entity_id: input_select.vitesse_aspiration
> data:
> option: >
> {%- if state_attr('input_select.vitesse_aspiration', 'fan_speed') == "off"
> -%}
> off
> {%- elif state_attr('input_select.vitesse_aspiration', 'fan_speed') ==
> "quiet" -%}
> Calme
> {%- elif state_attr('input_select.vitesse_aspiration', 'fan_speed') ==
> "balanced" -%}
> Equilibré
> {%- elif state_attr('input_select.vitesse_aspiration', 'fan_speed') ==
> "turbo" -%}
> Turbo
> {%- elif state_attr('input_select.vitesse_aspiration', 'fan_speed') == "max"
> -%}
> Max
> {%- elif state_attr('input_select.vitesse_aspiration', 'fan_speed') ==
> "custom" -%}
> Personnalisé
> {%- endif -%}