Hi.
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
- Added a new asset (MQTT agent)
- 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â
Hi,
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.
@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:
-
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
-
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/orsubscribeTopic
successfully connected my mqtt client by using the link.
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.
- In the Thing Asset create a Attribute âCustom Attributeâ (choose name, value type)
- Click on the Attribute and click on âADD CONFIGURATION ITEMSâ
- Add an Agent link and click on it. Then choose the MQTT AgentAsset
- Click on the Agent link and click âADD PARAMETERâ
- 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"}
Hey
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.