Hi all,
I'm also interested in the MQTT publisher.
Is there a planned release date or any updates?
Thanks :)
Hi all,
I'm also interested in the MQTT publisher.
Is there a planned release date or any updates?
Thanks :)
You're both absolutely right, maybe I wasn't refreshing the page to see the newly created events, I can now... Thanks so much for all of your help! :)
@Jared-Wiltshire, @phildunlap, thanks for your answers. Because I'm trying to create 5 events for each data point, it'd rather do it in bulk importing the JSON.
I can easily import using the 'Import' tab.
However, if I try to do the same through the API (either using POST /v1/json-emport or /v1/json-emport/upload-file), I get error 202 - no content.
These are the response headers:
{
"Location": "http://192.168.100.254:8080/rest/v1/json-emport/import/IMPORT_e85e1010-ed81-46c3-bc02-2a24637e1065",
"Date": "Wed, 15 Nov 2017 09:33:46 GMT",
"Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "SAMEORIGIN",
"Content-Length": "0",
"X-Xss-Protection": "1; mode=block"
}
I've also tried removing the outer object and the "dataPoints" array, so that the body only contains the data point object. Regarding the timezone, I'm setting it to either blank, '+00:00' or 'Europe/London', as another post suggested checking here for valid timezones: http://joda-time.sourceforge.net/timezones.html.
Any new ideas please? Thanks :)
Re: How do I create event detectors using the Mango API?
Hi all,
I see that event-detectors is now part of the API :)
I'm trying to create multiple event detectors for the same multi-state data point; is that possible to do in one single step?
At the moment I'm trying to do a single event detector using the POST method through the API and using this code (obtained via GET for another data point, and changing the xid, dataSourceId and dataPointId) -- it doesn't work, though, and I get an error 500 back.
{
"xid": "socket_2026-vacant",
"name": "Socket 2026 is vacant",
"duration": 0,
"durationType": "SECONDS",
"alarmLevel": "INFORMATION",
"supportedDataTypes": [
"MULTISTATE"
],
"description": "Socket 2026 is vacant",
"alias": "Socket 2026 is vacant",
"eventType": {
"dataSourceId": 229,
"dataPointId": 400,
"duplicateHandling": "IGNORE",
"typeName": "DATA_POINT",
"rateLimited": false
},
"rtnApplicable": true,
"detectorSourceType": "DATA_POINT",
"validationMessages": [],
"detectorType": "MULTISTATE_STATE"
}
I want these event detectors to be created immediately after the data points are created, so I'm using response.data.id and response.data.dataSourceId to get this info.
I would think that these two ids are enough to link the event detector with the data point? What am I doing wrong here? And can I create multiple event detectors at once?
Thanks and sorry for so many questions ^^U
Silvia
Thanks guys, I'll try it out today or next week and see how it goes! :)
Hi all,
I can successfully create Watch Lists through the Mango REST API using Node.js and Javascript, but how can I assign data points to them?
I have tried retrieving an existing watchlist through GET /v1/watch-lists, but it doesn't have any information about the data points in it. I can get all the data points throught GET /v1/watch-lists/{xid}/data-points, but I still don't get how to create a watchlist and associate data points to it.
Any ideas? Is it a two-step process (creating the watchlist first with POST and updating it later with PUT?)?
Thanks in advance.
Hi again,
Node-mango-client works like a charm for creating the data sources, thanks! :)
However, when I'm trying to create a data point, I start by copying the model schema from POST /v1/data-points and defining a couple of parameters.
{
"enabled": true,
"templateXid": "readings",
"loggingProperties": {
"tolerance": 0,
"discardExtremeValues": false,
"discardLowLimit": 0,
"discardHighLimit": 0,
"loggingType": "ALL",
"intervalLoggingType": "MINUTES",
"intervalLoggingPeriod": {
"periods": 1,
"type": "MINUTES"
},
"overrideIntervalLoggingSamples": false,
"intervalLoggingSampleWindowSize": 0,
"cacheSize": 0
},
"textRenderer": {
"settable": false,
"relinquishable": false
},
"chartRenderer": {
"settable": false,
"relinquishable": false
},
"modelType": "",
"validationMessages": [
{
"message": "",
"level": "",
"property": ""
}
],
"id": 0,
"dataSourceId": 0,
"readPermission": "",
"setPermission": "",
"chartColour": "",
"rollup": "NONE",
"plotType": "LINE",
"purgeOverride": false,
"purgePeriod": {
"periods": 1,
"type": "YEARS"
},
"pointLocator": {
"settable": false,
"relinquishable": false
},
"deviceName": "socket 1743",
"dataSourceXid": "SK1743",
"useIntegralUnit": false,
"useRenderedUnit": true,
"unit": "kW",
"renderedUnit": "kW",
"integralUnit": "",
"dataSourceName": "socket_1743",
"name": "reading",
"xid": "sk1743_r"
}
To make it easy, I copy this into the 'body' and I use the 'Try it Out' button, but it returns an error 400.
Response Code
400
Response Body
{
"message": null,
"stackTrace": "com.serotonin.m2m2.web.mvc.rest.v1.mapping.SuperclassModelDeserializer.deserialize(SuperclassModelDeserializer.java:49)\ncom.serotonin.m2m2.web.mvc.rest.v1.mapping.SuperclassModelDeserializer.deserialize(SuperclassModelDeserializer.java:25)\ncom.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:499)\ncom.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:101)\ncom.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:357)\ncom.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)\ncom.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)\ncom.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2922)\norg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:237)\norg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:225)\norg.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:201)\norg.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:150)\norg.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:128)\norg.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)\norg.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:158)\norg.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)\norg.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)\norg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)\norg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)\norg.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)\norg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)\norg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)\norg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)\norg.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:707)\norg.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:790)\norg.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)\norg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)\norg.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:110)\ncom.serotonin.m2m2.web.filter.MangoShallowEtagHeaderFilter.doFilterInternal(MangoShallowEtagHeaderFilter.java:80)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)\norg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:198)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ncom.serotonin.m2m2.web.mvc.spring.security.PermissionExceptionFilter.doFilter(PermissionExceptionFilter.java:32)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:134)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)\norg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)\norg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\norg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)\norg.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\norg.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\norg.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\norg.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\norg.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)\norg.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\norg.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\norg.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)\norg.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\norg.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\norg.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:397)\norg.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\norg.eclipse.jetty.server.Server.handle(Server.java:524)\norg.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)\norg.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)\norg.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\norg.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\norg.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)\norg.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)\norg.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)\njava.lang.Thread.run(Thread.java:748)\n"
}
Response Headers
{
"Date": "Wed, 08 Nov 2017 15:58:26 GMT",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "SAMEORIGIN",
"Content-Type": "application/json;charset=utf-8",
"Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
"Messages": "error",
"Content-Length": "10009",
"X-Xss-Protection": "1; mode=block"
}
The model from the REST API also makes me wonder how to define the data type in the pointLocator object, and the type and units in textRenderer. Also, in the case of multistate points, how to define the multistateValues and event detectors?
I thought it would be as simple as copying the export JSON from the data point...
Thanks again for your time.
Thanks @phildunlap and @Jared-Wiltshire :)
I'm using node.js so I will give node-mango-client a go and see how it goes!
Cheers,
Silvia
Hi all,
I'm trying to create Data Sources and Data Points using Javascript, through the Mango REST API.
So far I've enabled swagger and I've been checking data-sources (POST method, as I want to create new data sources). I've successfully created a data source using the 'Try it out' button. However, I'm very confused as to how to do it with Javascript.
Do you have any tutorials or examples, please?
Thanks so much.
Thanks @phildunlap , I'll try what you've sent me asap and post the results back here :)
Hi @Jared-Wiltshire,
Yes, my objective is to read them and then compare the M001.reading
with the previous one, see which is the increment (if any), plot it, etc.
I've configured new datapoints as instructed (same for M002):
...and these are the errors thrown:
ERROR 2017-07-18T09:19:19,813 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.getJsonValue:375) - ERROR
ERROR 2017-07-18T09:19:19,813 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.messageArrived:415) - Error during read topic: "test/array2" datap
oint: "RPi - RPi_M001_reading_new" payload: "{"M001":{"timestamp":1500366055687,
"reading":2000},"M002":{"timestamp":1500366055687,"reading":3000}}" exception: "
ERROR"
ERROR 2017-07-18T09:19:19,954 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.getJsonValue:375) - ERROR
ERROR 2017-07-18T09:19:19,954 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.messageArrived:415) - Error during read topic: "test/array2" datap
oint: "RPi - RPi_M002_reading_new" payload: "{"M001":{"timestamp":1500366055687,
"reading":2000},"M002":{"timestamp":1500366055687,"reading":3000}}" exception: "
ERROR"
I'm afraid that there's a bug in the MQTT datasource.
Would any of you guys be able to have a look into it?
Thanks :)
@phildunlap and @Jared-Wiltshire, thank you both for your replies.
The issue with M001
vs meterOne
isn't there anymore, at some point I decided to change the identifier to see if that was the problem, and I screenshoted some old error. Apologies for that. As you can see, when everything is named M001
, the same error appears:
ERROR 2017-07-17T09:18:36,296 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.messageArrived:415) - Error during read topic: "test/array2" datap
oint: "RPi - M001_RPi" payload: "{"M001":{"timestamp":1500279612733,"reading":20
00},"M002":{"timestamp":1500279612733,"reading":3000}}" exception: "ERROR"
@Jared-Wiltshire said in Sending JSON objects via MQTT:
Re. parsing out the individual components of the JSON object on the dashboards, I'd recommend not doing this, you wont be able to use the datapoints effectively on any of the Mango pages.
Any alternatives to this? Is there any other format / data type that would allow me to send similar data (a meter identifier, a reading and a timestamp) x 4?
Thanks and regards.
Some more information on the issue, as I'm still unable to work around it.
This is what I'm sending (or trying to) via MQTT:
{"M001":{"timestamp":1499441290602,"reading":2000},
"M002":{"timestamp":1499441290602,"reading":3000}}
When the data point is configured as a JSON subscribe topic type, as below:
Mango throws an ERROR.
ERROR 2017-07-10T10:25:09,112 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.messageArrived:415) - Error during read topic: "test/array2" datap
oint: "RPi - M001_RPi" payload: "{"meterOne":{"timestamp":1499678815845,"reading
":2000},"M002":{"timestamp":1499678815845,"reading":3000}}" exception: "ERROR"
Help doesn't work to see how to configure the JSON subscriber :(
If the JSON value path is set to '$.M001', this is the error received:
ERROR 2017-07-10T10:43:04,379 (com.infiniteautomation.m2m2.mqtt.client.MqttClien
tDataSourceRT.messageArrived:415) - Error during read topic: "test/array2" datap
oint: "RPi - M001_RPi" payload: "{"M001":{"timestamp":1499679891268,"reading":20
00},"M002":{"timestamp":1499679891268,"reading":3000}}" exception: "com.serotoni
n.json.type.JsonObject cannot be cast to com.serotonin.json.type.JsonString"
If the data point is configured as 'Plain', then the terminal throws no errors and the message is sent to Mango. I'm trying to access the object named "M001" in different ways, as below:
<div layout="column" layout-fill flex>
<md-card flex>
<ma-get-point-value point-xid="RPi_M001_reading" point="array2"></ma-get-point-value>
<li> array2.value: {{array2.value}}</li>
<li>array2.value[1]: {{array2.value[1]}}</li>
<li>array2.value.M001: {{array2.value.M001}}</li>
<li>array2.value["M001"]: {{array2.value["M001"]}}</li>
<li>array2.value[M001]: {{array2.value[M001]}}</li>
</md-card>
</div>
And these are the results:
I can 'read' the whole string, but I can't individually access the object properties.
Can anyone offer any support please, as I'm running out of ideas?
Thanks in advance and have a great day :)
Thanks for your answer @Will-Geller :)
I managed to sort it deleting the 'stroke' properties from the XML definition in Inkscape and using ma-selector and ng-class :)
Hi,
I'm trying to set up a data point from an MQTT data source. The data received will be a JSON object with timestamp.
Do you have any documentation regarding the configuration of the 'subscribe topic', as the blue '?' next to 'Point details' gives an eror? (Document id not found: mqttClientPP)
I'm having issues knowing what to write on the JSON value path, JSON timestamp path and JSON timestamp pattern. If I subscribe as a 'plain' topic type, then I receive the complete object but I don't see how to access the different properties, and if I subscribe as a JSON, then it says that the path must start with a '$'....
Any ideas please? Thanks :)
Silvia
'fill' is ok, but not 'stroke' or derivatives.
'stroke' and others are working now.
Inkscape was over-writing the CSS properties, so I deleted all the 'style' properties within Inkscape and now the paths take any options.
Still, it'd be good to have a look at your documentation :)
@Will-Geller said in Custom Angular Directives:
2_1486146172329_svgRect.js
1_1486146172329_svgDisplay.js
0_1486146172328_svgCircle.js
Hi @Will-Geller,
The links are broken :(
Would it be possible to update them please, as I'm looking into how to change stroke style of a SVG file with CSS styling? 'fill' is ok, but not 'stroke' or derivatives. I might be able to get some ideas from your files.
Thanks :)
Silvia