Compare two entities with wildcard

My intention is to create a notification, if the indoor humidity becomes a problem. I learned that the relative humidity is not sufficient to create that warning alone. Rather the room temperature also needs to be considered. If these are set in relationship the dewpoint can be calculated. My understanding is, that if the room temperature drops below the dewpoint, the air in the room is saturated and cannot hold more water, which is where mold may become an issue.

So I would like to create one automation, that triggers, when the room temperature drops below the dewpoint of that particular room.

My sensors follow the following naming scheme:
sensor.[*room*]_temperature and sensor.[*room*]_dewpoint

As I understood the entity can be templated using wildcards, but how do I ensure, that when comparing two entities, that I am not comparing the temperature of room1, with the dewpoint of room2?

Any help in generating such template, if possible is appreciated.

I’m not aware of such a functionality myself. Where did you see that information?

There is an integration for this:

As well as a state showing the % chance of condensation it also has the following attributes:


In this thread, they create a template condition to check sensors containing “battery” in the entity ID.

Maybe the template could consist of a loop, that uses one element of a list [livingroom, bathroom, bedroom, aso.] to create the entity ID.

I wondered about the “wildcard” part.

2021.7 Release came in handy. I am using the following trigger now:

  - platform: numeric_state
    entity_id: sensor.bedroom_temperature
    below: sensor.bedroom_dewpoint
  - platform: numeric_state
    entity_id: sensor.bathroom_temperature
    below: sensor.bathroom_dewpoint
  - platform: numeric_state
    entity_id: sensor.livingroom_temperature
    below: sensor.livingroom_dewpoint