core: Home Assitant API rest sensors no longer working

The problem

Since updating to 2023.3.1 the following restful sensors are reporting as undefined:

rest:
  - resource: http://homeassistant:8123/api/hassio/core/stats
    verify_ssl: false
    headers:
      Authorization: !secret ha_api_token
      Content-Type: application/json
    scan_interval: 31
    sensor:
    - name: "Core CPU"
      value_template: '{{ value_json.data.cpu_percent|round(2) }}'
      unit_of_measurement: '%'
    - name: "core_memory" # Customized as, friendly_name: Core RAM
      value_template: '{{ value_json.data.memory_percent|round(2) }}'
      unit_of_measurement: '%'
  
  - resource: http://homeassistant:8123/api/hassio/supervisor/stats
    verify_ssl: false
    headers:
      Authorization: !secret ha_api_token
      Content-Type: application/json
    scan_interval: 29
    sensor:
    - name: "Supervisor CPU"
      value_template: '{{ value_json.data.cpu_percent|round(2) }}'
      unit_of_measurement: '%'
    - name: "supervisor_memory" # Customized as, friendly_name: Supervisor RAM
      value_template: '{{ value_json.data.memory_percent|round(2) }}'
      unit_of_measurement: '%'

I have tried generating new tokens but this did not help.

What version of Home Assistant Core has the issue?

core-2023.3.2

What was the last working version of Home Assistant Core?

core-2023.2.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

RESTful

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rest/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-03-09 13:21:53.411 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.data.cpu_percent|round(2) }}'
2023-03-09 13:21:53.413 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.data.memory_percent|round(2) }}'
2023-03-09 13:21:53.413 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.data.cpu_percent|round(2) }}'
2023-03-09 13:21:53.414 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.data.memory_percent|round(2) }}'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 24 (9 by maintainers)

Most upvoted comments

This issue is marked as “rest” but has nothing to do with rest. See the linked issue.

Thank you.

Same place. IMG_2039

Is there a solution Nick?

Probably but I wasn’t involved in that change so I don’t know what it is yet.