MQTT - Light Card - How to control brightness in UI?

Hi Everyone,

I’m new here. I’ve been using openHAB for over 5 years but have decided to test HA and possibly fully migrate due to the slow pace of the bindings/integration development of OH.

I’ve successfully installed HA and installed all the simple integrations (Ring, Hue, iRobot, Sonos, Nanoleaf, XBox, Shelly). All my OH lights etc are zigbee & zwave and are available via a local Mosquitto MQTT broker. I have at least 50 devices.

I have setup the MQTT integration and am able to edit the configuration.yaml using Visual Studio Code. I’ve been using YAML for 3 days so I’ve still got a lot to learn!

I have managed to turn a light bulb on and off in the UI using the following code but I’m struggling to adjust the brightness. I’ve read many posts and the official documentation but I’m a little stuck.

I’ve read these amongst many other articles and videos:

Please can someone help me or point me in the right direction so I can get started?

Here is my UI:

show_name: true
show_icon: true
type: button
entity: light.test_light
name: Test OH MQTT Light
icon: mdi:lightbulb
show_state: true

Here is my config for standard on/off:

mqtt:
  light:
    - unique_id: Test_Light
      name: "Test Light"
      command_topic: 'mqtt/moes_bulbgu10_01/set/state'
      state_topic: 'mqtt/moes_bulbgu10_01/state'

Here are my topics:

'mqtt/moes_bulbgu10_01/color_mode', payload 'color_temp'
'mqtt/moes_bulbgu10_01/color-x', payload '0.3804'
'mqtt/moes_bulbgu10_01/color-y', payload '0.3767'
'mqtt/moes_bulbgu10_01/color-hue', payload '40'
'mqtt/moes_bulbgu10_01/color-saturation', payload '49'
'mqtt/moes_bulbgu10_01/brightness', payload '175'
'mqtt/moes_bulbgu10_01/state', payload 'ON'
'mqtt/moes_bulbgu10_01/linkquality', payload '135'
'mqtt/moes_bulbgu10_01/color_temp', payload '250'

This is where I’ve got to so far, it’s actually a colour bulb (x/y) but for now I would be happy if I can at least dim it. Many thanks.

I’ve just had another go and of course the answer was simple! I think I was over complicating things in my head so overlooked the solution. I now understand that I add all topics to the light and they appear in the UI automatically. A bit of a learning curve to switch from OH so excuse my ignorance :wink:

brightness_command_topic: 'mqtt/moes_bulbgu10_01/set/brightness'

Curtis – Shouldn’t you have MQTT automatically advertising entities so they just show up as regular lights in HA? Then just adding them will give you a UI where you can adjust that. I don’t think you should have to manually configure something standard like a light that is coming from MQTT. (I may be misunderstanding your issue, though!)
-David

I suspect you are correct. As I’ve only been using HA for a couple of days I have almost no idea what I’m doing or what is possible. You will understand my issue way more than me :grinning:

I wish it would happen automatically as I have about 100 items to move over from openHAB via MQTT…

There is a zigbee 2 MQTT add-on that does this, I believe. Might be worth reading up on. I use the built-in ZHA and Z-wave addons. The MQTT devices I have go through other add ons and got automatically populated as a result.

Many thanks for the advice, I’ll give that a go! Much appreciated :beers: