I migrated to Home Assistant last month and I’m trying to set up my rbdimmer module via MQTT. The dimmer entity shows up in HA and I can toggle it on and off — the lamp turns on at full brightness and turns off correctly.
But the brightness slider has no effect. I drag it to 50% and the lamp stays at full brightness. If I drag it to 0% the lamp stays on. Only the toggle switch works.
In my old Domoticz setup I used to send a value 0-100 directly to the MQTT topic and the dimmer responded immediately. With Home Assistant something is different in how the brightness command is sent.
Here’s my current HA configuration.yaml:
mqtt:
light:
- platform: mqtt
name: 'Living Room Dimmer'
command_topic: 'dimmer/set'
brightness_command_topic: 'dimmer/brightness/set'
payload_on: 'ON'
payload_off: 'OFF'
On the ESP8266 side I’m running PubSubClient with a callback that reads the payload and calls dimmer.setPower(value) where value is 0-100. The on/off toggle sends ‘ON’ and ‘OFF’ strings which I handle separately.
I checked the MQTT broker with MQTT Explorer — when I move the slider, HA sends a value like 128 to dimmer/brightness/set. But the ESP callback for that topic never seems to fire. What am I missing?
I think I see two issues in your YAML:
1. Missing on_command_type: 'brightness'
Without this setting, when you move the slider HA sends the brightness value to brightness_command_topic but still sends ‘ON’ to command_topic separately. Your ESP firmware probably only listens to command_topic and ignores brightness_command_topic entirely.
Adding on_command_type: 'brightness' makes HA send the brightness value as the main payload on the command topic when turning on.
2. Missing brightness_scale: 100
By default HA sends brightness as 0-255 (that’s why you see 128 for 50%). Your dimmer expects 0-100. Setting brightness_scale: 100 tells HA to map its internal 0-255 range to 0-100 before publishing.
Here’s the corrected YAML:
mqtt:
light:
- platform: mqtt
name: 'Living Room Dimmer'
command_topic: 'dimmer/set'
brightness_command_topic: 'dimmer/brightness/set'
brightness_scale: 100
on_command_type: 'brightness'
payload_on: '100'
payload_off: '0'
With this config, moving the slider to 50% sends 50 directly to dimmer/set — which is exactly what your ESP callback expects.
Also notice I changed payload_on to '100' and payload_off to '0' — this way on/off sends numeric values instead of strings, which your atoi() callback can handle without special string parsing.
That was it — adding on_command_type: 'brightness' and brightness_scale: 100 fixed the slider completely.
The brightness now maps correctly: slider at 50% sends 50 to the ESP and the lamp dims to 50%. Toggle on sends 100 and toggle off sends 0. No more string parsing needed on the ESP side either since everything is numeric now.
In Domoticz this was handled automatically because the MQTT plugin sent the raw dimmer value directly. In Home Assistant you have to explicitly configure the brightness scale and command type — a bit more verbose but makes sense once you understand the MQTT light platform.
I also added the state_topic and brightness_state_topic from the rbdimmer example so the slider position survives ESP reboots. Works perfectly.
Thank you Hank and rbdimmer team for the quick help.
[SOLVED]