cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Thing view property value receive from Mqtt Broker but not store that in value stream

dbologna1
1-Visitor

Thing view property value receive from Mqtt Broker but not store that in value stream

Hi All,

I need information about the following problem :

I used MQTT  extention in Thingworx (I have impoted the MQTT estention) and I created a Thing using  Thing Template MQTT.

I have configured the connection Mqtt to Broker mosquitto using serverName test.mosquitto.org

I have  developed a Mqtt published publisher.exe using  C#.

I checked the system and Thingworx has received the values published from publisher.exe.

The property value on Thingworx was defined  as STRING with persistent and logged enabled.

The property values  published from publisher.exe are visible on Thing property (by refresh) or in mashup that used GetData service (GetProperty + convert string value to number) that refresh the value every every 5 second.

When I want to look the property value using a widget  Time Series  Chart by QueryPropertyHistory I’m not found value in value stream.

The property value was received from the MQTT broker but they  are not stored in value stream, Why ?

Is needed  particularly configuration ?

Many Thanks

BR

Dimitri

20 REPLIES 20

Hi Dimitri! Have you checked the properties as "Logged"? It is required to push them to the Value Stream.

Hi Adam,

many thanks for your answer.

The Property of thing  have persistent and logged enabled.

BR

Dimitri

Hi Adam,

I checked the Application Monitoring and I received the following message (I think for any value received from Broker).

These message could be the reason that the value stream was not loaded ?

BR

Dimitri

It certainly can be the issue. I've looked more deeply into the MQTT Extension and found the line with this error. It is not clear, but can be associated with baseType of the value. Try to change it from String to Numeric or Integer in Thing property.

BR,

Adam

Hi Adam,

I have changed the basetype of property from STRING to NUMBER (I restarted the web server Apache/Tomcat) but the problem is not solved.

Thingworx received the new property value but not stored it into values stream.

BR

Dimitri

Hi Dimitri,

Can you specify which version of ThingWorx are you using and which database?

And one more thing is that you are calling QueryPropertyHistory service on Thing or on the ValueStream?

BR,

Adam

Hi Adam,

I'm using :

1)  the version 7.2.3-b48 of Thingworx

2) the H2  database 

3) the service  QueryPropertyHistory on Thing.

BR

Dimitri

Hi Dimitri,

Have you tested a QueryPropertyHistory service directly from the Thing with your parameters or with default ones? If the Thing is receiving data and storing it in property without problems, there should be no problem with ValueStream also.

5.PNG

You also test it, by changing a property value by yourself. Just click on SET button in the Value column in your property row. Change the value few times and check if it is stored in ValueStream.

BR,

Adam

Hi Adam,

I have tested the QueryPropertyHistory on the Thing with parameters value and without value, but the output it's the same. Empty.

If I change  the  property value using button set (in Panel Property of Thing)  the values are  stored the values on value stream.

The output of QueryPropertyHistory is now not empty

The previous image are referred to the output of QueryPropertyHistory after manual setting.

Why this process does'nt work for data received from Mqqt Broker ?

Br

Dimitri

Hi Dimitri,

To be honest this behavior is very strange. The last thing, which can help is changing "DataChange" option from ​Value​ to ​Always​. Maybe it can help in this case.

BR,

Adam

Hi Adam,

I have changed in Property of Thing the value of Data Change info to Always or On but the output of QueryPropertyHistory is the same. Empty.

BR

Dimitri

Hi Dimitri,

Did you get the solution to this problem? I am facing the same issue and can see same Error in Application Log. I don't understand myself what is the problem with it?

Neetu

Hi there,

We are experiencing something similar

- Subscribing to a JSON input from MQTT

- On data change, parsing the JSON and setting its content to corresponding properties

(so far this works)

after this, we want to store the data into either a stream or a value stream but we get a java exception when the MQTTSubscriber Thing is trying to write the properties. Could this be a bug in the MQTT extension? Sounds like this should be pretty basic functionality.

I think it can be related to the JSON as a data type. You can try to switch to STRING and then parse it in ThingWorx.

Make a try and let me know.

Best,

Adam

Hello Dimitri,

did you find solution? I do not want parsing data. I have values from device in property view, but they can not store in Value stream. If I try make subscription on anydatachange for move values to other properties then I get also error in application log. Can anyone help me please?

TWX 8.1, local installed MosquitoBroker on 1883 and MqTT extensions 2.1.0

Error Handling Publish Arrived for [DemoThing/DoorStatus] : [null]

Hi Karel,

Please, can you send me the code of subscription to take json packet from Thing MQTT Subscribe Thing and store that into properties of Target Thing.

I'm using a Thing to manage the  MQTT Subscribe service and more Thing Target  that contains a properties and value stream.

BR

Dimitri

Thingworx has some new MQTT functionality in the 8.2 release. I think that it would be worth upgrading and testing with that version before putting too much energy into work-arounds.

Hi Erik,

but release 8.2 is still not able to download. Or do you know where is it possible? Thx Karel

Hello,

I found solution on thic community. So we can close this topic.

Get null pointer exception if property change via mqtt

Visibility Permissions when logging properties

You have to go to your ValueStream and click on ThingworxPersistenceProvider and click on View. Than you must start the AddVisibilityPermission-Service of the PersistenceProvider:


principal: Everyone

principalType: Organization


After that the ValueStream will work

juancmaldo
6-Contributor
(To:dbologna1)

Hi dbologna,

 

Did you solve this problem?

Announcements


Top Tags