Custom MQTT light is reporting brightness back to HA, but evaluates to "unknown"

Following the docs for a mqtt light with no rgb support, I have the following:

  - name: "R2D2 Holoprojector"
    unique_id: "r2d2_df12b4032fe411e4800bcd1fd09bffdc"
    state_topic: "r2d2/holo/state"
    command_topic: "r2d2/holo/switch"
    payload_on: "ON"
    payload_off: "OFF"
    brightness_state_topic: "r2d2/holo/brightness"
    brightness_command_topic: "r2d2/holo/brightness/set"
    on_command_type: "brightness"
    optimistic: false

I can see in both my topics (state_topic and brightness_state_topic) that HA is receiving a valid int value of 0-255. I set up a sensor to confirm this as well. I can navigate to the STATES developer tool and play with the brightness slider, but when I add the light to a dashboard using the Light card, the brightness slider is immovable.

Am I not sending/reporting the brightness state correctly?

Figured out that I needed to report the ON/OFF state back to HA with just that an “ON” or “OFF” string value.

OMG, your post solved a problem I’ve been working on for several DAYS.

Somewhere it should be mentioned that the mqtt light needs to have its state set to ON for the brightness state to work properly.

Thank you, THANK YOU!

1 Like