Connects subscriptions in Websocket agent

Hi all and happy Sunday.

I am new with Openremote and i dont know how to use Websocket Agent. We have right now all device connecting over MQTT to our EMQX Broker. Now i Enabled on Emqx the websocket. Over the MQTT Explorer i can connect without problem.

ws://111.11.111.111:8083/mqtt
user: user
Password: password

Before to use MQTT Service on OpenRemote i like to test over Websocket but i dont have any ide how to connect to my Websocket.
I create a websocket Agent

connectURL ws://111.11.111.111:8083/mqtt status: connected

But now how to use credential and subscrition. Can some help me on this and provide my a code how to connect.

Thank you in advance
Salva

Hi,
Try adding the attribute “Username password”. Create the attributes to get the data, add them the agent link, add message match predicate and the subscription.
e.g.:

Hi perrochiba thank you for your help,

I made what you mention but something still I’m doing wrong. See print screen

Thanks in advance
Salva

Let’s take a step back.

What is it you’re trying to achieve?

From your initial comment it sounds like you’re trying to connect OpenRemote to another MQTT broker over websocket?

If so this isn’t supported and generally MQTT over websockets is to allow Web browsers to act as an MQTT client.

There is a simple MQTT agent in OpenRemote which will give you an MQTT client to connect to another broker.

Hi Rich

Thank you for your advise. This is exactly what i am looking for. I was not ever that with Openremote you can connect with external MQTT Broker.

Rich I mention on my email i am new on Openremote. If i like to connect over an MQTT agent to external Broker how i do this if my Broker have credentials (User:Password) to connect.

Kind regards
Salva

1 Like

You should be able to add the optional Username Password attribute which takes a JSON object:

{
  "username": "myuser",
  "password": "mypassword"
}
1 Like

Hi Rich

I think I need to understand how Openremote works. What I need if i like to connect to External MQTT Broker.

  1. MQTT Agent for connecting to a External MQTT broke

and where i can add the credential
{
“username”: “myuser”,
“password”: “mypassword”
}

This is me problematic i need to understand the flow of Openremote. Any advice on this.

Thank for your time
Salva

Configuration of agents is done via the attributes of the agent; to add a username and password to an MQTT agent you need modify your agent in the asset viewer to add the well known attribute called Username password:

  1. Click modify in the top right (if you’re already in edit mode then you will already see the save/view buttons)
  2. Click Add attribute
  3. Select Username password from the list

Hi Rich

Thank you for your help now i am connected and receiving data from external MQTT Broker.

What i see Openremote is fit for our Business. Is absolute powerful.

Thank very much
Salva