Error in log, template sensor

Why do I get this in my log like every second? Can’t se anything wrong:

2023-01-07 12:09:18.812 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: ‘dict object’ has no attribute ‘sonnen’ when rendering ‘{{ value_json.sonnen }}’

2023-01-07 12:09:19.807 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: ‘dict object’ has no attribute ‘sonnen’ when rendering ‘{{ value_json.sonnen }}’

2023-01-07 12:09:19.814 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: ‘homeassistant.util.read_only_dict.ReadOnlyDict object’ has no attribute ‘Pac_total_w’ when rendering ‘{{ states.sensor.json_sonnen.attributes[“Pac_total_w”] }}’

In my configuration it looks like this:

 resource: http://192.168.1.208/api/v2/status
    value_template: '{{ value_json.sonnen }}'
    scan_interval: 1
  - platform: template
    sensors:
      sonnen_stromverbrauch:
        friendly_name: 'Power Consumption W'
        value_template: '{{ states.sensor.json_sonnen.attributes["Consumption_W"] }}'
        unit_of_measurement: watt
      sonnen_stromeinspeisung:
        friendly_name: 'Electricity Feed In W'
        value_template: '{{ states.sensor.json_sonnen.attributes["GridFeedIn_W"] }}'
        unit_of_measurement: watt
      sonnen_stromerzeugung:
        friendly_name: 'Power Generation W'
        value_template: '{{ states.sensor.json_sonnen.attributes["Production_W"] }}'
        unit_of_measurement: watt
      sonnen_stromspeicher:
        friendly_name: 'Remaining Charge %'
        value_template: '{{ states.sensor.json_sonnen.attributes["USOC"] }}'
      sonnen_operatingmode:
        friendly_name: 'Mode'
        value_template: '{{ states.sensor.json_sonnen.attributes["OperatingMode"] }}'
      sonnen_batterycharging:
        friendly_name: 'Laddar'
        value_template: '{{ states.sensor.json_sonnen.attributes["BatteryCharging"] }}'
      sonnen_batterydischarging:
        friendly_name: 'Laddar ur'
        value_template: '{{ states.sensor.json_sonnen.attributes["BatteryDischarging"] }}'
      sonnen_effekt:
        friendly_name: 'Effekt'
        value_template: '{{ states.sensor.json_sonnen.attributes["Pac_total_w"] }}'  
        unit_of_measurement: watt

What is the output of browsing to http://192.168.1.208/api/v2/status ?

It’s just a number

That’s the reason why.
HA is trying to parse a json according to your definition.
You’re telling it that it will be a json, and to expect a root tag named “sonnen” but you only get a number.

Template variable warning: ‘dict object’ has no attribute ‘sonnen’