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

Advanced MQTT messages

SOLVED

Re: Advanced MQTT messages

Thank you for the response Jeremy.

The warning I found I am receiving is:

11:00:56 WARN - runtime not configured for conversion of "[object Object]" from "JSON" to "STRING"

Can you perhaps provide some insight on this warning?

Thank you very much!

Re: Advanced MQTT messages

If you are attempting to print out a JSON object, or to convert it from JSON to string, you often need to wrap it in JSON.stringify(jsonObject).  The message you are getting seems to imply that you're attempting a JSON to String conversion. 

It's possible that this message is coming from code you might be using to debug this problem and may not actually be related to the problem at hand, but at the very least, this should be a starting point for this specific message.

Re: Advanced MQTT messages

Hi Jeremy,

I managed to eliminate the warning from above and am not receiving any other errors or warnings in the log so at this point I think my data change is just not firing.

How could I verify this?

Any insight would be much appreciated, thank you!

Re: Advanced MQTT messages

Best thing to do is to temporarily set up a logging line in your subscription for the data change event that you're watching. 

logger.warn("Entered DataChange for Thing <>");

This will log a line to the ScriptLog each time the data change event is called on the thing in question.  It can be verbose and shouldn't be left in place beyond debugging, but if you're not seeing the line, it could also indicate that the event you're expecting is not actually firing.

Highlighted

Re: Advanced MQTT messages

Inserted the "logger" line in the same subscription as shown above, and verified that the temp property is changing, and I am not seeing the line in the script log. And again, run time instance permissions have been changed.


Could this have anything to do with the message coming in from my MQTT device or would this still be a configuration issue in ThingWorx?

Re: Advanced MQTT messages

That change is on a Thing Template, and based on the name it's not clear what template you're using (Connection, Subscriber or MQTT, though I'd guess the latter).   For this to work, you need to have your subscription subscribing to the Data Change event on a MQTT_Subscriber derived Thing (not Thing Template!) that is configured for the appropriate connection. 

Re: Advanced MQTT messages

Yes, I am using the MQTT template. And I have changed my data change subscription to occur on the Thing with the MQTT_Master Template rather than the actual template and the event is still not firing.

Images below show my edited configurations. I even used the line you provided me with a Data change event for my MQTT devices last connection time, and upon multiple value changes still did not display the message on the script logger.