MQTT Connection

Hi everyone!

I feel kind of dumb that I can´t figure this out but I´m really strugling with the MQTT Api, so please be patient with me!

I´m trying to connect an ESP8266 to the platform (wich by the way, is amazinggg!!!) and retrieve data from a temperature sensor. As far as I understood, the host of the OR broker is where the platform is located (local or in a server), and depending on the type of connection I will use different ports, etc.
Where I´m having trouble is where in the asset to indicate tu subscribe or publish to different topics. I guess is in the Value Type field, but I can´t find any related to MQTT, perhaps its under another name.

If someone can bring some light for me in this problem I would really appreciate it! OpenRemote looks really promising and I´m lookinf forward into working with my clients with it.

Thanks for your time!


There are a few topics on this but we are also struggling with the same thing. Hopefully someone that has been successful could do a short youtube video on how to connect to MQTT values so they can be used with OR. it would be really helpful for assistance of the video could show how to do this from the start to end! i think if everyone understands how to integrate the MQTT side of things this platform would see a sharp uptake in users


Thank you Nair for your kind reply, I´ve read every post I believe hahah Yes, OR is really amazing, and IoT needs MQTT for wider integration. Hope that tutorial comes soon!

Hi and welcome to the forum.

Always good to hear use cases of users like yourself.

Generally you would use our MQTT broker to publish sensor data into our system.

Basic steps assuming you have a hosted system up and running:

  1. Create service user
  2. Create Asset to represent your physical device with attributes of correct value type
  3. Connect to your instance from your device using an MQTT client library this is described in the wiki here

With more specific issue details we can help and will try to find time to put together a youtube video relating to this.

1 Like

Hi Rich,

Thanks for your support, and taking the time.

  1. I have a service user.
  2. I have created the asset to represent de data from the physical device.
  3. I have not connected yet from the device.

I need to understand where in the asset properties to indicate to what topic publish or subscribe. Perhaps I´m getting the whole thing wrong. This is what is really strugling with me. I´ve read in the forum that for example Agent Links are used in the Configuration Item for HTTP api calls. So my question is: what Configuration Item do I need to make the Pub/Sub specification in the asset?

Thank you for putting up with me, I promise that if I make this right I´ll make the video tutorial!



I think many people would thank you for a step by step video!

1 Like

Provided your service user has Write role then you will be able to authenticate from an MQTT client and connect to the OpenRemote MQTT broker.

Your device is a client in this scenario so you will need to use an MQTT client library on your device and publish an AttributeEvent to the appropriate topic for your asset and attribute; the topic convention is described in the wiki page I previously linked to.

You can use a desktop MQTT client to test out the workflow and you should find that you can update attributes by publishing AttributeEvent JSON messages to the appropriate topic.

You don’t need to do any configuration on the attributes themselves.

You need to make sure the value you publish in your MQTT message is compatible with the chosen value type of the attribute(s) and then it should work fine.

If you need more info about how to structure an AttributeEvent then feel free to ask.

Rich, thanks again for your reply, this looks much clearer. I will give it a try and come back with the results.




I have a problem when I publish a message in MQTT Broker. I create the realm, the user and the service user. Then, I create the asset with public write permision in temperature attribute. The MQTT Explorer can connected and read asset info but when I publish in temperature attribute with attributeValue message (“attributevalue/46lTKGx8ECw6AkVcQNJYGw/temperature”) have this error:


2021-06-25 13:20:36.856 INFO [pool-9-thread-1 ] org.keycloak.adapters.KeycloakDeployment : Loaded URLs from http://keycloak:8080/auth/realms/almazora/.well-known/openid-configuration

2021-06-25 13:20:36.925 WARNING [Messaging-AssetQueue-11 ] ote.manager.asset.AssetProcessingService : Error processing from CLIENT - INSUFFICIENT_ACCESS: AttributeEvent{timestamp=Fri Jun 25 13:20:36 CEST 2021, attributeState=AttributeState{ref=AttributeRef{id='46lTKGx8ECw6AkVcQNJYGw', name='temperature'}, value=25, deleted=false}}

Is it necessary to create a role or change any more permissions?

Kind Regards

The service user you create should have the write and read role selected and this should be sufficient.

This is not necessary with service user as you have valid credentials; I would avoid using the public write configuration option as it was only suggested as a stop gap measure until service users were implemented.

Also make sure that the attribute you are trying to write is not marked as READ_ONLY

Hi rich,

Thanks for answering

The attribute is not marked as READ_ONLY, but I have created a new attribute and the system has started working and now I can write into all attributes. I have not changed anything else. Now, it works but I don’t understand why.

Hi @napster I was wondering if you can help be with this. I though I was connecting to the OpenRemote broker but I was actually conecting to an existing Mosquitto broker in the backend of my PC. I have stopped that service, but I can´t connect to OR broker. In the MQTT Explorer which host are you using? i´m running it locally but using “localhost” does not work. If a screenshot is easier for you I would appreciate it!



Hi @tomasbarthalot

In MQTT Explorer I use this configuration:

Validate certificate: off
Encryption: on
Protocol: mqtt://
Port: 8883
Username: master:prueba_mqtt
Pass: {secret key of user service}

But I start openremote with KEYCLOAK_FRONTEND_URL varible with my ip host not with localhost

cmd /C "set KEYCLOAK_FRONTEND_URL= && docker-compose -p openremote up"


Thanks Nacho!! I was able to connect with your indications. I have to admit it took me a couple of hours so later, perhaps tomorrow I will try publishing/subscribing. At least connecting to the broker was a huge step for me.
Will keep you updated in the next steps.



1 Like

Hi everyone!

I just posted a video on youtube about how to connect to the MQTT broker. You can watch in the following link

Once again thanks to @napster and @Don
Feel free to ask of comment.





Sorry for the delayed response.

Thanks for taking the time to put the video together, I’m sure the community will find it very useful.



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