Change MQTT switch action icons

I’ve done a fair amount of googling, and I can’t for the life of me figure out how to change the “off” and “on” switch actions to a different mdi icon. Basically wanting to change them to mdi:arrow-up and mdi:arrow-down.

I have the following configuration:

  - platform: mqtt
    name: "TV Volume"
    command_topic: "ir_server/send"
    payload_on: "4,490,12"
    payload_off: "4,C90,12"
    optimistic: true
    qos: 0
    retain: false

and in customize.yaml

switch.tv_volume:
  icon: mdi:television

How on earth do I change the icons for payload_on and payload_off ?

I’m referring to in yellow:
image

Any help is appreciated :slight_smile:

You cant. In the same way that you cant change the icon of a toggle switch. These icons are built into HA for switches that do not have state feedback.

If you provide a valid state_topic: they will change to a toggle switch.

This will also occur if you set optimistic: true for the switch - but be aware if using this method the switch in HA could get out of sync with the physical state of the device if something other than HA is used to control it (an IR remote for example). Also a toggle switch isn’t much use for a volume control.

Your other alternative is to use any of the built in or custom button cards to control the switch. e.g.:

Thanks for that @tom_l.

Yeah, as you say I can’t really use state_topic or optimistic.

Have you possibly got a good example of setting up the built in/custom button cards?

Thanks!

Sure, this uses the tiles custom card:

cards:
  - entities:
      - entity: media_player.lounge_av_rx
        group: true
        icon: 'mdi:audio-video'
        min_volume: 20
        name: Lounge Amp
        type: 'custom:mini-media-player'
      - entity: media_player.lounge_av_rx_zone_2
        group: true
        icon: 'mdi:audio-video'
        min_volume: 20
        name: Dining Zone
        type: 'custom:mini-media-player'
    show_header_toggle: false
    type: entities
  - card_settings:
      align: center
      background: var(--paper-card-background-color)
      column_width: calc(80%/4)
      columns: 4
      gap: 20px
      row_height: 75px
    entities:
      - column: 1
        entity: script.lounge_amp_dsp_up
        icon:
          value: 'mdi:surround-sound'
        label_sec:
          value: DSP
        row: 1
      - column: 2
        entity: script.lounge_amp_decode
        icon:
          value: 'mdi:dolby'
        label_sec:
          value: Decode
        row: 1
      - column: 3
        entity: script.lounge_amp_enhancer
        icon:
          value: 'mdi:tune-vertical'
        label_sec:
          value: Enhance
        row: 1
      - column: 4
        entity: script.lounge_amp_bass
        icon:
          value: 'mdi:speaker-wireless'
        label_sec:
          value: Bass
        row: 1
    global_settings:
      background:
        value: var(--paper-card-background-color)
      border:
        color:
          value: var(--primary-color)
        radius: 20px
        size: 2px
      label_sec:
        color:
          value: var(--secondary-text-color)
    type: 'custom:tiles-card'
title: Amp
type: 'custom:vertical-stack-in-card'