Change ICON (color) based on MQTT message content

Hi, I have a newly installed HA instance and just started configuring. I’ve been able to configure some Zigbee switches, camera’s, etc, and can send and receive mqtt messages. What I’m searching for is a possibility to change an icon (or icon color) based on received mqtt message content.
So let’s say, for simplicity, the topic/payload is:

  • topic: Room_1_humidity ; payload: HIGH (or LOW)

I want to have just an icon showing an arrow UP or DOWN
I think it is simple, but I have not been able to find out how this should be achieved.
Thanks!

Create an MQTT binary sensor that is on for HIGH and off for low.

Then, for the sensor’s icon that you want to change, use a template for its icon (docs from the template sensor definition) that adjusts based on the state of this sensor.

Come back to use with the code that you have tried (correctly formatted with the </> button) if you get stuck.

@Troon, thx for replying. This probably will be a step-by-step process as for me the documentation leaves many open ends. My first step is that I’ve been able to create an entry in configuration.yaml which creates an entity which can be selected in an entity-card:

mqtt:
  binary_sensor:
    - name: TestSensor
      state_topic: My/Topic/result
      unique_id: TestSensor
      payload_on: ON
      payload_off: OFF

I can create an entity-card showing the entity

type: entities
entities:
  - binary_sensor.testsensor_2

However if I send

mosquitto_pub -t My/Topic/result -m ON

in the MQTT integration of HA the message is shown, but the state of the above entity-card does not show the new state. What am I missing?