MQTT switch with flash icon instead of slider

Hi, I have a MQTT switch that haven’t a state topic, so I guess I must use the optimistic tag (true).
But the icon on the panel still remain with the flash symbol instead to turn in the slider symbol.
Seem that the option “optimistic” aren’t considered.

My code:

  - platform: mqtt
    name: "asciugatrice_start"
    command_topic: "ID1/CMD/PSH"
    payload_on: "CH1"
    optimistic: true
    qos: 1
    retain: false

Customize your switch with:

switch.asciugatrice_start:
  assumed_state: false

Just tried, doesn’t work! :fearful:

I’ve done some experimenting with this, and it looks like setting optimistic: true causes the front end to change.

However if you add the state_topic: to the same as the command topic and remove optimistic, the state message is received from the broker, so you can get the same effect without having your switch return the actual state. This does have the advantage of checking the message at least got to the broker. So try

switch:
  - platform: mqtt
    name: "asciugatrice_start"
    command_topic: "ID1/CMD/PSH"
    state_topic: "ID1/CMD/PSH"
    payload_on: "CH1"
    qos: 1
    retain: false

Yes, I must change the firmware on the client side, that, now, actually doesn’t support state_topic… but, as you say, this take the advantage of checking the status.
Everyway, I’ve tried all combination on assumed_state and optimistic, but nothing changed.

Remove optimistic: changes the front end.

Have you edited the customize.yaml manually and restart?
If you use the customize tool, you can only set assumed_state to true.
Removing the check mark, deletes the key from the customize.yaml.

If I understand correctly, you want to control a dimmer with the slider.
Change this from mqtt switch to mqtt light and set the brightness_xxxx

Nope…
This is for command an MQTT client that drive the radiator unit.
I know how the slider work, I’ve some of the in the config for the Philips Hue.

have you tried configuring a playload_off?

1 Like

My firmware now doesn’t support payload_off… I must change the firmware.

ok, you just activate it then, right?
despite that, I think you could try to define a payload_off in your hass config so the appearance would change.
The payload_off message can be sent even if your firmware doesn’t support it.

Ok… using payload_off, even is a fake command, the slide is back!