Beginner Node Red - simple light on/off via MQTT not working

Sorry to bother with a question that is probably to simple for the most of you :smirk:
I have a new instance of HA, and want to get into Node Red,… just by starting with a little test to turn on and off a light using MQTT sent.
This is what I have in Node Red

The Inject node


The mqtt out

[{"id":"fd828aa0.dcb668","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"71e5a6b4.8e77b8","type":"mqtt out","z":"fd828aa0.dcb668","name":"Lamp","topic":"StaandeLamp/POWER","qos":"2","retain":"","broker":"987c4047.b2d81","x":350,"y":180,"wires":[]},{"id":"8bcd7476.4c1b48","type":"inject","z":"fd828aa0.dcb668","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":170,"y":160,"wires":[["71e5a6b4.8e77b8"]]},{"id":"58c47635.25a5c8","type":"inject","z":"fd828aa0.dcb668","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":170,"y":160,"wires":[["f0ff3906.845db8"]]},{"id":"7c82db44.d13874","type":"inject","z":"fd828aa0.dcb668","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":170,"y":200,"wires":[["71e5a6b4.8e77b8","4923d252.ed8c3c"]]},{"id":"f0ff3906.845db8","type":"debug","z":"fd828aa0.dcb668","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":120,"wires":[]},{"id":"4923d252.ed8c3c","type":"debug","z":"fd828aa0.dcb668","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":240,"wires":[]},{"id":"987c4047.b2d81","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

I assume the topic to use is StaandeLamp/POWER as this is working in de Tasmota console of the light.

When I look at the debug screen I see that the payload ON and OFF are send.
What i’m I missing…?

Try not to use “localhost” but the ip adress of your ha server (be sure to forward the 1883 port there if not already done for the mqtt container). Localhost refers in this case to the ip address of the nodered container and that is not doing any mqtt.

HI, I already tried my IP 192.168.2.*** but that was also not working.
And these are the settings on HA

Another guess:

Try anonymous true in mqtt

If you want to be absolute sure that mqtt is propagated correctly download mqtt explorer to see what happens.

2 Likes

I tested the the line “Configure” option under the “MQTT” integration.
But there it is also not working with ‘stat/StaandeLamp/POWER’ of ‘StaandeLamp/POWER’

Does this mean that my mosquito is not configured correct>?

Have you used mqtt explorer? Thats the only way to easily tell if something happens on mqtt.

A lot happens in mqtt explorer, :wink:
When I give google a voice command , the result is this, and the lamp turns on.

But I can’t recreate it manually
I tried to publish ON with mqtt explorer but nothing happens.

Check your topic, it starts with stat.

Is your device controllable with mqtt or is this only that status in mqtt? What device is it? How is it configured to use mqtt?

Are you sure that you should use stat\StaandeLamp\Power, can it be that stat means status, not command?

My thougt is, can cmnd mean “command”.
What happens if you send cmnd

I should be cmnd, not shure what change but its working now.
Thanks for the support!

Including your solution :shushing_face: