How to eval an id?

Hi, I need some help. Can’t get my head around the following:

I’ve got a couple of images (a.png, b.png, c.png, etc) which all are loaded with an id of a, b, c, etc.
Next I have a text_sensor which value will be a or b or c, etc.
Then I want to display the correct image with it.image. So when the value of the text_sensor == ‘b’ then image b.png should be displayed.

In javascript I would use the eval() function (I think ;), but how to accomplish this in yaml / lambda?

Any help is appreciated!

if (id(text_sensor).state == "a") {
  it.image(...); // print image a
} else if (id(text_sensor).state == "b") {
  // ...
} else {
  // ...
} 

Thanks @OttoWinter, I had hopes there would be a more efficient method to do this. But this answer comming from you, I guess I’ve to settle for the if’s :slightly_smiling_face:

Anyway, thank you very much for such a great integration. You made the use of esp’s in HA really easy.