Send data from device over MQTT

I am unable to figure out how to send data from a device to openremote via MQTT.

Did you check out the wiki User Guide: Manager APIs · openremote/openremote Wiki · GitHub ?

Yes I have checked this.
What I already did is

  1. Added a new asset (MQTT agent)
  2. Connected MQTT Explorer to openremote on localhost 8883

and now when I try to publish data on a topic I get this error on console “client is not authorized to publish on topic: SMD”


The article Pierre provided a link to states the topic format you must use to connect to the OpenRemote MQTT broker, you can’t make up your own topic SMD and expect it to work.

You don’t need an MQTT Agent to connect to our broker, you just need to create a service user in the Manager UI (and give them read/write access to the system).

The MQTT Agent is for connecting OpenRemote to another MQTT broker.

1 Like

@Rich in our pc we have to install an mqtt broker or we have to activate the mqtt server. to establish communication between openremote and client

There are two general situations:

  1. SEND DATA TO OPENREMOTE MQTT BROKER - You need to create a service user within the OpenRemote Manager UI and then use an MQTT client to connect to the OpenRemote broker using your service user credentials. Then you can publish/subscribe to the topics described in the wiki article linked above in Pierre’s post

  2. CONNECT OPENREMOTE TO ANOTHER MQTT BROKER - You need to create an MQTT Agent and then you can link asset attributes to this agent and set the publishTopic and/or subscribeTopic

1 Like

successfully connected my mqtt client by using the link.

1 Like

Hi all,

I am trying to configure a connection of my zigbee2mqtt implementation with openremote. The connection is established, but I can’t get the messages of a specific device to arrive in openremote.

I don’t see how to add the correct “asset attributes to this agent” that consist of values of a subtopic.

Attached is the excerpt from the messages for a device with the subtopic "Ceiling Office

Received MQTT message on 'zigbee2mqtt/Decke Buero/set' with data '{"state":"ON"}'
Publishing 'set' 'state' to 'Decke Buero'
MQTT publish: topic 'zigbee2mqtt/Decke Buero', payload '{"brightness":238,"color_mode":"color_temp","color_temp":353,"linkquality":145,"state":"ON","update":{"state":"idle"}}'

thanks in advance for your help

Hey Udo.

First of all (i think you already got this but i start from the beginning) you need the MQTT Agent Asset

Fill the clientId, host, and port with the correct values and you’ll have the agentStatus as connected.

Then you create a Thing Asset

I explain to you how to read the value without JSON format for your understanding.

  1. In the Thing Asset create a Attribute “Custom Attribute” (choose name, value type)
  2. Click on the Attribute and click on “ADD CONFIGURATION ITEMS”
  3. Add an Agent link and click on it. Then choose the MQTT AgentAsset
  4. Click on the Agent link and click “ADD PARAMETER”
  5. Choose subscription Topic and Update on Write.

When you followed the steps it should look like this.

If you send values without JSON format your values get updated in the Assets and can be visualised in the Insights section.

For the JSON format you need to add Value Filters as parameters. In the filter add “JSON Path” and fill the path to what value you are referencing. It should look like this

Take the link for an JSON path example


Hi Tim,

thank you very much for your detailed description and the Jason path example. there had been difficulties at the end. But with $[‘xxxx’] instead of $.XXX I think I can read in values.

However, it only reads single values and does not save them and the Y-axis is in the value between 0 and 1.

Is there a way to check and store the read values?

btw i changed the MQTT Broker to weather/loop

{"windSpeed10_kph": "12.874752", "monthET": "0.0", "outHumidity": "41.0", "pressure_mbar": "1007.23643203", "rain_cm": "0.0", "dayET": "0.0", "barometer_mbar": "1014.22325357", "yearRain_cm": "37.973", "consBatteryVoltage_volt": "4.72", "dewpoint_C": "11.6652974601", "insideAlarm": "0.0", "inHumidity": "35.0", "dateTime": "1657804405.0", "sunrise": "1657769640.0", "windGust_kph": "17.702784", "heatindex_C": "25.665", "dayRain_cm": "0.0", "outsideAlarm1": "0.0", "inDewpoint_C": "10.0226007842", "outsideAlarm2": "0.0", "windSpeed_kph": "17.702784", "forecastRule": "45.0", "rainAlarm": "0.0", "altimeter_mbar": "1014.52712048", "windchill_C": "25.9444444444", "outTemp_C": "25.9444444444", "windGustDir": "313.0", "extraAlarm1": "0.0", "extraAlarm2": "0.0", "extraAlarm3": "0.0", "extraAlarm4": "0.0", "extraAlarm5": "0.0", "extraAlarm6": "0.0", "extraAlarm7": "0.0", "extraAlarm8": "0.0", "soilTemp2_C": "22.2222222222", "rain24_cm": "0.0", "forecastIcon": "6.0", "soilMoist2_centibar": "99.0", "hourRain_cm": "0.0", "inTemp_C": "26.7777777778", "soilLeafAlarm4": "0.0", "soilLeafAlarm2": "0.0", "soilLeafAlarm3": "0.0", "usUnits": "16.0", "soilLeafAlarm1": "0.0", "leafWet4": "0.0", "txBatteryStatus": "0.0", "yearET": "0.0", "monthRain_cm": "0.2286", "rainRate_cm_per_hour": "0.0", "extraTemp1_C": "24.4444444444", "windDir": "342.0", "stormRain_cm": "0.0", "sunset": "1657827720.0"}


I’m not sure if you can write the JSON path like this. I’m also not sure if you thought it has to be upper letters as you wort $.XXX and the other time in lower case ‘xxx’. My Jason payload looks like this (different example but same preparation)

If i go into the view mode i can see the value in Attributes and History

I think one issue is your path (I think you should still try the path like i did, as you didn’t list any items so it’s like mine). And maybe the other issue is your Attribute Type “number”. I’m not sure what kind of type number is as you also got “integer” but maybe that’s the right types for decimals… I would suggest to try to get values without JSON to see if the problem is about the path or not.