How function mqtt in Node-Red?

Hi all,

i need your help again :slight_smile:

I use different Gateways e.g Sonoff Rf433-to-mqtt or zigbee2mqtt stick. This function very well.

But I don't know , how function mqtt...

How can i get a list off my mqtt devices and how can i get the mqtt "paths" with attribut to Controll the devices ?

Sample:
I would like turn on my mqtt devices (blub) over mqtt (mosquito on raspi) with a node "mqtt out" node?

I understand the logic, but i have not idea this real to use..

Thank for Help in advance.

It sounds like youu neet to learn about how MQTT works. The best tutorial I've read is the Hivemq.com blog posts "Mqtt Essentials"

You should spend time to read thru and digest them. I think it will be well worth your time - it was for me!

2 Likes

thanks for the great tips.

I have read everything. I can post messages and see that in my node-red mqtt-in node. I see all of my RF433 devices (sonoff gateway) but not my zigbee2mqqt gateway. the program mqqt.fx offers me two subscribers (config & state) fir zigbee2mqtt, but it is not monitoring when I activate/sends date to devices with zigbee. someone happens to know why

Try using a separate tool like MQTT explorer to monitor the broker & verify the messages are actually hitting your broker.

1 Like

thanks for the tip! I have installed the mqqt Explorer. the same thing happens with mqtt.fx. I can see the topics on "tamotarf433", but the zigbee2mqqt cannot. it says offline.

grafik

grafik

if I send a zigbee command, it doesn't change.. its stay 2 messages. the command execute well. sample: i send via zigbee remote a command to zigbee light (bulb). Bulb turn on.

I think you are better of asking in the zigbee2mqtt forum:

as this seems to be an issue between zigbee2mqtt and your zigbee mesh or cc2531 stick. Not a mqtt or nodered related issue.

1 Like

You have already paired your zigbee devices? Please post the configuration.yaml from /opt/zigbee2mqtt/data

1 Like

Hi Stefan!

here:

# Home Assistant integration (MQTT discovery)
homeassistant: false

# allow new devices to join
permit_join: true

# MQTT settings
mqtt:
  # MQTT base topic for zigbee2mqtt MQTT messages
  base_topic: zigbee2mqtt
  # MQTT server URL
  server: 'mqtt://localhost'
  # MQTT server authentication, uncomment if required:
  # user: my_user
  # password: my_password

# Serial settings
serial:
  # Location of CC2531 USB sniffer
  port: /dev/ttyACM0

You do not have any paired device! You should have something like this in the configuration.yaml:

devices:
  '0x00158d0004219311':
    friendly_name: AqaraTemperatursensor1
  '0x000b57fffe2fb3e4':
    friendly_name: IkeaSmallDimmer1
  '0xccccccfffed18fa0':
    friendly_name: IkeaSwitch1
  '0x00158d0004a06af5':
    friendly_name: AqaraDoor1

If you do not modify the friendly name manually, the friendly name is the same as the 0x number.

You have permit_join: true, which is correct for allowing new devices. Later you could set this to false to prevent unauthorised pairings. But first of all, pair your Zigbee devices. Just bring them close to the Zigbee stick and press a pair button or switch on/off the bulb several times. Ikea bulbs need to switched of and on 4-5 times, then they will be paired.

After being paired, you can use a MQTT in node with zigbee2mqtt/0x12345678 and check via debug node, which settings you get.
And use MQTT out node with zigbee2mqtt/0x12345678/set to change settings.

Hi Stefan,

thank you very much for the information!

I have jointed a lot of devices.

grafik

I used these nodes for this:

maybe that's the "problem"?

The Debug Information from NodeRed

grafik

Sorry for the delay.
I do not have the zigbee node installed because of problems together with my enocean node, but I can see the zigbee2mqtt/bridge/config via MQTT:

{"version":"1.14.0","commit":"9009de2","coordinator":{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}},"log_level":"info","permit_join":true}

**qos**  : 0,  **retain**  : true,  **cmd**  : publish,  **dup**  : false,  **topic**  : zigbee2mqtt/bridge/config, **messageId**  : ,  **length**  : 235,  **Raw payload**  :  ...

So no requirement to use the zigbee node, tough it is easier to maintain the devices and does not harm your config.
Your example of the debug node is not clear to me. Which devices is that?
I seems like you could change On or Off with sending a 0 or 1 to msg.payload.onOff to that device.

Hello Stefan,

thank you for help.

i wrote with the developers from the zigbee nodes. he said that communication is node-red internal and not via mqtt. therefore no entries appear in mqtt exlorer.

have a nice day...

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.