This time reaching out for help is based on my previous question, https://community.home-assistant.io/t/how-to-improve-sensor/150832/14
Unfortunaltey I have one other issue with the sensors with the given data set.
value_template: >-
{% if ('{{ states.sensor.oekofen.attributes["ww1"]["L_pump"] }}', 'true') %}
an
{% else %}
aus
{% endif %}
is working fine (result going to correct if / else branch), but is using states.sensor
With the suggestions made by Burningstone and the others above I came up with this version
value_template: >-
{% if is_state_attr('sensor.oekofen', 'ww1'['L_pump'], 'true') %}
an
{% else %}
aus
{% endif %}
it is not giving any error but the if statement is evaluated to the else brach (off, or false) although the data would suggest the if branch (on, or true)
This version
value_template: >-
{% if is_state_attr(('sensor.oekofen', 'ww1')['L_pump'], 'true') %}
an
{% else %}
aus
{% endif %}
gives the result unknown.
This version
value_template: >-
{% if is_state_attr('sensor.oekofen', 'ww1'.['L_pump'], 'true') %}
an
{% else %}
aus
{% endif %}
throws errors when checking the config:
- Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data['sensors']['oekofen_hk1_pump']['value_template']. Got "{% if is_state_attr('sensor.oekofen', 'hk1'.['L_pump']
, 'true') %}\n an\n{% else %}\n aus\n{% endif %}". (See ?, line ?).
This one
value_template: >-
{% if is_state_attr('sensor.oekofen', 'ww1[L_pump]', 'true') %}
an
{% else %}
aus
{% endif %}
is also evaluation to the wrong branch (off).
Looks like I really still have no clue on these JSON things
Hoping for some more help.
Thanks upfront
Ralf