Don't understand the changes in the new template engine

Dear all,
after updating from 116.4 to 118.2 I experince trouble with at least one of my template sensors.
I found the breaking changes section in the release notes but I can’t figure what I would have to change.
This is my sensor setup:

#Oekofen Heizung
  - platform: rest
    resource: http://x.y.z.a?
    scan_interval: 10
    name: "oekofen"
    value_template: "{{ value_json['system.system_info'] }}"
    json_attributes:
      - system
      - weather
      - forecast
      - hk1
      - ww1
      - pe1
      - error
  - platform: template
    sensors:
      oekofen_aussentemp:
        friendly_name: 'Heizung Aussentemp. Fühler'
        value_template: "{{ ((state_attr('sensor.oekofen', 'system')['L_ambient'] | int) *0.1) | round(1) }}"
        unit_of_measurement: "°C"

The sensor oekofen is giving the same output as before:

system: 
system_info: system global variables
L_ambient:
  val: '81'
  unit: '?C'
  factor: '0.1'
  min: '-32768'
  max: '32767'
...

friendly_name: oekofen

Anyhow, the sensor oekofen_aussentemp gives me a reading of 0.0 which is the same for all other sensors related to the heating. Just saying, a heating with all values 0.0 would make that much sense the values are not 0 in the rest sensor reply.

:roll_eyes: :roll_eyes: :roll_eyes:

I know, it should be easy but I can’t figure it.

Thanks for support!!
Ralf

This doesn’t make sense. This will return the whole array. If you want the value, you would need

(state_attr('sensor.oekofen', 'system')['L_ambient']['val'] | int)

or a [0], or something. Not sure how it worked before. Maybe if you didn’t specify something, it defaulted to [0]?

Either way, just specify the exact field you want.

1 Like

Jim, you are absolutely right.

I just wonder, why it was working for almost a year with this configuration.

As I said, it ought to be very simple.

Thanks

The int filter converts anything non-numeric to 0.

Based on your description of the data, the result of this template is a dictionary, not a number.

{{ state_attr('sensor.oekofen', 'system')['L_ambient'] }}

If you add an int filter to the end of the template, it will report 0.

It’s hard to believe that ever worked correctly in previous versions, unless the data’s format has changed since 0.116 (i.e. L_ambient contained a number and not a dictionary).