Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » MQTT: Error in creating container/content instance on MN-CSE/IN-CSE
MQTT: Error in creating container/content instance on MN-CSE/IN-CSE [message #1782043] Fri, 16 February 2018 12:28 Go to next message
Muhammad Kamran is currently offline Muhammad KamranFriend
Messages: 18
Registered: November 2017
Junior Member
Tried to create container/content instance on MN-CSE/IN-CSE over MQTT by following https://wiki.eclipse.org/OM2M/one/MQTT_Binding, but receiving following response.

{
"m2m:rsp" : {
"m2m:rsc" : 4000,
"m2m:pc" : "No Operation provided",
"m2m:fr" : "/MN-CSE7"
}
}


Request Topic: /oneM2M/req/AE_123/in-cse/json

Payload
{
"m2m:rqp" : {
"fr" : "AE_123",
"to" : "/in-cse/in-name/AE_123",
"op" : 1,
"rqi": 123456,
"pc": {
"m2m:cnt" : {
"rn": "cntName"
}
},
"ty": 3
}
}
Re: MQTT: Error in creating container/content instance on MN-CSE/IN-CSE [message #1783098 is a reply to message #1782043] Wed, 07 March 2018 21:39 Go to previous messageGo to next message
Jairo  Ariza is currently offline Jairo ArizaFriend
Messages: 9
Registered: March 2018
Junior Member
Hi with this python code I manage to create app, container and send data via MQTT.

import paho.mqtt.client as mqtt
import time
def on_message(client, userdata, msg):
print("Respuesta del topico: "+str(msg.payload.decode("UTF-8")))

topic="/oneM2M/req/Sensor_MQTT/in-cse/json"
payload_lista=[]
payload1="""{"m2m:rqp": {"m2m:fr": "Sensor_1","m2m:to": "/in-cse","m2m:op": 2,"m2m:rqi": 123456}}"""

payload2="""{"m2m:rqp": {
"m2m:fr" : "admin:admin",
"m2m:to" : "/in-cse/in-name",
"m2m:op" : 1,
"m2m:rqi": 123456,
"m2m:pc": {
"m2m:ae": {
"api": "app-sensor",
"rr": "false",
"lbl": ["Type/sensor", "Category/temperature", "Location/home"],
"rn": "MY_SENSOR"}},
"m2m:ty": 2}}"""

payload3="""{"m2m:rqp": {
"m2m:fr" : "admin:admin",
"m2m:to" : "/in-cse/in-name/MY_SENSOR",
"m2m:op" : 1,
"m2m:rqi": 123456,
"m2m:pc": {"m2m:cnt": {"rn": "DESCRIPTOR"}},
"m2m:ty": 3}}"""

payload5="""{"m2m:rqp": {
"m2m:fr" : "admin:admin",
"m2m:to" : "/in-cse/in-name/MY_SENSOR",
"m2m:op" : 1,
"m2m:rqi": 123456,
"m2m:pc": {"m2m:cnt": {"rn": "DATA"}},
"m2m:ty": 3}}"""

payload6="""{"m2m:rqp": {
"m2m:fr" : "admin:admin",
"m2m:to" : "/in-cse/in-name/MY_SENSOR/DATA",
"m2m:op" : 1,
"m2m:rqi": 123454,
"m2m:pc": {
"m2m:cin": {"cnf":"message",
"con":"55 C"
}
},
"m2m:ty": 4}}"""

payload_lista.append(payload1)
payload_lista.append(payload2)
payload_lista.append(payload3)
payload_lista.append(payload5)
payload_lista.append(payload6)

for payload in payload_lista:
client = mqtt.Client("OM2M_MQTT")
client.on_message = on_message
client.connect("127.0.0.1", 1883)

client.loop_start()
client.subscribe("/oneM2M/resp/in-cse/Sensor_MQTT/json")
print("prueba del MQTT: "+payload)
print()
client.publish(topic,payload)
time.sleep(1)
client.on_message = on_message
client.loop_stop()

I hope this helps

Regards

[Updated on: Wed, 07 March 2018 21:41]

Report message to a moderator

Re: MQTT: Error in creating container/content instance on MN-CSE/IN-CSE [message #1783122 is a reply to message #1783098] Thu, 08 March 2018 07:07 Go to previous messageGo to next message
Muhammad Kamran is currently offline Muhammad KamranFriend
Messages: 18
Registered: November 2017
Junior Member
Thanks, it helped, replacing key parameters of json solved issue e.g "op" with "m2m:op"
Re: MQTT: Error in creating container/content instance on MN-CSE/IN-CSE [message #1805312 is a reply to message #1783098] Thu, 11 April 2019 13:35 Go to previous message
Ilan t is currently offline Ilan tFriend
Messages: 6
Registered: April 2019
Junior Member
Hi Jairo Ariza,

I am interested in Establishing oneM2M MQTT client . In order to do that I have to build OM2M server with MQTT support. could you please provide me how you have established.

I am trying to build OM2M server as described in "https://wiki.eclipse.org/OM2M/one/Clone "
But getting error message.

[INFO] Scanning for projects...
[ERROR] Invalid extension descriptor for org.eclipse.tycho:tycho-maven-plugin:0.20.0: error in opening zip file
[ERROR] Invalid extension descriptor for org.apache.maven.wagon:wagon-ssh:2.8: error in opening zip file
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: eclipse-plugin @ org.eclipse.om2m:org.eclipse.om2m.commons:[unknown-version], /home/mbit/git/org.eclipse.om2m/org.eclipse.om2m.commons/pom.xml, line 23, column 14


Could you please tell me how to get OM2M server with MQTT support without building as offline pre-build package, if available.

Please refer my post :
https://www.eclipse.org/forums/index.php/m/1805308/?srch=OM2M+build+error#msg_1805308
for more details on what i tried

Thanks in advance
Ilan T
Previous Topic:Test OM2M
Next Topic:org.eclipse.equinox.console bundle is missing
Goto Forum:
  


Current Time: Sun Oct 13 04:00:33 GMT 2024

Powered by FUDForum. Page generated in 0.03842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top