How to send data from Raspberry pi to openremote using HTTP/MQTT.
for publish ------>realm_name/mqttclientid/writeattributevalue/attribute/deviceid
for subscribe ------>realm_name/mqttclientid/attributevalue/attribute/deviceid
MQTTBox is more easier to configure
What have to be given at device ID.
what has to be given in the place of Client ID, Host, Port, Websocket Path, Websocket Query when iam creating an MQTT Agent.
You don’t have to use an MQTT Agent when you are using an MQTT client on your device. You can use the OpenRemote MQTT Broker to communicate. See the info here: User Guide: Manager APIs · openremote/openremote Wiki · GitHub
No need to use mqtt agent , use an asset and modify it or you can use “add attributre” option for customise attribute name and type after that give permision as per your requirement.
Is there any need of using MQTT Box.
You can use anything you want to send the MQTT messages. OpenRemote act as the MQTT broker, you just need to use the schema that @apurba posted earlier with any software that can publish/subscribe to an MQTT broker. If secured, you also need a service user + secret (created on openremote with the appropriate permissions. In the MQTT client, the user must be written as realm:username). Remember to use a different mqttclientid for every client.
Also, you can find the deviceid on the url of your asset (it’s the last part of the url)
How to create subscription for the subscribe attribute in MQTT Client.
Depending on what software do you use for the subscription, the data to insert are the following:
-the topic: realm_name/mqttclientid/attributevalue/attributename/assetID
Where realm_name is the name of the realm, mqttclientid is an ID you set (unique per device that subscribe to the topic), attributename is the name of the attribute you set in openremote, assetID is the last part of the URL when you are on the asset page.
-the user, created on openremote as a service user with read permissions, and set in your MQTT software as yourrealm:yourusername and the secret created on openremote
For example, if you check the OpenRemote Demo and you want to subscribe to read the attribute “Direction” of the asset “Hotel New York”
your topic will be:
where client001 is an arbitrary string i decided to use as MQTTclientID
Thank you for your valuable information. But I am facing problem, I have created an MQTT box to send data to openremote server. The data from MQTT Box is not getting connected to openremote server.
Please send a screenshot about how you configured MQTTBox and the asset on openremote
I’m not understaing clearly what you are trying to do but few considerations:
-on MQTTBox are you connecting to test.mosquitto.org? You need to connect to the ip of your openremote instance
-on OpenRemote, is that an MQTT Agent Asset? You don’t need the MQTT agent, the connection is made by the MQTT client (MQTTBox) and the MQTT Broker (integrated in OpenRemote)
So you can just create the asset you need (a Thing Asset, a Light asset ecc.), get his asset id and an attribute name, and subscribe to the topic from mqttbox
Hi @aishwaryam, I use MTTX for testing. Copy my screens.
Uploading: Captura de pantalla 2023-01-18 a la(s) 08.35.49.png…
Hi, thanks for the help, i just wanted to know that how to add the map of current area in openremote server.
Instead of “writeattributevalue” write only “attributevalue” for subscribe