MQTT Agents Publish subscription

Hi All

Thanks to @rich i could solve the problem to connect Openremote to external MQTT broker and receiving data an this to an Attributs.

Now my problem is how to select info if the mesaage is a json file

Mqtt msg

i like to create an Attribute and show only ID message

This is what i am doing

What i am doing wrong?

Thank you in advance


If I understand your question fully, you’re MQTT broker publishes messages in JSON format and you would like to extract values from that?

If this is correct then you can use the Value filters parameter of the Agent link to add a JSON path value filter that accepts a JSON path expression (see

Hi rich

Thank you for your answer. Yes your advise what help full.

But to received this message i need an action. If you see how i run this action on MQTT-explore

Publish topic: shellies/shellyem-XXXXXX/command
Payload: announce

How i can do this with Openremote.

Thank in advance

OK to publish you need to set the Publish topic parameter on your Agent link; you can then add the Write value parameter to you Agent link to specify a payload that should be sent on publish, this payload can have within it the special placeholder {$value} which will be replaced by the value that you actually write to the attribute.

Imagine you have a number attribute representing the brightness of a light (0-100) and you need to publish a JSON message like:

  "brightness": 0-100

Well if you use the {$value} placeholder then you can dynamically inject the 0-100 value as it is written to the attribute:

  "brightness": {$value}

If you want to publish a static message then don’t include the {$value} and whatever is in the Write value parameter should get published no matter what is sent to the attribute.

If this doesn’t cover your scenario then please provide more details.

NOTE: There was a bug in the Agent link UI which rendered the Write value parameter as single line input only this has been fixed in latest commit which will appear in the manager docker image shortly

Hi rich

my device send mqtt message automatically like this:

  1. Subscription
    shellies/shellyem-XXXXXX/emeter/0/returned_energy (value energy returned to the grid in Watt-minute)

once i subscribe to this topics i can read the value.

But some data on the device i need a publish action to received data like this:
2. Publish
topics: shellies/shellyem-XXXXXX/relay/0/command (accepts on, off or toggle)
Payload: On or OFF or togggle.

Now my question is how to create on Openremote a publish topics with payload.

If I use shellies/shellyem-XXXXXX/command Payload: announce

The result of this publish topics is:

“id”: “shellyem-B040F8”,
“model”: “SHEM”,
“mac”: “84CCA8B040F8”,
“ip”: “”,
“new_fw”: false,
“fw_ver”: “20211109-131205/v1.11.7-g682a0db”

After i can use Value Filter if i like only “ip” data.

Thank you in advance


I think I understand a little more clearly; you want to subscribe to a topic but data is only published to that topic by first publishing.

Is this a one time request and static data is returned or do you need to keep sending the request periodically?

The MQTT Agent doesn’t currently support this; we have similar funcionality to this in the Websocket Agent I will need to look at providing something similar for MQTT Agent but until then you could use a rule to try and achieve it in combination with the Write value parameter and Rule state configuration item on the MQTT Agent agentStatus attribute:

This rule should try writing to the attribute in the Then action whenever the MQTT agent becomes connected.

NOTE: You will need a manager image newer than this post to be able to create a When-Then rule for an agent