Template value should be a string for dictionary value @ data['value_template']. Got None

Hi,
I have problem with template in Automation.
I have template sensor:

  • sensor:
    • name: Kitchen Status
      icon: mdi:list-status
      state: >-
      {% if is_state(‘switch.sonoff_1000b9c733_2’,‘on’) or is_state(‘switch.sonoff_1000b9c733_1’,‘on’) or is_state(‘switch.sonoff_10014878a0’,‘on’) or is_state(‘switch.sonoff_10008f942f’,‘on’) or is_state(‘binary_sensor.miboxbephass_interactive’,‘on’) -%}
      on
      {%- else -%}
      off
      {%- endif %}

i’m trying automation with conditions:
> condition: template
> value_template: ‘{{states(’‘sensor.kitchen_status’‘) == ‘‘off’’}}’

But result with error: template value should be a string for dictionary value @ data[‘value_template’]. Got None
I’m trying with Template in Developer Tool have correct result.
And test run automation don’t run with that conditions.

Sorry because My English is not good.

Not sure what character those apostrophes are but they are not right.

Thanks for answer.
In Template Conditions for Test or in Template Sensor?

value_template: '{{ is_state("sensor.kitchen_status", "off") }}'

Why don’t you use binary_sensor ?

anywhere you have them, I copied your template into my home assistant and it gave an error for those characters.

1 Like