Mqtt light error

hi i have a mqtt dimmer i can publish the pay load and see it going on and off by pay load commands and with on of command but when i put it in confi

g.yaml the light doesn’t go on

my config is

light:

  • platform: mqtt
    name: “test light”
    state_topic: “/wink”
    command_topic: “/bruno”
    payload_on: “R13_ON”
    payload_off: “R13_OFF”
    brightness_command_topic: “Dimmer:”

please help i have been trying to get it to work since very long

attached are the screen shot:

Thanks in Advance

format your code by highlighting it and using this button:

highlight:
  your:
    code:
      press:
        - format: button

image

1 Like

my config is

light:

platform: mqtt
name: “test light”
state_topic: “/wink”
command_topic: “/bruno”
payload_on: “R13_ON”
payload_off: “R13_OFF”
brightness_command_topic: “Dimmer:”

sorry new to this hopes this makes things clear

I am afraid you were mislead on the way to post your code snippet. The correct method is described in the link in the blue box at the top of the page. As you can see, the indentation is not correct the way you have posted, which important when trying to find problems in yaml. However, I’m not sure that is the problem here.

As far as your actual problem is concerned, can you paste the commands that work - it is not clear what you mean by

While I do appreciate your candor, if @Gagan_Kochar edited his original post and followed my procedure it would have worked. I didn’t expect him to copy and paste from his original post to a new new post.

well i am new to this but i would steel keep an effort to do things right i was at work then didn’t had file backup on me so for the sake of fast resolution did it ,

light:
  - platform: mqtt
    name: "test light"
    state_topic: "/wink"
    command_topic: "/bruno"
    payload_on: “R13_ON”
    payload_off: “R13_OFF”
    brightness_command_topic: "Dimmer:"

but what do you think might be wrong now i can have that working with

core-ssh:~# mosquitto_pub -h 192.168.0.25 -t bruno -m "Dimmer:50"

see got formatting right again, but ya Dimmer 50 60 18 20 what ever it works also from mqtt push in dev panels as i attached screenshots

Thanks

That doesn’t look right. You are using the same topic to send the brightness commands but the command is not a simple integer?

if this is correct:

core-ssh:~# mosquitto_pub -h 192.168.0.25 -t bruno -m “Dimmer:50”

then your command topic for brightness_command_topic would be “/bruno”.

Not sure how to always add “Dimmer:” to the message.

EDIT: possibly

light:
  - platform: mqtt
    name: "test light"
    state_topic: "/wink"
    command_topic: "/bruno"
    payload_on: "R13_ON"
    payload_off: "R13_OFF"
    brightness_value_template: "Dimmer:{{ value }}"

hi

this is also not working light is getting on and off but still no luck with dimmer tried code provide by you also changed a bit tried

light:
  - platform: mqtt
    name: "test light"
    command_topic: "sub"
    payload_on: "R13_ON"
    payload_off: "R13_OFF"
    brightness_command_topic: "Dimmer:{{ value }}"
    brightness_scale: 90

&

light:
  - platform: mqtt
    name: "test light"
    command_topic: "sub"
    payload_on: "R13_ON"
    payload_off: "R13_OFF"
    brightness_command_topic: "Dimmer:"
    brightness_scale: 90

nothing seems to get dimmer to work, please help Thanks

Dude, did you try what I wrote? You continued to use the wrong config section.

That is the wrong attribute.

That should be the correct attribute.

sorry, yes i did try this same it doesn’t even show up the brightness slider i don’t know why

  light:
      - platform: mqtt
        name: "test light"
        command_topic: "sub"
        payload_on: "R13_ON"
        payload_off: "R13_OFF"
        brightness_value_topic: "Dimmer: {{ value }}"
        brightness_scale: 90

still stuck

something i noticed from HA mqtt tab, publish a packet utility , when i use “” with payload it doesn’t work like
"Dimmer:80" wont work but
Dimmer:80 without the " " will work

Thanks in advance

I think you’re going to have to rework your device. It doesn’t look like an mqtt brightness attribute supports text on top of a value.

You’ll need 2 topics for your light. One for on/off, one for brightness.

any idea how this can be done , because i have no clue.

I don’t know how your device works. Only you do. You created the first mqtt topic, now you need to create another one that is for brightness.

do you have any idea with open hab as some of the people have got it working with open hab MQTT

top three comments in here

Thanks again

This will only be possible with 1 command. It’s not going to work the way you want it to work with multiple commands because the mqtt light component does not have this functionality. You have to hard code the command. And even then, I’m not sure it will work.

Why is this needed? Why can’t you use 2 mqtt topics?

hi,

i am little confused what do you mean by Two mqtt topics ? in yaml or do i have to do it in arduino

thanks

You’d have to do it in both, one for the state, one for the brightness.