[RESOLVED] Item as a gateway MQTT <=> UDP


I have to do a proof of concept for a connected socket.
I have to develop a “gateway” between a external MQTT and my socket.
Here is the idea:

  • My item receives a MQTT JSON (see the format below) from an external server.
  • It send an UDP packet containing the JSON received from MQTT to my socket.

When the user switch on/off the socket manually (there’s a button on it), this should happen:

  • The socket sends an UDP packet containing a JSON to openHAB.
  • The item receives that JSON from UDP and send it to MQTT (as a gateway).

I don’t know how to do that (deal with transformations, event bus, etc.).

Can you help me please ?



String Gateway "text [%s]" { udp="<['REGEX((.*))']", mqtt=">[broker:topic:state:default]" }

Whenever the UDP client on port 3000 sends a string, publish it to broker on topic.

Genius. This is working perfectly.

Thank you.

1 Like