Change icon mqtt sensor dynamically

Hi, I want to change the icon of my MQTT sensor in base of the state it is.
It possible to make it using an automation o like similar?
Because I try to add icon_template but is work only witch template sensor

How about wrapping your MQTT sensor with a template sensor to customize the icon?

yes good idea