Condition in yaml file

Hi all,

First i’m sorry for my english, it’s not my mother tong :slight_smile:
I need your help because i want to create a common yaml configuration file for esphome and i want to use a condition to set a variable substitute.

Something like that
if device_type == “SONOFF 4CH Pro R3” then device_model: devices/sonoff_4ch_pro_r3.yaml

and then i want to do that
device: !include devices/${device_model}

i tried so many thing i found on forum but nothing work.

Hope you can give me a way to do it.

Thank you

Maybe you could use compound (double) substitutions?

thank you for your answer, i will have a look and tell you :slight_smile: