Using value as part of sensor

I try to get this one working:

condition: template
value_template: >-
  {{ states("sensor.thermal_comfort_garten_absolutehumidity")|float <
  (states("sensor.thermal_comfort_"+(area_name(trigger.entity_id)|string)+"_absolutehumidity")|float)
  }}

Idea:
I’m trying to use the area name of the trigger sensor as part of the entity to check the value.

eG:

Trigger:
ID: sensor.sonoff _ house_relativehumidity
Value: 50
Area: house

Sensor:
ID: sensor.thermal_comfort_garten_absolutehumidity
Value 10

Sensor2:
ID: sensor.thermal_comfort _ house_absolutehumidity
Value 20

if Sensor1 < Sensor2; then …

So I want to create the name for the second sensor with the value room from the trigger

(Please ignore the spaces, formatting bug in the forum software)

If you plug it into the template editor, what error does it give? Ignore that - it won’t have a trigger.

Try adding quotes around trigger.entity_id

You need to assign defaults for your float() filters. I would also use the slugify filter instead of string in case you have capitals or spaces in your Area names.

condition: template
value_template: >-
  {{ states("sensor.thermal_comfort_garten_absolutehumidity") | float(0) <
  (states("sensor.thermal_comfort_" + (area_name(trigger.entity_id) | slugify) + "_absolutehumidity") | float(0))
  }}

Sorry for the delay. This worked out. Finally i can recommend open the window based on the absolute values of humidity :smiley: