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.
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!
I have created the asset to represent de data from the physical device.
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!
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.
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:
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
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!
Validate certificate: off
Encryption: on
Protocol: mqtt://
Host: 192.168.1.21
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
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.