Dynamic input numbers entities

Have a bunch of sensors and input numbers that I will like to consolidate and create a single automation rule. The input numbers are having naming conventions following the sensors

It works like this (don’t mind the spacings)

Triggers from multiple entities

trigger:
- platform: numeric_state
entity_id: sensor.solar_angle, sensor.azimuth
below: 10000

Conditions to check against sensor state against “dynamic input numbers”

condition:
condition: template
value_templates: >
{% set entityId = (trigger.entity_id.split(“.”)[1]) %}
{{ trigger.to_state.state }} > {{ states(‘input_number.{{entityId}}’) }}

I can’t get the “dynamic input numbers” working, or is this even possible…?