How to change switch Icons/ state icon

Hi, I need to import sensor data from a remote sensor via mqtt and toggle a relay. The Setup already works, only thing is, I can not change how the switch looks, I want to look it like autodiscovered switches with the slider, but instead it has 2 icons to click on, see in screenshot.

I already tried a lot in the (so named) mqtt.yaml. the current setup is:

- switch:
  - name: "Testschalter2"
    unique_id: "schalter002"
    state_topic: "test/switch1/set"
    command_topic: "test/switch1/set"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    optimistic: true

I found a lot articles where an option “assumed_state: false” would do that but
this option is not valid for an mqtt switch

Hello SaschaN71,

Does this help you at all?
I have a template sensor that watched my most complicated one.

1 Like

Yes! Thanks for pointing me into the right direction. The problem was if the state_topic could not be read, the switch works but shows those 2 icons only.