Help! missed comma between flow collection entries

Hello guys,

I tested my code with Developers tool but in yaml file have this error missed comma between flow collection entries my code is?

binary_sensor:

  • name: ‘sw1’
    unique_id: sw-1
    state_topic: ‘server/XXXXXXXXXXXXXXXXXXXXX/state’
    value_template: {{ (state_attr(‘value_json.sw1’ , ‘on’)) }}
    payload_on: ‘1’
    payload_off: ‘0’

You have to add outer double-quotes to the template:

value_template: "{{ (state_attr('value_json.sw1' , 'on')) }}"

Reference: Important Templating Rules

2 Likes

thanks a lot

2 Likes

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.