Template help: value_json is undefined

I am trying to run this in the template editor:

  - platform: command_line
    name: Supervisor updates
    command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"addons":[.data.addons[] | select(.version != .installed)]}'''
    value_template: "{{ value_json.addons | length }}"
    json_attributes:
    - newest_version
    - current_version
    - addons

and I get UndefinedError: ‘value_json’ is undefined
It seems to work as a template.
I see after searching that you you will need to declare the contents of that variable in the editor by using the ‘set’ command.
How do I do this make make this run in the editor?

Thanks.

The Template Editor is for testing Jinja2 templates, not for testing the configuration of a Command Line Sensor (or other integrations). Plopping some sensor’s configuration into the Template Editor doesn’t create the sensor itself. Your template refers to value_json which is undefined within the Template Editor.

Please consider asking basic templating questions in a separate topic because this one is meant for discussing the implementation of default values. Done.