Simple MQTT Light (Dimmer) with only brightness support

Hi,

I use some MQTT Ligths (Dimmers) with no state topic but only a brigthness topic. What is the best way to configure these lights to show only a slider or to automatically show the state ON if the brigthness is greater than 0 %?

My actual config:

  • platform: mqtt
    name: “Küche LED”
    state_topic: “stat/zwave/0/NODE22/SWITCH_MULTILEVEL/Level_2”
    command_topic: “cmd/zwave/0/NODE22/SWITCH_MULTILEVEL/Level_2”
    payload_on: 99
    payload_off: 0
    brightness_state_topic: “stat/zwave/0/NODE22/SWITCH_MULTILEVEL/Level_2”
    brightness_command_topic: “cmd/zwave/0/NODE22/SWITCH_MULTILEVEL/Level_2”
    brightness_scale: 99
    on_command_type: brightness
    retain: false

Best regards
Tan

Hi Tan,

I was looking for a similar answer while I came across your (unanswered) post. Meanwhile I figured it out:

This works for me, the light only gives brightness states (0-100), no on/off. I use the same topic for brightness and on/off state just as you. What you’re missing is a state_value_template, returning just 2 outcomes from the brightness value. 0 representing OFF, and any other numeric value representing ON.

  - platform:                      mqtt
    name:                          entry_niko_wall
    state_topic:                   "openHAB/out/nikohomecontrol_dimmer_440e003a291e_47_brightness/state"
    command_topic:                 "openHAB/in/nikohomecontrol_dimmer_440e003a291e_47_brightness/command"
    on_command_type:               brightness
    state_value_template:          >
      {% if value|int > 0 %}1{% else %}0{% endif %}
    payload_on:                    "1"
    payload_off:                   "0"
    brightness_state_topic:        "openHAB/out/nikohomecontrol_dimmer_440e003a291e_47_brightness/state"
    brightness_command_topic:      "openHAB/in/nikohomecontrol_dimmer_440e003a291e_47_brightness/command"
    brightness_scale:              100
    qos:                           1
    retain:                        true
    optimistic:                    false
1 Like