Condition template not working in automation, but it does in dev tools

Hi there!

I’m going crazy with this simple condition for an automation. It compares two sensor illuminance levels and supposed to return true or false as a condition to the automation.

(state_attr('Presence1', 'illuminance lux')|int) > (state_attr('Presence2', 'illuminance lux')|int)

When I evaluate it using the GUI button to do so it returns following error:

template value should be a string for dictionary value @ data[‘value_template’]. Got None

I have tried using simple quotes, double ones but with same results.

The strange thing is that I have built the template in the dev tools and it was working there as expected returning a Boolean.

Anybody can give me some light about this?

Many thanks folks.

Can you show the entire condition block?

My bad!!! After write it down here I had a bad feeling about the template itself.
As the presence sensors are Zigbee ones with illuminance sensor included it seems that the name of the sensors was incorrect:



So if I update the automation condition accordingly now it’s working:

  - condition: template
    value_template: >-
      {{ (states('sensor.Presence1_illuminance_lux')|int) >
1 Like